From e626104c06c7e286ce678690446fb6f204b11373 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 29 Jun 2021 17:59:15 +0200 Subject: [PATCH] Add progress indicator skin to light theme & correct attribution of origin --- ...eSpinner.java => FontAwesome5Spinner.java} | 26 +++++++- src/main/resources/css/dark_theme.css | 3 +- src/main/resources/css/light_theme.css | 61 ++++++++----------- .../resources/fxml/vault_detail_locked.fxml | 2 - 4 files changed, 50 insertions(+), 42 deletions(-) rename src/main/java/org/cryptomator/ui/controls/{FontAwesomeSpinner.java => FontAwesome5Spinner.java} (66%) diff --git a/src/main/java/org/cryptomator/ui/controls/FontAwesomeSpinner.java b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Spinner.java similarity index 66% rename from src/main/java/org/cryptomator/ui/controls/FontAwesomeSpinner.java rename to src/main/java/org/cryptomator/ui/controls/FontAwesome5Spinner.java index 1bbfea7b5..6313bec16 100644 --- a/src/main/java/org/cryptomator/ui/controls/FontAwesomeSpinner.java +++ b/src/main/java/org/cryptomator/ui/controls/FontAwesome5Spinner.java @@ -3,6 +3,8 @@ package org.cryptomator.ui.controls; import com.tobiasdiez.easybind.EasyBind; import javafx.animation.AnimationTimer; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; import javafx.scene.control.ProgressIndicator; import java.time.Duration; @@ -11,13 +13,22 @@ import java.time.Duration; *

