]> git.ktnx.net Git - mobile-ledger.git/commitdiff
New transaction: when toggling editting, include the head row
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Nov 2019 17:13:18 +0000 (19:13 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Nov 2019 17:13:18 +0000 (19:13 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java

index acfd8bca6bf17b2116f9dba2d27f4642d291acba..2466d70c2bc7621cbc35a99cd31bbb73ab579a51 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() {