]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
transaction-level comments in new transaction UI, optional
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index 00e44508a33d4ac0856aa39b3c2485c8dbcaf252..d7663bcd7ff272f13b9a070ec20136c63478a0f1 100644 (file)
@@ -59,7 +59,11 @@ public class NewTransactionModel extends ViewModel {
             profile -> showCurrency.postValue(profile.getShowCommodityByDefault());
     private final AtomicInteger busyCounter = new AtomicInteger(0);
     private final MutableLiveData<Boolean> busyFlag = new MutableLiveData<>(false);
-    void observeBusyFlag(LifecycleOwner owner, Observer<? super Boolean> observer) {
+    final MutableLiveData<Boolean> showComments = new MutableLiveData<>(false);
+    void observeShowComments(LifecycleOwner owner, Observer<? super Boolean> observer) {
+        showComments.observe(owner, observer);
+    }
+    void observeBusyFlag(@NonNull LifecycleOwner owner, Observer<? super Boolean> observer) {
         busyFlag.observe(owner, observer);
     }
     void observeDataProfile(LifecycleOwner activity) {
@@ -204,6 +208,12 @@ public class NewTransactionModel extends ViewModel {
         int newValue = busyCounter.decrementAndGet();
         if (newValue == 0) busyFlag.postValue(false);
     }
+    public boolean getBusyFlag() {
+        return busyFlag.getValue();
+    }
+    public void toggleShowComments() {
+        showComments.setValue(!showComments.getValue());
+    }
     enum ItemType {generalData, transactionRow, bottomFiller}
 
     enum FocusedElement {Account, Comment, Amount}