private void validateAmount(boolean isTyping) { Value amountParsed = amountCalculatorLink.getPrimaryAmount(); if (isAmountValid(amountParsed)) { sendAmount = amountParsed; amountError.setVisibility(View.GONE); // Show warning that fees apply when entered the full amount inside the pocket if (canCompare(sendAmount, lastBalance) && sendAmount.compareTo(lastBalance) == 0) { amountWarning.setText(R.string.amount_warn_fees_apply); amountWarning.setVisibility(View.VISIBLE); } else { amountWarning.setVisibility(View.GONE); } } else { amountWarning.setVisibility(View.GONE); // ignore printing errors for null and zero amounts if (shouldShowErrors(isTyping, amountParsed)) { sendAmount = null; if (amountParsed == null) { amountError.setText(R.string.amount_error); } else if (amountParsed.isNegative()) { amountError.setText(R.string.amount_error_negative); } else if (!isAmountWithinLimits(amountParsed)) { String message = getString(R.string.error_generic); // If the amount is dust or lower than the deposit limit if (isAmountTooSmall(amountParsed)) { Value minAmount = getLowestAmount(amountParsed.type); message = getString(R.string.amount_error_too_small, minAmount.toFriendlyString()); } else { // If we have the amount if (canCompare(lastBalance, amountParsed) && amountParsed.compareTo(lastBalance) > 0) { message = getString(R.string.amount_error_not_enough_money, lastBalance.toFriendlyString()); } if (marketInfo != null && canCompare(marketInfo.limit, amountParsed) && amountParsed.compareTo(marketInfo.limit) > 0) { message = getString(R.string.trade_error_max_limit, marketInfo.limit.toFriendlyString()); } } amountError.setText(message); } else { // Should not happen, but show a generic error amountError.setText(R.string.amount_error); } amountError.setVisibility(View.VISIBLE); } else { amountError.setVisibility(View.GONE); } } updateView(); }