mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
fade animation on server toggle while connecting
This commit is contained in:
parent
a4ddc11bab
commit
74c83fc5e1
1 changed files with 26 additions and 0 deletions
|
@ -1299,6 +1299,28 @@ public class AppController implements Initializable {
|
||||||
EventManager.get().post(new ThemeChangedEvent(selectedTheme));
|
EventManager.get().post(new ThemeChangedEvent(selectedTheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void serverToggleStartAnimation() {
|
||||||
|
Node thumbArea = serverToggle.lookup(".thumb-area");
|
||||||
|
if(thumbArea != null) {
|
||||||
|
FadeTransition fadeTransition = new FadeTransition(Duration.millis(1000), thumbArea);
|
||||||
|
fadeTransition.setFromValue(1.0);
|
||||||
|
fadeTransition.setToValue(0.4);
|
||||||
|
fadeTransition.setAutoReverse(true);
|
||||||
|
fadeTransition.setCycleCount(Animation.INDEFINITE);
|
||||||
|
fadeTransition.play();
|
||||||
|
serverToggle.setUserData(fadeTransition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void serverToggleStopAnimation() {
|
||||||
|
if(serverToggle.getUserData() != null) {
|
||||||
|
FadeTransition fadeTransition = (FadeTransition)serverToggle.getUserData();
|
||||||
|
fadeTransition.stop();
|
||||||
|
fadeTransition.getNode().setOpacity(1.0);
|
||||||
|
serverToggle.setUserData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void tabLabelStartAnimation(Wallet wallet) {
|
private void tabLabelStartAnimation(Wallet wallet) {
|
||||||
tabs.getTabs().stream().filter(tab -> tab.getUserData() instanceof WalletTabData && ((WalletTabData)tab.getUserData()).getWallet() == wallet).forEach(this::tabLabelStartAnimation);
|
tabs.getTabs().stream().filter(tab -> tab.getUserData() instanceof WalletTabData && ((WalletTabData)tab.getUserData()).getWallet() == wallet).forEach(this::tabLabelStartAnimation);
|
||||||
}
|
}
|
||||||
|
@ -1568,12 +1590,14 @@ public class AppController implements Initializable {
|
||||||
if(!statusBar.getText().contains(TRYING_ANOTHER_SERVER_MESSAGE)) {
|
if(!statusBar.getText().contains(TRYING_ANOTHER_SERVER_MESSAGE)) {
|
||||||
statusUpdated(new StatusEvent(event.getStatus(), 120));
|
statusUpdated(new StatusEvent(event.getStatus(), 120));
|
||||||
}
|
}
|
||||||
|
serverToggleStartAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void connectionFailed(ConnectionFailedEvent event) {
|
public void connectionFailed(ConnectionFailedEvent event) {
|
||||||
String status = CONNECTION_FAILED_PREFIX + event.getMessage();
|
String status = CONNECTION_FAILED_PREFIX + event.getMessage();
|
||||||
statusUpdated(new StatusEvent(status));
|
statusUpdated(new StatusEvent(status));
|
||||||
|
serverToggleStopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -1581,6 +1605,7 @@ public class AppController implements Initializable {
|
||||||
String status = "Connected to " + Config.get().getServerAddress() + " at height " + event.getBlockHeight();
|
String status = "Connected to " + Config.get().getServerAddress() + " at height " + event.getBlockHeight();
|
||||||
statusUpdated(new StatusEvent(status));
|
statusUpdated(new StatusEvent(status));
|
||||||
setServerToggleTooltip(event.getBlockHeight());
|
setServerToggleTooltip(event.getBlockHeight());
|
||||||
|
serverToggleStopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -1595,6 +1620,7 @@ public class AppController implements Initializable {
|
||||||
for(Wallet wallet : getOpenWallets().keySet()) {
|
for(Wallet wallet : getOpenWallets().keySet()) {
|
||||||
tabLabelStopAnimation(wallet);
|
tabLabelStopAnimation(wallet);
|
||||||
}
|
}
|
||||||
|
serverToggleStopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
Loading…
Reference in a new issue