allow for minimum application height of 708px

This commit is contained in:
Craig Raw 2021-11-05 12:59:06 +02:00
parent 8f92f9ec38
commit 5e7d1d1f69
4 changed files with 39 additions and 10 deletions

View file

@ -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")));

View file

@ -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<Node> rightProperty) {

View file

@ -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<BlockTransactionHashIndex, WalletNode> utxos = new LinkedHashMap<>();
List<BlockTransactionHashIndex> 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<Payment> getDisplayedPayments() {
List<Payment> payments = walletTx.getPayments();
if(payments.size() > MAX_PAYMENTS) {
int maxPayments = getMaxPayments();
if(payments.size() > maxPayments) {
List<Payment> displayedPayments = new ArrayList<>();
List<Payment> 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);

View file

@ -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);