mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 20:56:45 +00:00
various minor ui improvements
This commit is contained in:
parent
2c98c8606c
commit
d52bade085
4 changed files with 27 additions and 5 deletions
|
@ -110,7 +110,7 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||||
}
|
}
|
||||||
|
|
||||||
revalidate(amount, amountListener);
|
revalidate(amount, amountListener);
|
||||||
maxButton.setDisable(!isValidRecipientAddress());
|
maxButton.setDisable(!isValidAddressAndLabel());
|
||||||
sendController.updateTransaction();
|
sendController.updateTransaction();
|
||||||
|
|
||||||
if(validationSupport != null) {
|
if(validationSupport != null) {
|
||||||
|
@ -119,6 +119,7 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||||
});
|
});
|
||||||
|
|
||||||
label.textProperty().addListener((observable, oldValue, newValue) -> {
|
label.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
maxButton.setDisable(!isValidAddressAndLabel());
|
||||||
sendController.getCreateButton().setDisable(sendController.getWalletTransaction() == null || newValue == null || newValue.isEmpty() || sendController.isInsufficientFeeRate());
|
sendController.getCreateButton().setDisable(sendController.getWalletTransaction() == null || newValue == null || newValue.isEmpty() || sendController.isInsufficientFeeRate());
|
||||||
sendController.updateTransaction();
|
sendController.updateTransaction();
|
||||||
});
|
});
|
||||||
|
@ -136,7 +137,7 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
maxButton.setDisable(!isValidRecipientAddress());
|
maxButton.setDisable(!isValidAddressAndLabel());
|
||||||
sendController.utxoLabelSelectionProperty().addListener((observable, oldValue, newValue) -> {
|
sendController.utxoLabelSelectionProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
maxButton.setText("Max" + newValue);
|
maxButton.setText("Max" + newValue);
|
||||||
});
|
});
|
||||||
|
@ -175,6 +176,10 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isValidAddressAndLabel() {
|
||||||
|
return isValidRecipientAddress() && !label.getText().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
private Address getRecipientAddress() throws InvalidAddressException {
|
private Address getRecipientAddress() throws InvalidAddressException {
|
||||||
return Address.fromString(address.getText());
|
return Address.fromString(address.getText());
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,14 +125,19 @@ public class ReceiveController extends WalletFormController implements Initializ
|
||||||
if(AppServices.isConnected() && currentOutputs.isEmpty()) {
|
if(AppServices.isConnected() && currentOutputs.isEmpty()) {
|
||||||
lastUsed.setText("Never");
|
lastUsed.setText("Never");
|
||||||
lastUsed.setGraphic(getUnusedGlyph());
|
lastUsed.setGraphic(getUnusedGlyph());
|
||||||
|
address.getStyleClass().remove("error");
|
||||||
} else if(!currentOutputs.isEmpty()) {
|
} else if(!currentOutputs.isEmpty()) {
|
||||||
long count = currentOutputs.size();
|
long count = currentOutputs.size();
|
||||||
BlockTransactionHashIndex lastUsedReference = currentOutputs.stream().skip(count - 1).findFirst().get();
|
BlockTransactionHashIndex lastUsedReference = currentOutputs.stream().skip(count - 1).findFirst().get();
|
||||||
lastUsed.setText(lastUsedReference.getHeight() <= 0 ? "Unconfirmed Transaction" : DATE_FORMAT.format(lastUsedReference.getDate()));
|
lastUsed.setText(lastUsedReference.getHeight() <= 0 ? "Unconfirmed Transaction" : DATE_FORMAT.format(lastUsedReference.getDate()));
|
||||||
lastUsed.setGraphic(getWarningGlyph());
|
lastUsed.setGraphic(getWarningGlyph());
|
||||||
|
if(!address.getStyleClass().contains("error")) {
|
||||||
|
address.getStyleClass().add("error");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
lastUsed.setText("Unknown");
|
lastUsed.setText("Unknown");
|
||||||
lastUsed.setGraphic(null);
|
lastUsed.setGraphic(null);
|
||||||
|
address.getStyleClass().remove("error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
-fx-pref-height: 25px;
|
-fx-pref-height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form .fieldset:horizontal .input-container {
|
||||||
|
-fx-alignment: center-left;
|
||||||
|
}
|
||||||
|
|
||||||
.form .input-container {
|
.form .input-container {
|
||||||
-fx-spacing: 2;
|
-fx-spacing: 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,18 @@
|
||||||
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
<Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
|
||||||
<Fieldset inputGrow="ALWAYS">
|
<Fieldset inputGrow="ALWAYS">
|
||||||
<Field text="Pay to:">
|
<Field text="Pay to:">
|
||||||
<CopyableTextField fx:id="address" styleClass="address-text-field"/>
|
<CopyableTextField fx:id="address" styleClass="address-text-field">
|
||||||
|
<tooltip>
|
||||||
|
<Tooltip text="Address or bitcoin: URI"/>
|
||||||
|
</tooltip>
|
||||||
|
</CopyableTextField>
|
||||||
</Field>
|
</Field>
|
||||||
<Field text="Label:">
|
<Field text="Label:">
|
||||||
<TextField fx:id="label" />
|
<TextField fx:id="label">
|
||||||
|
<tooltip>
|
||||||
|
<Tooltip text="Required to label the transaction (privately in this wallet)"/>
|
||||||
|
</tooltip>
|
||||||
|
</TextField>
|
||||||
</Field>
|
</Field>
|
||||||
<Field text="Amount:">
|
<Field text="Amount:">
|
||||||
<TextField fx:id="amount" styleClass="amount-field" />
|
<TextField fx:id="amount" styleClass="amount-field" />
|
||||||
|
@ -54,7 +62,7 @@
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Form>
|
</Form>
|
||||||
<Form GridPane.columnIndex="2" GridPane.rowIndex="0">
|
<Form GridPane.columnIndex="2" GridPane.rowIndex="0">
|
||||||
<Fieldset inputGrow="ALWAYS" style="-fx-padding: 2 0 0 0">
|
<Fieldset inputGrow="ALWAYS" style="-fx-padding: 5 0 0 0">
|
||||||
<HBox>
|
<HBox>
|
||||||
<Button text="" onAction="#scanQrAddress" prefHeight="30">
|
<Button text="" onAction="#scanQrAddress" prefHeight="30">
|
||||||
<graphic>
|
<graphic>
|
||||||
|
|
Loading…
Reference in a new issue