diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index 9d1f78e3..2b4dc2b8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -482,7 +482,7 @@ public class AppServices { stage.setTitle("Sparrow"); stage.setMinWidth(650); - stage.setMinHeight(730); + stage.setMinHeight(708); stage.setScene(scene); stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/image/sparrow-large.png"))); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java b/src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java index efb037ee..d37318cd 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java @@ -18,6 +18,12 @@ public class ComboBoxTextField extends CustomTextField { super(); getStyleClass().add("combo-text-field"); setupCopyButtonField(super.rightProperty()); + + disabledProperty().addListener((observable, oldValue, newValue) -> { + if(comboProperty.isNotNull().get()) { + comboProperty.get().setVisible(!newValue); + } + }); } private void setupCopyButtonField(ObjectProperty rightProperty) { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 4ac2ffcc..382983ae 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -33,8 +33,11 @@ import java.util.stream.Collectors; public class TransactionDiagram extends GridPane { private static final int MAX_UTXOS = 7; + private static final int REDUCED_MAX_UTXOS = MAX_UTXOS - 1; private static final int MAX_PAYMENTS = 5; - private static final double DIAGRAM_HEIGHT = 215.0; + private static final int REDUCED_MAX_PAYMENTS = MAX_PAYMENTS - 1; + private static final double DIAGRAM_HEIGHT = 210.0; + private static final double REDUCED_DIAGRAM_HEIGHT = DIAGRAM_HEIGHT - 60; private static final int TOOLTIP_SHOW_DELAY = 50; private WalletTransaction walletTx; @@ -111,11 +114,12 @@ public class TransactionDiagram extends GridPane { selectedUtxos.put(new PayjoinBlockTransactionHashIndex(), null); } - if(selectedUtxos.size() > MAX_UTXOS) { + int maxUtxos = getMaxUtxos(); + if(selectedUtxos.size() > maxUtxos) { Map utxos = new LinkedHashMap<>(); List additional = new ArrayList<>(); for(BlockTransactionHashIndex reference : selectedUtxos.keySet()) { - if(utxos.size() < MAX_UTXOS - 1) { + if(utxos.size() < maxUtxos - 1) { utxos.put(reference, selectedUtxos.get(reference)); } else { additional.add(reference); @@ -325,11 +329,12 @@ public class TransactionDiagram extends GridPane { private List getDisplayedPayments() { List payments = walletTx.getPayments(); - if(payments.size() > MAX_PAYMENTS) { + int maxPayments = getMaxPayments(); + if(payments.size() > maxPayments) { List displayedPayments = new ArrayList<>(); List additional = new ArrayList<>(); for(Payment payment : payments) { - if(displayedPayments.size() < MAX_PAYMENTS - 1) { + if(displayedPayments.size() < maxPayments - 1) { displayedPayments.add(payment); } else { additional.add(payment); @@ -492,13 +497,33 @@ public class TransactionDiagram extends GridPane { } public double getDiagramHeight() { - if(AppServices.isReducedWindowHeight(this)) { - return DIAGRAM_HEIGHT - 40; + if(isReducedHeight()) { + return REDUCED_DIAGRAM_HEIGHT; } return DIAGRAM_HEIGHT; } + private int getMaxUtxos() { + if(isReducedHeight()) { + return REDUCED_MAX_UTXOS; + } + + return MAX_UTXOS; + } + + private int getMaxPayments() { + if(isReducedHeight()) { + return REDUCED_MAX_PAYMENTS; + } + + return MAX_PAYMENTS; + } + + private boolean isReducedHeight() { + return !isFinal() && AppServices.isReducedWindowHeight(this); + } + private Node createSpacer() { final Region spacer = new Region(); VBox.setVgrow(spacer, Priority.ALWAYS); diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java index 1b9ec57d..971011e0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java @@ -539,7 +539,6 @@ public class ServerPreferencesController extends PreferencesDetailController { publicProxyHost.setDisable(!editable); publicProxyPort.setDisable(!editable); - recentCoreServers.setVisible(editable); coreHost.setDisable(!editable); corePort.setDisable(!editable); coreAuthToggleGroup.getToggles().forEach(toggle -> ((ToggleButton)toggle).setDisable(!editable)); @@ -551,7 +550,6 @@ public class ServerPreferencesController extends PreferencesDetailController { coreProxyHost.setDisable(!editable); coreProxyPort.setDisable(!editable); - recentElectrumServers.setVisible(editable); electrumHost.setDisable(!editable); electrumPort.setDisable(!editable); electrumUseSsl.setDisable(!editable);