]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java
whitespace
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionItemsAdapter.java
index acfd8bca6bf17b2116f9dba2d27f4642d291acba..cb03f3d1d29425303f47ca1f9cc45f62e8339740 100644 (file)
@@ -185,11 +185,12 @@ class NewTransactionItemsAdapter extends RecyclerView.Adapter<NewTransactionItem
         model.setFocusedItem(1);
     }
     public void toggleAllEditing(boolean editable) {
-        for (int i = 0; i < model.getAccountCount(); i++) {
-            model.getItem(i + 1)
+        // item 0 is the header
+        for (int i = 0; i <= model.getAccountCount(); i++) {
+            model.getItem(i)
                  .setEditable(editable);
-            notifyItemChanged(i + 1);
-            // TODO perhaps do only one notification about the whole range [1…count]?
+            notifyItemChanged(i);
+            // TODO perhaps do only one notification about the whole range (notifyDatasetChanged)?
         }
     }
     public void reset() {
@@ -200,4 +201,13 @@ class NewTransactionItemsAdapter extends RecyclerView.Adapter<NewTransactionItem
         if (presentItemCount > 2)
             notifyItemRangeRemoved(3, presentItemCount - 2); // all the rest are gone
     }
+    public void updateFocusedItem(int position) {
+        model.updateFocusedItem(position);
+    }
+    public void noteFocusIsOnAccount(int position) {
+        model.noteFocusIsOnAccount(position);
+    }
+    public void noteFocusIsOnAmount(int position) {
+        model.noteFocusIsOnAmount(position);
+    }
 }