mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
Apply suggestions from code review
Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>
This commit is contained in:
@@ -45,12 +45,12 @@ public class FxApplicationStyle {
|
||||
}
|
||||
|
||||
private void appThemeChanged(@SuppressWarnings("unused") ObservableValue<? extends UiTheme> observable, UiTheme oldValue, UiTheme newValue) {
|
||||
if (oldValue == UiTheme.AUTOMATIC && newValue != UiTheme.AUTOMATIC) {
|
||||
removeOsThemeListener();
|
||||
}
|
||||
|
||||
if (newValue == UiTheme.AUTOMATIC) {
|
||||
if (oldValue == newValue) {
|
||||
// no-op
|
||||
} else if (newValue == UiTheme.AUTOMATIC) {
|
||||
registerOsThemeListener();
|
||||
} else if (oldValue == UiTheme.AUTOMATIC) {
|
||||
removeOsThemeListener();
|
||||
}
|
||||
|
||||
applyTheme(newValue);
|
||||
@@ -86,7 +86,7 @@ public class FxApplicationStyle {
|
||||
} else {
|
||||
switch (uiTheme) {
|
||||
case AUTOMATIC -> {
|
||||
var osTheme = appearanceProvider.isPresent() ? appearanceProvider.get().getSystemTheme() : Theme.LIGHT;
|
||||
var osTheme = appearanceProvider.map(UiAppearanceProvider::getSystemTheme).orElse(Theme.LIGHT);
|
||||
systemInterfaceThemeChanged(osTheme);
|
||||
}
|
||||
case LIGHT -> loadAndApplyLightTheme();
|
||||
|
||||
@@ -26,7 +26,6 @@ public class JfxUiAppearanceProvider implements UiAppearanceProvider {
|
||||
private final ConcurrentHashMap<UiAppearanceListener, ChangeListener<ColorScheme>> uiAppearanceListeners = new ConcurrentHashMap<>();
|
||||
private final Platform.Preferences preferences = Platform.getPreferences(); //Note: this service impl MUST be loaded in the fx application thread
|
||||
|
||||
|
||||
@Override
|
||||
public Theme getSystemTheme() {
|
||||
return switch (preferences.getColorScheme()) {
|
||||
|
||||
Reference in New Issue
Block a user