]> git.ktnx.net Git - mobile-ledger.git/commitdiff
NT: show currency selection trigger only in a transaction row
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 15 Mar 2020 05:51:04 +0000 (07:51 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 15 Mar 2020 05:51:04 +0000 (07:51 +0200)
not in the header/padding (these would throw on setCurrency(null) call)

app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java

index d7017e21a6816056c18a7fc104eff8639b2ac97a..37506c049dfcda096039d644fdde908c43d8ef24 100644 (file)
@@ -356,13 +356,15 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
         currencyObserver = this::setCurrency;
 
         showCurrencyObserver = showCurrency -> {
-              if (showCurrency) {
-                  tvCurrency.setVisibility(View.VISIBLE);
-              }
-            else {
-                tvCurrency.setVisibility(View.GONE);
-                setCurrencyString(null);
-              }
+            if (item.getType() == ItemType.transactionRow) {
+                if (showCurrency) {
+                    tvCurrency.setVisibility(View.VISIBLE);
+                }
+                else {
+                    tvCurrency.setVisibility(View.GONE);
+                    item.setCurrency(null);
+                }
+            }
         };
     }
     private void updateCurrencyPositionAndPadding(Currency.Position position, boolean hasGap) {