]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
NewTransaction Item.setEditable: allow to be called for head row too
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index da008d56dba30336b8abc50fceb087c38a73158b..443c21f911ff310681c683a60fdd744e77a95c5f 100644 (file)
@@ -276,14 +276,17 @@ public class NewTransactionModel extends ViewModel {
         public NewTransactionModel getModel() {
             return model;
         }
-        public boolean isEditable() {
-            ensureType(ItemType.transactionRow);
-            return this.editable.getValue();
-        }
         public void setEditable(boolean editable) {
-            ensureType(ItemType.transactionRow);
+            ensureType(ItemType.generalData, ItemType.transactionRow);
             this.editable.setValue(editable);
         }
+        private void ensureType(ItemType type1, ItemType type2) {
+            if ((type != type1) && (type != type2)) {
+                throw new RuntimeException(
+                        String.format("Actual type (%s) differs from wanted (%s or %s)", type,
+                                type1, type2));
+            }
+        }
         public String getAmountHint() {
             ensureType(ItemType.transactionRow);
             return amountHint.getValue();