]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
more heuristics when filling accounts from a previous transaction
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionModel.java
index 0198b8696a12de0c3cbe929baa3a64461d43c8da..5bc327a78329ffcb6c2ca3b0570d0de13d581b8f 100644 (file)
@@ -304,6 +304,19 @@ public class NewTransactionModel extends ViewModel {
         final MutableLiveData<Boolean> commentVisible = getItem(position).commentVisible;
         commentVisible.postValue(!commentVisible.getValue());
     }
+    public void moveItemLast(int index) {
+        /*   0
+             1   <-- index
+             2
+             3   <-- desired position
+         */
+        int itemCount = items.size();
+
+        if (index < itemCount - 1) {
+            Item acc = items.remove(index);
+            items.add(itemCount - 1, acc);
+        }
+    }
     enum ItemType {generalData, transactionRow, bottomFiller}
 
     //==========================================================================================