]> git.ktnx.net Git - mobile-ledger.git/commitdiff
new transaction: bigger currency button area
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 2 Jan 2021 15:38:09 +0000 (17:38 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 2 Jan 2021 15:38:09 +0000 (17:38 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java
app/src/main/res/layout/new_transaction_row.xml

index 13481f1ee9621feca9c6df718536a5c43c2dc8c0..b2dd24dac890eef4b68bf3a0be189caf2b977c7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -90,6 +90,7 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
     private final Observer<Boolean> showCurrencyObserver;
     private final Observer<String> commentObserver;
     private final Observer<Boolean> amountValidityObserver;
+    private final View tvCurrencyButton;
     private String decimalSeparator;
     private NewTransactionModel.Item item;
     private Date date;
@@ -105,6 +106,7 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
         new TextViewClearHelper().attachToTextView((EditText) tvComment);
         tvAmount = itemView.findViewById(R.id.account_row_acc_amounts);
         tvCurrency = itemView.findViewById(R.id.currency);
+        tvCurrencyButton = lAccount.findViewById(R.id.currencyButton);
         tvDate = itemView.findViewById(R.id.new_transaction_date);
         tvDescription = itemView.findViewById(R.id.new_transaction_description);
         tvDummy = itemView.findViewById(R.id.dummy_text);
@@ -237,7 +239,7 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
         tvComment.addTextChangedListener(tw);
         tvAmount.addTextChangedListener(amountWatcher);
 
-        tvCurrency.setOnClickListener(v -> {
+        tvCurrencyButton.setOnClickListener(v -> {
             CurrencySelectorFragment cpf = new CurrencySelectorFragment();
             cpf.showPositionAndPadding();
             cpf.setOnCurrencySelectedListener(c -> item.setCurrency(c));
@@ -378,12 +380,14 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
         showCurrencyObserver = showCurrency -> {
             if (showCurrency) {
                 tvCurrency.setVisibility(View.VISIBLE);
+                tvCurrencyButton.setVisibility(View.VISIBLE);
                 String defaultCommodity = mProfile.getDefaultCommodity();
                 item.setCurrency(
                         (defaultCommodity == null) ? null : Currency.loadByName(defaultCommodity));
             }
             else {
                 tvCurrency.setVisibility(View.GONE);
+                tvCurrencyButton.setVisibility(View.GONE);
                 item.setCurrency(null);
             }
         };
index ad2d4c8ba02dffd9ef2f37445aca657f5015e520..1c299625a22de9332defb91c743806439427d4f7 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?><!--
-  ~ Copyright © 2020 Damyan Ivanov.
+  ~ Copyright © 2021 Damyan Ivanov.
   ~ This file is part of MoLe.
   ~ MoLe is free software: you can distribute it and/or modify it
   ~ under the term of the GNU General Public License as published by
             app:layout_constraintTop_toBottomOf="@id/account_row_acc_name"
             >
 
+            <TextView
+                android:id="@+id/currencyButton"
+                android:layout_width="wrap_content"
+                android:layout_height="0dp"
+                android:minWidth="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="@id/currency"
+                app:layout_constraintStart_toStartOf="@id/currency"
+                app:layout_constraintTop_toTopOf="parent"
+                />
             <EditText
                 android:id="@+id/account_row_acc_amounts"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center_vertical"
                 android:gravity="center_horizontal"
-                android:minWidth="24dp"
+                android:minWidth="30dp"
                 android:text="@string/currency_symbol"
                 android:textAllCaps="false"
-                android:visibility="gone"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintRight_toRightOf="parent"
                 app:layout_constraintTop_toTopOf="parent"