]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
posting-level flag for amount validity; drop custom amount text filter
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index 03887c19410137857cc6eacbcc1c2e9673b8d47f..83ffbb8f7bed90cdf747e60cc0daf6ef3d61e182 100644 (file)
@@ -241,6 +241,7 @@ public class NewTransactionModel extends ViewModel {
         private FocusedElement focusedElement = FocusedElement.Account;
         private MutableLiveData<String> comment = new MutableLiveData<>(null);
         private MutableLiveData<Currency> currency = new MutableLiveData<>(null);
+        private MutableLiveData<Boolean> amountValid = new MutableLiveData<>(true);
         private boolean amountHintIsSet = false;
         Item(NewTransactionModel model) {
             this.model = model;
@@ -489,5 +490,17 @@ public class NewTransactionModel extends ViewModel {
         boolean isAmountHintSet() {
             return amountHintIsSet;
         }
+        void validateAmount() {
+            amountValid.setValue(true);
+        }
+        void invalidateAmount() {
+            amountValid.setValue(false);
+        }
+        void observeAmountValidity(NewTransactionActivity activity, Observer<Boolean> observer) {
+            amountValid.observe(activity, observer);
+        }
+        void stopObservingAmountValidity(Observer<Boolean> observer) {
+            amountValid.removeObserver(observer);
+        }
     }
 }