mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-12 14:43:02 -05:00
remove min amount warning -> change amounts it not valid. only update price if perc. price is input source
This commit is contained in:
parent
c43575073d
commit
7fe4d37501
1 changed files with 40 additions and 35 deletions
|
|
@ -116,6 +116,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
private Offer offer;
|
||||
private Timer timeoutTimer;
|
||||
private PriceFeed.Type priceFeedType;
|
||||
private boolean priceAsPercentageIsInput;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -256,6 +257,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
updateButtonDisableState();
|
||||
};
|
||||
priceAsPercentageListener = (ov, oldValue, newValue) -> {
|
||||
if (priceAsPercentageIsInput) {
|
||||
try {
|
||||
if (!newValue.isEmpty() && !newValue.equals("-")) {
|
||||
double percentageBasedPrice = formatter.parsePercentStringToDouble(newValue);
|
||||
|
|
@ -291,6 +293,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
new Popup().warning("Your input is not a valid number. Please enter a percentage number like \"5.4\" for 5.4%")
|
||||
.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
volumeListener = (ov, oldValue, newValue) -> {
|
||||
if (isFiatInputValid(newValue).isValid) {
|
||||
|
|
@ -475,8 +478,9 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
|
||||
// handle minAmount/amount relationship
|
||||
if (!dataModel.isMinAmountLessOrEqualAmount()) {
|
||||
amountValidationResult.set(new InputValidator.ValidationResult(false,
|
||||
BSResources.get("createOffer.validation.amountSmallerThanMinAmount")));
|
||||
minAmount.set(amount.get());
|
||||
/*amountValidationResult.set(new InputValidator.ValidationResult(false,
|
||||
BSResources.get("createOffer.validation.amountSmallerThanMinAmount")));*/
|
||||
} else {
|
||||
amountValidationResult.set(result);
|
||||
if (minAmount.get() != null)
|
||||
|
|
@ -496,8 +500,9 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
minAmount.set(formatter.formatCoin(dataModel.minAmountAsCoin.get()));
|
||||
|
||||
if (!dataModel.isMinAmountLessOrEqualAmount()) {
|
||||
minAmountValidationResult.set(new InputValidator.ValidationResult(false,
|
||||
BSResources.get("createOffer.validation.minAmountLargerThanAmount")));
|
||||
amount.set(minAmount.get());
|
||||
/* minAmountValidationResult.set(new InputValidator.ValidationResult(false,
|
||||
BSResources.get("createOffer.validation.minAmountLargerThanAmount")));*/
|
||||
} else {
|
||||
minAmountValidationResult.set(result);
|
||||
if (amount.get() != null)
|
||||
|
|
@ -523,10 +528,10 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
}
|
||||
|
||||
void onFocusOutPriceAsPercentageTextField(boolean oldValue, boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
priceAsPercentageIsInput = !oldValue && newValue;
|
||||
if (oldValue && !newValue)
|
||||
priceAsPercentage.set(formatter.formatToNumberString(dataModel.getPercentageBasedPrice() * 100, 2));
|
||||
}
|
||||
}
|
||||
|
||||
void onFocusOutVolumeTextField(boolean oldValue, boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue