Improve UI

This commit is contained in:
Manfred Karrer 2017-11-27 11:31:37 -05:00
parent 8572ea76d1
commit 0de1c6a6c2
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
7 changed files with 26 additions and 14 deletions

View file

@ -10,7 +10,7 @@ public class DevEnv {
// peer (click user icon and alt+r), filter/block offers by various data like offer ID (cmd + f).
// The user can set a program argument to ignore all of those privileged network_messages. They are intended for
// emergency cases only (beside update message and arbitrator registration).
public static final boolean USE_DEV_PRIVILEGE_KEYS = false;
public static final boolean USE_DEV_PRIVILEGE_KEYS = true;
public static final String DEV_PRIVILEGE_PUB_KEY = "027a381b5333a56e1cc3d90d3a7d07f26509adf7029ed06fc997c656621f8da1ee";
public static final String DEV_PRIVILEGE_PRIV_KEY = "6ac43ea1df2a290c1c8391736aa42e4339c5cb4f110ff0257a13b63211977b7a";
@ -18,7 +18,7 @@ public class DevEnv {
// If set to true we ignore several UI behavior like confirmation popups as well dummy accounts are created and
// offers are filled with default values. Intended to make dev testing faster.
@SuppressWarnings("PointlessBooleanExpression")
public static final boolean DEV_MODE = STRESS_TEST_MODE || false;
public static final boolean DEV_MODE = STRESS_TEST_MODE || true;
public static final boolean DAO_PHASE2_ACTIVATED = false;
public static final boolean DAO_PHASE2_ACTIVATED = true;
}

View file

@ -18,6 +18,7 @@
package io.bisq.common.locale;
import io.bisq.common.GlobalSettings;
import io.bisq.common.app.DevEnv;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
@ -86,7 +87,8 @@ public class CurrencyUtil {
public static List<CryptoCurrency> createAllSortedCryptoCurrenciesList() {
final List<CryptoCurrency> result = new ArrayList<>();
// result.add(new CryptoCurrency("BSQ", "Bisq Token"));
if (DevEnv.DAO_PHASE2_ACTIVATED)
result.add(new CryptoCurrency("BSQ", "Bisq Token"));
if (!baseCurrencyCode.equals("BTC"))
result.add(new CryptoCurrency("BTC", "Bitcoin"));
@ -162,7 +164,8 @@ public class CurrencyUtil {
public static List<CryptoCurrency> getMainCryptoCurrencies() {
final List<CryptoCurrency> result = new ArrayList<>();
// result.add(new CryptoCurrency("BSQ", "Bisq Token"));
if (DevEnv.DAO_PHASE2_ACTIVATED)
result.add(new CryptoCurrency("BSQ", "Bisq Token"));
if (!baseCurrencyCode.equals("BTC"))
result.add(new CryptoCurrency("BTC", "Bitcoin"));
if (!baseCurrencyCode.equals("DASH"))

View file

@ -1298,11 +1298,11 @@ popup.warning.tooLargePercentageValue=You cannot set a percentage of 100% or lar
popup.warning.examplePercentageValue=Please enter a percentage number like \"5.4\" for 5.4%
popup.warning.noPriceFeedAvailable=There is no price feed available for that currency. You cannot use a percent based price.\nPlease select the fixed price.
popup.warning.sendMsgFailed=Sending message to your trading partner failed.\nPlease try again and if it continue to fail report a bug.
popup.warning.insufficientBtcFundsForBsqTx=You don''t have sufficient BTC funds for paying the tx fee for that BSQ transaction.\n\
popup.warning.insufficientBtcFundsForBsqTx=You don''t have sufficient BTC funds for paying the miner fee for that BSQ transaction.\n\
Please fund your BTC wallet to be able to transfer BSQ.\nMissing funds: {0}
popup.warning.insufficientBsqFundsForBtcFeePayment=You don''t have sufficient BSQ funds for paying the tx fee in BSQ.\n\
popup.warning.insufficientBsqFundsForBtcFeePayment=You don''t have sufficient BSQ funds for paying the mining fee in BSQ.\n\
You can pay the fee in BTC or you need to fund your BSQ wallet.\nMissing BSQ funds: {0}
popup.warning.noBsqFundsForBtcFeePayment=Your BSQ wallet does not have sufficient funds for paying the tx fee in BSQ.
popup.warning.noBsqFundsForBtcFeePayment=Your BSQ wallet does not have sufficient funds for paying the mining fee in BSQ.
popup.warning.messageTooLong=Your message exceeds the max. allowed size. Please send it in several parts or upload it to a service like https://pastebin.com.
popup.warning.lockedUpFunds=You have locked up funds from a failed trade.\n\
Locked up balance: {0} \n\
@ -1726,7 +1726,7 @@ validation.bankIdNumber={0} must consist of {1} numbers.
validation.accountNr=Account number must consist of {0} numbers.
validation.accountNrChars=Account number must consist of {0} characters.
validation.btc.invalidAddress=The address is not correct. Please check the address format.
validation.btc.amountBelowDust=The amount you would like to send is below the dust limit\nand would be rejected by the bitcoin network.\nPlease use a higher amount.
validation.btc.amountBelowDust=The amount you would like to send is below the dust limit of {0} \nand would be rejected by the bitcoin network.\nPlease use a higher amount.
validation.integerOnly=Please enter integer numbers only.
validation.inputError=Your input caused an error:\n{0}
validation.bsq.insufficientBalance=Amount exceeds the available balance of {0}.

View file

@ -20,6 +20,7 @@ package io.bisq.gui.main.dao.wallet.send;
import com.google.common.util.concurrent.FutureCallback;
import io.bisq.common.locale.Res;
import io.bisq.core.btc.Restrictions;
import io.bisq.core.btc.wallet.BsqBalanceListener;
import io.bisq.core.btc.wallet.BsqWalletService;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.util.CoinUtil;
@ -66,6 +67,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
private Button sendButton;
private InputTextField receiversAddressInputTextField;
private ChangeListener<Boolean> focusOutListener;
private BsqBalanceListener balanceListener;
///////////////////////////////////////////////////////////////////////////////////////////
@ -102,7 +104,6 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
amountInputTextField.setPromptText(Res.get("dao.wallet.send.setAmount", Restrictions.getMinNonDustOutput().value));
amountInputTextField.setValidator(bsqValidator);
focusOutListener = (observable, oldValue, newValue) -> {
if (!newValue)
verifyInputs();
@ -137,7 +138,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
@Override
public void onSuccess(@Nullable Transaction transaction) {
if (transaction != null) {
log.error("Successfully sent tx with id " + transaction.getHashAsString());
log.debug("Successfully sent tx with id " + transaction.getHashAsString());
}
}
@ -147,6 +148,9 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
new Popup<>().warning(t.toString());
}
});
receiversAddressInputTextField.setText("");
amountInputTextField.setText("");
})
.closeButtonText(Res.get("shared.cancel"))
.show();
@ -166,6 +170,8 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
}
}
});
balanceListener = (availableBalance, unverifiedBalance) -> verifyInputs();
}
@Override
@ -173,6 +179,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
bsqBalanceUtil.activate();
receiversAddressInputTextField.focusedProperty().addListener(focusOutListener);
amountInputTextField.focusedProperty().addListener(focusOutListener);
bsqWalletService.addBsqBalanceListener(balanceListener);
verifyInputs();
}
@ -181,6 +188,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
bsqBalanceUtil.deactivate();
receiversAddressInputTextField.focusedProperty().removeListener(focusOutListener);
amountInputTextField.focusedProperty().removeListener(focusOutListener);
bsqWalletService.removeBsqBalanceListener(balanceListener);
}
private void verifyInputs() {

View file

@ -25,6 +25,7 @@ import io.bisq.common.locale.Res;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.AddressEntryException;
import io.bisq.core.btc.InsufficientFundsException;
import io.bisq.core.btc.Restrictions;
import io.bisq.core.btc.listeners.BalanceListener;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.Tradable;
@ -360,7 +361,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
} catch (AddressFormatException e) {
new Popup<>().warning(Res.get("validation.btc.invalidAddress")).show();
} catch (Wallet.DustySendRequested e) {
new Popup<>().warning(Res.get("validation.btc.amountBelowDust")).show();
new Popup<>().warning(Res.get("validation.btc.amountBelowDust", formatter.formatCoinWithCode(Restrictions.getMinNonDustOutput()))).show();
} catch (AddressEntryException e) {
new Popup<>().error(e.getMessage()).show();
} catch (InsufficientMoneyException e) {

View file

@ -82,7 +82,7 @@ public class BsqValidator extends AltcoinValidator {
if (Restrictions.isAboveDust(coin))
return new ValidationResult(true);
else
return new ValidationResult(false, Res.get("validation.btc.amountBelowDust"));
return new ValidationResult(false, Res.get("validation.btc.amountBelowDust", bsqFormatter.formatCoinWithCode(Restrictions.getMinNonDustOutput())));
}
protected ValidationResult validateIfNotFractionalBtcValue(String input) {

View file

@ -76,7 +76,7 @@ public class BtcValidator extends NumberValidator {
if (Restrictions.isAboveDust(coin))
return new ValidationResult(true);
else
return new ValidationResult(false, Res.get("validation.btc.amountBelowDust"));
return new ValidationResult(false, Res.get("validation.btc.amountBelowDust", formatter.formatCoinWithCode(Restrictions.getMinNonDustOutput())));
} catch (Throwable t) {
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
}