Browse Source

move subtabs to the left with clearer color hierarchy, always show once a multiple account wallet has been opened

terminal
Craig Raw 3 years ago
parent
commit
230a4c5585
  1. 2
      drongo
  2. 52
      src/main/java/com/sparrowwallet/sparrow/AppController.java
  3. 11
      src/main/resources/com/sparrowwallet/sparrow/app.css
  4. 4
      src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css
  5. 12
      src/main/resources/com/sparrowwallet/sparrow/whirlpool/whirlpool.fxml

2
drongo

@ -1 +1 @@
Subproject commit 88bd6ada98d98451c580ee4209ec86ec95fa2c94
Subproject commit 74e32bab3d4f229e1b0207c7980c99e04c5115fa

52
src/main/java/com/sparrowwallet/sparrow/AppController.java

@ -196,6 +196,8 @@ public class AppController implements Initializable {
private Tab previouslySelectedTab;
private boolean subTabsVisible;
private final Set<Wallet> loadingWallets = new LinkedHashSet<>();
private final Set<Wallet> emptyLoadingWallets = new LinkedHashSet<>();
@ -1458,8 +1460,8 @@ public class AppController implements Initializable {
});
TabPane subTabs = new TabPane();
subTabs.setSide(Side.RIGHT);
setSubTabsVisible(subTabs, false);
subTabs.setSide(Side.LEFT);
setSubTabsVisible(subTabs, areSubTabsVisible());
subTabs.rotateGraphicProperty().set(true);
tab.setContent(subTabs);
@ -1468,7 +1470,7 @@ public class AppController implements Initializable {
tab.setUserData(tabData);
tab.setContextMenu(getTabContextMenu(tab));
walletForm.lockedProperty().addListener((observable, oldValue, newValue) -> {
setSubTabsVisible(subTabs, !newValue && subTabs.getTabs().size() > 1);
setSubTabsVisible(subTabs, !newValue && areSubTabsVisible());
});
subTabs.getSelectionModel().selectedItemProperty().addListener((observable, old_val, selectedTab) -> {
@ -1527,6 +1529,30 @@ public class AppController implements Initializable {
}
}
private void setSubTabsVisible(boolean visible) {
for(Tab tab : tabs.getTabs()) {
TabData tabData = (TabData) tab.getUserData();
if(tabData instanceof WalletTabData) {
setSubTabsVisible((TabPane)tab.getContent(), visible);
}
}
}
private boolean areSubTabsVisible() {
if(subTabsVisible) {
return true;
}
for(Wallet wallet : AppServices.get().getOpenWallets().keySet()) {
if(wallet.getChildWallets().stream().anyMatch(childWallet -> !childWallet.isNested())) {
subTabsVisible = true;
return true;
}
}
return false;
}
public WalletForm addWalletSubTab(TabPane subTabs, Storage storage, Wallet wallet) {
try {
Tab subTab = new Tab();
@ -2018,6 +2044,18 @@ public class AppController implements Initializable {
findMixingPartner.setDisable(exportWallet.isDisable() || !SorobanServices.canWalletMix(event.getWallet()) || !AppServices.onlineProperty().get());
}
}
for(Tab walletTab : tabs.getTabs()) {
TabData tabData = (TabData) walletTab.getUserData();
if(tabData instanceof WalletTabData walletTabData) {
if(walletTabData.getWalletForm().getWalletId().equals(event.getWalletId()) && event.getWallet().isMasterWallet()) {
TabPane subTabs = (TabPane)walletTab.getContent();
Tab masterTab = subTabs.getTabs().stream().filter(tab -> ((WalletTabData)tab.getUserData()).getWallet().isMasterWallet()).findFirst().orElse(subTabs.getTabs().get(0));
Label masterLabel = (Label)masterTab.getGraphic();
masterLabel.setText(event.getWallet().getLabel() != null ? event.getWallet().getLabel() : event.getWallet().getAutomaticName());
}
}
}
}
@Subscribe
@ -2252,6 +2290,14 @@ public class AppController implements Initializable {
serverToggleStopAnimation();
}
@Subscribe
public void walletOpened(WalletOpenedEvent walletOpenedEvent) {
if(!subTabsVisible && walletOpenedEvent.getWallet().getChildWallets().stream().anyMatch(childWallet -> !childWallet.isNested())) {
subTabsVisible = true;
setSubTabsVisible(true);
}
}
@Subscribe
public void walletTabsClosed(WalletTabsClosedEvent event) {
event.getClosedWalletTabData().stream().map(WalletTabData::getWallet).forEach(loadingWallets::remove);

11
src/main/resources/com/sparrowwallet/sparrow/app.css

@ -34,12 +34,19 @@
.master-only > .tab-header-area {
visibility: hidden;
-fx-pref-height: 0;
}
.wallet-subtabs > .tab-header-area .tab {
-fx-pref-height: 50;
-fx-pref-width: 90;
-fx-alignment: CENTER;
-fx-background-color: derive(#3da0e3, 32%);
-fx-background-insets: 0 1 0 1,0,0;
}
.wallet-subtabs > .tab-header-area .tab:selected {
-fx-background-color: #3da0e3;
}
.wallet-subtabs > .tab-header-area .tab-label {
@ -49,6 +56,10 @@
-fx-translate-x: -6;
}
.wallet-subtabs > .tab-header-area .tab-label .label {
-fx-text-fill: #fff;
}
.status-bar .status-label {
-fx-alignment: center-left;
}

4
src/main/resources/com/sparrowwallet/sparrow/wallet/wallet.css

@ -13,11 +13,11 @@
}
.list-item:hover {
-fx-background-color: #4aa7e5;
-fx-background-color: linear-gradient(to right, #3da0e3, derive(#4aa7e5, 10%));
}
.list-item:selected {
-fx-background-color: #1e88cf;
-fx-background-color: linear-gradient(to right, #3da0e3, derive(#1e88cf, -10%));
}
.list-item:disabled {

12
src/main/resources/com/sparrowwallet/sparrow/whirlpool/whirlpool.fxml

@ -41,12 +41,7 @@
</graphic>
</Label>
<HBox>
<VBox spacing="15">
<Label text="Initiating your first CoinJoin in Sparrow will add three new wallets to your existing wallet: Premix, Postmix and Badbank." wrapText="true" styleClass="content-text" />
<Label text="Premix contains UTXOs that have been split from your deposit UTXOs into equal amounts, waiting for their first mixing round. Postmix contains UTXOs that have been through at least one mixing round. Badbank contains any change from your premix transaction, and should be treated carefully." wrapText="true" styleClass="content-text" />
<Label text="Click on the tabs at the right of the wallet to use these wallets. Note that they will have reduced functionality (for example they will not display receiving addresses)." wrapText="true" styleClass="content-text" />
</VBox>
<TabPane side="RIGHT" rotateGraphic="true" styleClass="wallet-subtabs" minWidth="100" minHeight="280">
<TabPane side="LEFT" rotateGraphic="true" styleClass="wallet-subtabs" minWidth="100" minHeight="280">
<Tab text="" closable="false">
<graphic>
<Label text="Premix" contentDisplay="TOP">
@ -78,6 +73,11 @@
<HBox/>
</Tab>
</TabPane>
<VBox spacing="15">
<Label text="Initiating your first CoinJoin in Sparrow will add three new wallets to your existing wallet: Premix, Postmix and Badbank." wrapText="true" styleClass="content-text" />
<Label text="Premix contains UTXOs that have been split from your deposit UTXOs into equal amounts, waiting for their first mixing round. Postmix contains UTXOs that have been through at least one mixing round. Badbank contains any change from your premix transaction, and should be treated carefully." wrapText="true" styleClass="content-text" />
<Label text="Click on the tabs at the right of the wallet to use these wallets. Note that they will have reduced functionality (for example they will not display receiving addresses)." wrapText="true" styleClass="content-text" />
</VBox>
</HBox>
</VBox>
<VBox fx:id="step3" spacing="15">

Loading…
Cancel
Save