Ver Fonte

partially reverted 900fdd7f, fixing "stutter" startup on macos

Tobias Hagemann há 4 anos atrás
pai
commit
ab3dd779d2

+ 3 - 4
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java

@@ -1,6 +1,5 @@
 package org.cryptomator.ui.addvaultwizard;
 
-import com.tobiasdiez.easybind.EasyBind;
 import dagger.Lazy;
 import org.cryptomator.ui.common.ErrorComponent;
 import org.cryptomator.ui.common.FxController;
@@ -84,11 +83,11 @@ public class CreateNewVaultLocationController implements FxController {
 	public void initialize() {
 		predefinedLocationToggler.selectedToggleProperty().addListener(this::togglePredefinedLocation);
 		usePresetPath.bind(predefinedLocationToggler.selectedToggleProperty().isNotEqualTo(customRadioButton));
-		EasyBind.subscribe(vaultPath, this::vaultPathDidChange);
+		vaultPath.addListener(this::vaultPathDidChange);
 	}
 
-	private void vaultPathDidChange(Path newValue) {
-		if (newValue != null && !Files.notExists(newValue)) {
+	private void vaultPathDidChange(@SuppressWarnings("unused") ObservableValue<? extends Path> observable, @SuppressWarnings("unused") Path oldValue, Path newValue) {
+		if (!Files.notExists(newValue)) {
 			warningText.set(resourceBundle.getString("addvaultwizard.new.fileAlreadyExists"));
 		} else {
 			warningText.set(null);

+ 2 - 3
main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java

@@ -1,6 +1,5 @@
 package org.cryptomator.ui.fxapp;
 
-import com.tobiasdiez.easybind.EasyBind;
 import dagger.Lazy;
 import org.cryptomator.common.LicenseHolder;
 import org.cryptomator.common.settings.Settings;
@@ -67,7 +66,7 @@ public class FxApplication extends Application {
 		LOG.trace("FxApplication.start()");
 		Platform.setImplicitExit(false);
 
-		EasyBind.subscribe(hasVisibleStages, this::hasVisibleStagesChanged);
+		hasVisibleStages.addListener(this::hasVisibleStagesChanged);
 
 		settings.theme().addListener(this::appThemeChanged);
 		loadSelectedStyleSheet(settings.theme().get());
@@ -78,7 +77,7 @@ public class FxApplication extends Application {
 		throw new UnsupportedOperationException("Use start() instead.");
 	}
 
-	private void hasVisibleStagesChanged(boolean newValue) {
+	private void hasVisibleStagesChanged(@SuppressWarnings("unused") ObservableValue<? extends Boolean> observableValue, @SuppressWarnings("unused") boolean oldValue, boolean newValue) {
 		if (newValue) {
 			trayIntegration.ifPresent(TrayIntegrationProvider::restoredFromTray);
 		} else {

+ 6 - 5
main/ui/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java

@@ -1,6 +1,5 @@
 package org.cryptomator.ui.mainwindow;
 
-import com.tobiasdiez.easybind.EasyBind;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.VaultListManager;
 import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
@@ -13,6 +12,7 @@ import javax.inject.Inject;
 import javafx.beans.binding.Bindings;
 import javafx.beans.binding.BooleanBinding;
 import javafx.beans.property.ObjectProperty;
+import javafx.beans.value.ObservableValue;
 import javafx.collections.ListChangeListener;
 import javafx.collections.ObservableList;
 import javafx.fxml.FXML;
@@ -41,7 +41,7 @@ public class VaultListController implements FxController {
 		this.removeVault = removeVault;
 		this.noVaultSelected = selectedVault.isNull();
 		this.emptyVaultList = Bindings.isEmpty(vaults);
-		EasyBind.subscribe(selectedVault, this::selectedVaultDidChange);
+		selectedVault.addListener(this::selectedVaultDidChange);
 	}
 
 	public void initialize() {
@@ -58,10 +58,11 @@ public class VaultListController implements FxController {
 		});
 	}
 
-	private void selectedVaultDidChange(Vault newValue) {
-		if (newValue != null) {
-			VaultListManager.redetermineVaultState(newValue);
+	private void selectedVaultDidChange(@SuppressWarnings("unused") ObservableValue<? extends Vault> observableValue, @SuppressWarnings("unused") Vault oldValue, Vault newValue) {
+		if (newValue == null) {
+			return;
 		}
+		VaultListManager.redetermineVaultState(newValue);
 	}
 
 	@FXML