Skip to content

Commit

Permalink
Merge branch 'master' into 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Dansoftowner committed Dec 5, 2020
2 parents 5908e2a + fa07e03 commit 8745c64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ public void showFullNormalProgress() {
*/
public abstract void closeOperations();

/**
* @deprecated use {@link TaskbarProgressbarFactory#getTaskbarProgressbar(Stage)} instead.
*/
@Deprecated
public static TaskbarProgressbar createInstance(Stage stage) {
return TaskbarProgressbarFactory.getTaskbarProgressbar(stage);
}

private synchronized static void createCache() {
if (cache == null) cache = TaskbarProgressbarFactory.getTaskbarProgressbarImpl(null);
}
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/com/nativejavafx/taskbar/util/OS.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
* application runs on.
*/
public class OS {

private static final String OS = System.getProperty("os.name");
private static final String VERSION = System.getProperty("os.version");

private static final boolean WINDOWS = OS.startsWith("Windows");
private static final boolean WINDOWS_7_OR_LATER = WINDOWS && versionGreaterThanOrEqualTo(6.1F);

private OS() {
}

Expand All @@ -16,19 +23,14 @@ private OS() {
* <code>false</code> otherwise
*/
public static boolean isWindows7OrLater() {
double version = Double.parseDouble(System.getProperty("os.version"));
double win7Version = 6.1; //Windows 7 has this version number

return isWindows() && version >= win7Version;
return WINDOWS_7_OR_LATER;
}

/**
* Checks that the OS is windows or not.
*
* @return <code>true</code> if the OS is windows;
* <code>false</code> otherwise
*/
public static boolean isWindows() {
return System.getProperty("os.name").startsWith("Windows");
public static boolean versionGreaterThanOrEqualTo(float value) {
try {
return Float.parseFloat(VERSION) >= value;
} catch (Exception e) {
return false;
}
}
}

0 comments on commit 8745c64

Please sign in to comment.