mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-04 23:27:21 +00:00
Merge branch 'feature/jni-mac-tray-icon' into ‘feature/new-ui'
This commit is contained in:
@@ -10,9 +10,6 @@ import javax.inject.Inject;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
@TrayMenuScoped
|
||||
public class TrayIconController {
|
||||
@@ -23,6 +20,7 @@ public class TrayIconController {
|
||||
private final TrayImageFactory imageFactory;
|
||||
private final TrayMenuController trayMenuController;
|
||||
private final TrayIcon trayIcon;
|
||||
// private final Optional<MacFunctions> macFunctions;
|
||||
|
||||
@Inject
|
||||
TrayIconController(Settings settings, TrayImageFactory imageFactory, TrayMenuController trayMenuController) {
|
||||
@@ -30,9 +28,11 @@ public class TrayIconController {
|
||||
this.trayMenuController = trayMenuController;
|
||||
this.imageFactory = imageFactory;
|
||||
this.trayIcon = new TrayIcon(imageFactory.loadImage(), "Cryptomator", trayMenuController.getMenu());
|
||||
// this.macFunctions = macFunctions;
|
||||
}
|
||||
|
||||
public void initializeTrayIcon() {
|
||||
// macFunctions.map(MacFunctions::uiAppearance).ifPresent(uiAppearance -> uiAppearance.addListener(this::macInterfaceThemeChanged));
|
||||
settings.theme().addListener(this::themeChanged);
|
||||
|
||||
if (SystemUtils.IS_OS_WINDOWS) {
|
||||
@@ -50,6 +50,7 @@ public class TrayIconController {
|
||||
trayMenuController.initTrayMenu();
|
||||
}
|
||||
|
||||
// public void macInterfaceThemeChanged() {
|
||||
private void themeChanged(@SuppressWarnings("unused") Observable observable) {
|
||||
trayIcon.setImage(imageFactory.loadImage());
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ import java.awt.Toolkit;
|
||||
@TrayMenuScoped
|
||||
class TrayImageFactory {
|
||||
|
||||
// private final Optional<MacFunctions> macFunctions;
|
||||
private final Settings settings;
|
||||
|
||||
|
||||
@Inject
|
||||
// TrayImageFactory(Optional<MacFunctions> macFunctions) {
|
||||
// this.macFunctions = macFunctions;
|
||||
TrayImageFactory(Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
@@ -23,6 +27,10 @@ class TrayImageFactory {
|
||||
}
|
||||
|
||||
private String getMacResourceName() {
|
||||
// MacApplicationUiInterfaceStyle interfaceStyle = macFunctions.map(MacFunctions::uiAppearance) //
|
||||
// .map(MacApplicationUiAppearance::getCurrentInterfaceStyle) //
|
||||
// .orElse(MacApplicationUiInterfaceStyle.LIGHT);
|
||||
// switch (interfaceStyle) {
|
||||
switch (settings.theme().get()) {
|
||||
case DARK:
|
||||
return "/tray_icon_mac_white.png";
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package org.cryptomator.ui.traymenu;
|
||||
|
||||
import dagger.Module;
|
||||
import org.cryptomator.common.JniModule;
|
||||
import org.cryptomator.ui.fxapp.FxApplicationComponent;
|
||||
|
||||
@Module(subcomponents = {FxApplicationComponent.class})
|
||||
@Module(includes = {JniModule.class}, subcomponents = {FxApplicationComponent.class})
|
||||
abstract class TrayMenuModule {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user