]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java
NT hint boserver: use setHint(resource) when no hint is given
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionItemHolder.java
index c455a01434cdc186d281dfc6df29d4acf2cc07be..1d323a5b705476d30d0e5392b04c5eb970dc2991 100644 (file)
@@ -196,9 +196,9 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
             syncingData = true;
             try {
                 if (hint == null)
-                    hint = tvAmount.getResources()
-                                   .getString(R.string.zero_amount);
-                tvAmount.setHint(hint);
+                    tvAmount.setHint(R.string.zero_amount);
+                else
+                    tvAmount.setHint(hint);
             }
             finally {
                 syncingData = false;
@@ -300,7 +300,11 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
                     String amount = String.valueOf(tvAmount.getText());
                     amount = amount.trim();
 
-                    if (!amount.isEmpty()) {
+                    if (amount.isEmpty()) {
+                        item.getAccount()
+                            .resetAmount();
+                    }
+                    else {
                         try {
                             amount = amount.replace(decimalSeparator, decimalDot);
                             item.getAccount()
@@ -309,15 +313,11 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
                         catch (NumberFormatException e) {
                             Logger.debug("new-trans", String.format(
                                     "assuming amount is not set due to number format exception. " +
-                                    "input was '%s'",
-                                    amount));
+                                    "input was '%s'", amount));
                             item.getAccount()
                                 .resetAmount();
                         }
                     }
-                    else
-                        item.getAccount()
-                            .resetAmount();
 
                     break;
                 case bottomFiller: