]> git.ktnx.net Git - mobile-ledger.git/commitdiff
note focused item changed when item is moved
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 7 Mar 2021 09:43:16 +0000 (11:43 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 7 Mar 2021 09:43:16 +0000 (11:43 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java

index d092be213a9e008cab7519985812e5ad37171270..68839e0a6291137e270deadf28d92b0ad04ed3f5 100644 (file)
@@ -348,6 +348,11 @@ public class NewTransactionModel extends ViewModel {
         List<Item> newList = shallowCopyList();
         Item item = newList.remove(fromIndex);
         newList.add(toIndex, item);
         List<Item> newList = shallowCopyList();
         Item item = newList.remove(fromIndex);
         newList.add(toIndex, item);
+
+        FocusInfo fi = focusInfo.getValue();
+        if (fi != null && fi.position == fromIndex)
+            noteFocusChanged(toIndex, fi.element);
+
         items.setValue(newList); // same count, same submittable state
     }
     void moveItemLast(List<Item> list, int index) {
         items.setValue(newList); // same count, same submittable state
     }
     void moveItemLast(List<Item> list, int index) {