From 8e00c08d6a5f2e8a46b863cd9879806f5f40ed87 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 13 Sep 2018 22:59:35 -0500 Subject: [PATCH] -Add error text in the amount field when there is a invalid selected crypto coin --- .../validationfields/AmountValidationField.java | 13 ++++++++++++- app/src/main/res/values/strings_errors.xml | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java index b033d3a..3b44223 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java @@ -30,7 +30,18 @@ public class AmountValidationField extends ValidationField { try { final float newAmountValue = Float.parseFloat(amountField.getText().toString()); final CryptoCurrency cryptoCurrency = (CryptoCurrency)assetSpinner.getSelectedItem(); - final String mixedValues = newAmountValue+"_"+cryptoCurrency.getId(); + + /* + * Validation for the money + * */ + if(cryptoCurrency==null){ + setMessageForValue("",amountField.getContext().getString(R.string.send_assets_error_invalid_cypto_coin_selected)); + setValidForValue("", false); + return; + } + + final String idCurrency = cryptoCurrency==null?"null ":Long.toString(cryptoCurrency.getId()); + final String mixedValues = newAmountValue + "_" + idCurrency; this.setLastValue(mixedValues); this.startValidating(); final ValidationField field = this; diff --git a/app/src/main/res/values/strings_errors.xml b/app/src/main/res/values/strings_errors.xml index 29a6737..a930372 100644 --- a/app/src/main/res/values/strings_errors.xml +++ b/app/src/main/res/values/strings_errors.xml @@ -11,5 +11,7 @@ No server connection + Invalid crypto coin selected +