]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
New transaction Item: variant of ensureType with two allowed types
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index 75429a9921152f7c339eee245c85a55d1f2d0c89..54867e4da3321cb490fa6f8a2b334649a4066d2e 100644 (file)
@@ -280,6 +280,13 @@ public class NewTransactionModel extends ViewModel {
             ensureType(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();