Browse Source

replace static icon in vault detail screen by statusView

Armin Schrenk 4 năm trước cách đây
mục cha
commit
b256670bcc

+ 6 - 0
src/main/java/org/cryptomator/ui/controls/FontAwesome5StatusView.java

@@ -33,6 +33,12 @@ public class FontAwesome5StatusView extends Label {
 		animatedSpinner.glyphSizeProperty().bind(glyphSize);
 
 		EasyBind.subscribe(glyphProperty(), this::spinnerOrIcon);
+		EasyBind.subscribe(glyphSize, this::shrinkToGlyphSize);
+	}
+
+	private void shrinkToGlyphSize(Number newValue) {
+		double sizeInPx = newValue.doubleValue() * 1.333;
+		setMaxSize(sizeInPx, sizeInPx);
 	}
 
 	private void spinnerOrIcon(FontAwesome5Icon icon) {

+ 12 - 0
src/main/resources/css/dark_theme.css

@@ -804,6 +804,18 @@
 	-fx-scale-shape: false;
 }
 
+/**
+statusView
+**/
+
+.status-view-white .glyph-icon {
+	-fx-fill: white;
+}
+
+.status-view-white .progress-indicator .segment {
+	-fx-background-color: white;
+}
+
 /*******************************************************************************
  *                                                                             *
  * ProgressIndicator                                                           *

+ 12 - 0
src/main/resources/css/light_theme.css

@@ -802,6 +802,18 @@
 	-fx-scale-shape: false;
 }
 
+/**
+statusView
+**/
+
+.status-view-white .glyph-icon {
+	-fx-fill: white;
+}
+
+.status-view-white .progress-indicator .segment {
+	-fx-background-color: white;
+}
+
 /*******************************************************************************
  *                                                                             *
  * ProgressIndicator                                                           *

+ 2 - 1
src/main/resources/fxml/vault_detail.fxml

@@ -10,6 +10,7 @@
 <?import javafx.scene.layout.StackPane?>
 <?import javafx.scene.layout.VBox?>
 <?import javafx.scene.shape.Circle?>
+<?import org.cryptomator.ui.controls.FontAwesome5StatusView?>
 <VBox xmlns:fx="http://javafx.com/fxml"
 	  xmlns="http://javafx.com/javafx"
 	  fx:controller="org.cryptomator.ui.mainwindow.VaultDetailController"
@@ -22,7 +23,7 @@
 		<HBox spacing="12" visible="${controller.anyVaultSelected}" managed="${controller.anyVaultSelected}">
 			<StackPane alignment="CENTER">
 				<Circle styleClass="glyph-icon-primary" radius="16"/>
-				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="${controller.glyph}" HBox.hgrow="NEVER" glyphSize="16"/>
+				<FontAwesome5StatusView styleClass="status-view-white" glyph="${controller.glyph}" glyphSize="16"/>
 			</StackPane>
 			<VBox spacing="4" HBox.hgrow="ALWAYS">
 				<HBox spacing="12">