Skip to content

Commit

Permalink
Add @threadsafe on OsThemeDetector.isDark, OsThemeDetector.registerLi…
Browse files Browse the repository at this point in the history
…stener, OsThemeDetector.removeListener, OsThemeDetector.isSupported
  • Loading branch information
Fenrur committed Jul 15, 2022
1 parent 71cb4c3 commit 8f2db06
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/jthemedetecor/OsThemeDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private static void logDetection(String desktop, Class<? extends OsThemeDetector
*
* @return {@code true} if the os uses dark theme; {@code false} otherwise.
*/
@ThreadSafe
public abstract boolean isDark();

/**
Expand All @@ -90,13 +91,16 @@ private static void logDetection(String desktop, Class<? extends OsThemeDetector
* @param darkThemeListener the {@link Consumer} that accepts a {@link Boolean} that represents
* that the os using a dark theme or not
*/
@ThreadSafe
public abstract void registerListener(@NotNull Consumer<Boolean> darkThemeListener);

/**
* Removes the listener.
*/
@ThreadSafe
public abstract void removeListener(@Nullable Consumer<Boolean> darkThemeListener);

@ThreadSafe
public static boolean isSupported() {
return OsInfo.isWindows10OrLater() || OsInfo.isMacOsMojaveOrLater() || OsInfo.isGnome();
}
Expand Down

0 comments on commit 8f2db06

Please sign in to comment.