]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
NT: correctly disable swiping of top and bottom entries, let all the rest be swiped
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index cad07c0def34ee0ea3acb810775aa98a81c4f270..7c49bf1b4b08a0e49ad9b166ed147367ea7ab894 100644 (file)
@@ -153,6 +153,8 @@ public class NewTransactionModel extends ViewModel {
      3a) there must be exactly one empty amount (with account)
      4) empty accounts with empty amounts are ignored
      5) a row with an empty account name or empty amount is guaranteed to exist
      3a) there must be exactly one empty amount (with account)
      4) empty accounts with empty amounts are ignored
      5) a row with an empty account name or empty amount is guaranteed to exist
+     6) at least two rows need to be present in the ledger
+
     */
     @SuppressLint("DefaultLocale")
     public void checkTransactionSubmittable(NewTransactionItemsAdapter adapter) {
     */
     @SuppressLint("DefaultLocale")
     public void checkTransactionSubmittable(NewTransactionItemsAdapter adapter) {
@@ -258,6 +260,9 @@ public class NewTransactionModel extends ViewModel {
                 adapter.addRow();
             }
 
                 adapter.addRow();
             }
 
+            // 6) at least two rows need to be present in the ledger
+            while (this.items.size() < 2) adapter.addRow();
+
 
             debug("submittable", submittable ? "YES" : "NO");
             isSubmittable.setValue(submittable);
 
             debug("submittable", submittable ? "YES" : "NO");
             isSubmittable.setValue(submittable);