* See also https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#progressindicator */ -public class FontAwesomeSpinner extends ProgressIndicator { +public class FontAwesome5Spinner extends ProgressIndicator { + + private static final double DEFAULT_GLYPH_SIZE = 12.0; private final Animator animation; + private DoubleProperty glyphSize = new SimpleDoubleProperty(this, "glyphSize", DEFAULT_GLYPH_SIZE); - public FontAwesomeSpinner() { + public FontAwesome5Spinner() { this.animation = new Animator(this); EasyBind.subscribe(this.visibleProperty(), this::startStopAnimation); + EasyBind.subscribe(glyphSize, this::shrinkToGlyphSize); + } + + private void shrinkToGlyphSize(Number newValue) { + double sizeInPx = newValue.doubleValue() * 1.333; + setMaxSize(sizeInPx,sizeInPx); } private void startStopAnimation(boolean flag) { @@ -27,6 +38,17 @@ public class FontAwesomeSpinner extends ProgressIndicator { animation.stop(); } } + public DoubleProperty glyphSizeProperty() { + return glyphSize; + } + + public double getGlyphSize() { + return glyphSize.get(); + } + + public void setGlyphSize(double glyphSize) { + this.glyphSize.set(glyphSize); + } private static class Animator extends AnimationTimer { diff --git a/src/main/resources/css/dark_theme.css b/src/main/resources/css/dark_theme.css index 37903948f..323aeb82c 100644 --- a/src/main/resources/css/dark_theme.css +++ b/src/main/resources/css/dark_theme.css @@ -792,6 +792,8 @@ * * * ProgressIndicator * * Derived from aquafx-project.com, (C) Claudine Zillmann, see NOTICE.md * + * and FontAwesome 5 spinner icon (solid), (C) Fonticons, Inc, see * + * https://fontawesome.com/license#license * * * ******************************************************************************/ @@ -842,7 +844,6 @@ -fx-shape: "M 108.92188 60.921875 C 82.411875 60.921875 60.921875 82.411875 60.921875 108.92188 C 60.921875 135.43188 82.411875 156.92188 108.92188 156.92188 C 135.43188 156.92188 156.92188 135.43187 156.92188 108.92188 C 156.92188 82.411875 135.43088 60.921875 108.92188 60.921875 z"; } - /******************************************************************************* * * * ProgressBar * diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index b0ba8ac8c..f798dac1e 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -790,12 +790,14 @@ * * * ProgressIndicator * * Derived from aquafx-project.com, (C) Claudine Zillmann, see NOTICE.md * + * and FontAwesome 5 spinner icon (solid), (C) Fonticons, Inc, see * + * https://fontawesome.com/license#license * * * ******************************************************************************/ .progress-indicator { - -fx-indeterminate-segment-count: 12; - -fx-spin-enabled: true; + -fx-indeterminate-segment-count: 8; + -fx-spin-enabled: false; } .progress-indicator:indeterminate > .spinner { @@ -803,56 +805,41 @@ } .progress-indicator:indeterminate .segment { - -fx-background-color: PROGRESS_INDICATOR_BEGIN, PROGRESS_INDICATOR_END; + -fx-background-color: TEXT_FILL; -fx-background-insets: 0, 0.5; } .progress-indicator:indeterminate .segment0 { - -fx-shape: "m 12.007729,4.9541827 c -0.49762,0.7596865 0.893181,1.6216808 1.327833,0.7666252 L 15.456199,2.0477574 C 15.942094,1.2061627 14.61426,0.43953765 14.128365,1.2811324 z"; -} - -.progress-indicator:indeterminate .segment1 { - -fx-shape: "m 9.2224559,4.62535 c -0.051108,0.9067177 1.5843581,0.957826 1.5332501,0 l 0,-4.24127319 c 0,-0.9717899 -1.5332501,-0.9717899 -1.5332501,0 z"; -} - -.progress-indicator:indeterminate .segment2 { - -fx-shape: "M 8.0465401,4.9030617 C 8.5441601,5.6627485 7.1533584,6.5247425 6.7187068,5.6696872 L 4.5980702,1.9966363 C 4.1121752,1.1550418 5.4400085,0.38841683 5.9259035,1.2300114 z"; -} - -.progress-indicator:indeterminate .segment3 { - -fx-shape: "M 5.7330066,6.5305598 C 6.5579512,6.9103162 5.8366865,8.3790371 5.0144939,7.8850315 L 1.2677551,5.8974832 C 0.409277,5.4420823 1.1277888,4.0876101 1.9862674,4.5430105 z"; -} - -.progress-indicator:indeterminate .segment4 { - -fx-shape: "m 0.42171041,9.2083842 c -0.90671825,-0.051108 -0.95782608,1.5843588 0,1.5332498 l 4.24127319,0 c 0.9717899,0 0.9717899,-1.5332498 0,-1.5332498 z"; -} - -.progress-indicator:indeterminate .segment5 { - -fx-shape: "M 5.7330066,13.443113 C 6.5579512,13.063356 5.8366865,11.594635 5.0144939,12.088641 L 1.2677551,14.076189 C 0.409277,14.53159 1.1277888,15.886062 1.9862674,15.430662 z"; -} - -.progress-indicator:indeterminate .segment6 { - -fx-shape: "M 8.0465401,15.070611 C 8.5441601,14.310924 7.1533584,13.44893 6.7187068,14.303985 l -2.1206366,3.673051 c -0.485895,0.841595 0.8419383,1.60822 1.3278333,0.766625 z"; + -fx-shape: "M 256 0 C 229.49 0 208 21.49 208 48 C 208 74.51 229.49 96 256 96 C 282.51 96 304 74.51 304 48 C 304 21.49 282.51 0 256 0 z"; } .progress-indicator:indeterminate .segment7 { - -fx-shape: "m 9.2224559,19.539943 c -0.051108,0.906718 1.5843581,0.957826 1.5332501,0 l 0,-4.241273 c 0,-0.97179 -1.5332501,-0.97179 -1.5332501,0 z"; + -fx-shape: "M 403.07812 60.921875 L 355.07812 108.92188 L 403.07812 156.92188 L 451.07812 108.92188 L 403.07812 60.921875 z"; + -fx-background-color: transparent; } -.progress-indicator:indeterminate .segment8 { - -fx-shape: "m 12.10997,15.070611 c -0.49762,-0.759687 0.893182,-1.621681 1.327834,-0.766626 l 2.120636,3.673051 c 0.485895,0.841595 -0.841938,1.60822 -1.327833,0.766625 z"; +.progress-indicator:indeterminate .segment6 { + -fx-shape:"M 464 208 C 437.49 208 416 229.49 416 256 C 416 282.51 437.49 304 464 304 C 490.51 304 512 282.51 512 256 C 512 229.49 490.51 208 464 208 z"; } -.progress-indicator:indeterminate .segment9 { - -fx-shape: "m 14.423504,13.443113 c -0.824945,-0.379757 -0.10368,-1.848478 0.718512,-1.354472 l 3.746739,1.987548 c 0.858478,0.455401 0.139967,1.809873 -0.718512,1.354473 z"; +.progress-indicator:indeterminate .segment5 { + -fx-shape:"M 403.07812 355.07812 C 376.56813 355.07812 355.07812 376.56813 355.07812 403.07812 C 355.07812 429.58812 376.56813 451.07812 403.07812 451.07812 C 429.58812 451.07812 451.07812 429.58812 451.07812 403.07812 C 451.07812 376.56912 429.58812 355.07812 403.07812 355.07812 z"; } -.progress-indicator:indeterminate .segment10 { - -fx-shape: "m 15.372451,9.2445322 c -0.906719,-0.051108 -0.957826,1.5843588 0,1.5332498 l 4.241273,0 c 0.97179,0 0.97179,-1.5332498 0,-1.5332498 z"; +.progress-indicator:indeterminate .segment4 { + -fx-shape:"M 256 416 C 229.49 416 208 437.49 208 464 C 208 490.51 229.49 512 256 512 C 282.51 512 304 490.51 304 464 C 304 437.49 282.51 416 256 416 z"; } -.progress-indicator:indeterminate .segment11 { - -fx-shape: "m 14.321262,6.5816808 c -0.824944,0.3797564 -0.10368,1.8484772 0.718513,1.3544717 L 18.786514,5.9486042 C 19.644992,5.4932031 18.92648,4.1387308 18.068001,4.5941315 z"; +.progress-indicator:indeterminate .segment3 { + -fx-shape:"M 108.92188 355.07812 C 82.411875 355.07812 60.921875 376.56813 60.921875 403.07812 C 60.921875 429.58812 82.411875 451.07812 108.92188 451.07812 C 135.43188 451.07812 156.92188 429.58812 156.92188 403.07812 C 156.92188 376.56912 135.43088 355.07812 108.92188 355.07812 z"; +} + +.progress-indicator:indeterminate .segment2 { + -fx-shape: "M 48 208 C 21.49 208 0 229.49 0 256 C 0 282.51 21.49 304 48 304 C 74.51 304 96 282.51 96 256 C 96 229.49 74.51 208 48 208 z"; +} + +.progress-indicator:indeterminate .segment1 { + -fx-shape: "M 108.92188 60.921875 C 82.411875 60.921875 60.921875 82.411875 60.921875 108.92188 C 60.921875 135.43188 82.411875 156.92188 108.92188 156.92188 C 135.43188 156.92188 156.92188 135.43187 156.92188 108.92188 C 156.92188 82.411875 135.43088 60.921875 108.92188 60.921875 z"; } /******************************************************************************* diff --git a/src/main/resources/fxml/vault_detail_locked.fxml b/src/main/resources/fxml/vault_detail_locked.fxml index 1d2e4f719..d4bbc7e4a 100644 --- a/src/main/resources/fxml/vault_detail_locked.fxml +++ b/src/main/resources/fxml/vault_detail_locked.fxml @@ -6,7 +6,6 @@ - -