]> git.ktnx.net Git - mobile-ledger.git/commitdiff
account list: queue db updates when an account is expanded/collapsed
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Mar 2019 09:47:17 +0000 (11:47 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 25 Mar 2019 06:17:36 +0000 (06:17 +0000)
avoids a possible huge delay in UI if the account list is being updated

app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index cfceb7ca7f1786d9a9470dd6c0934dbaf5e9b8c6..fbfb9f59383197529ef57b77dcc5b41d244dfe9b 100644 (file)
@@ -578,7 +578,9 @@ public class MainActivity extends ProfileThemedActivity {
                 ViewPropertyAnimator animator = arrow.animate();
 
                 acc.toggleExpanded();
-                Data.profile.get().storeAccount(MLDB.getDatabase(), acc);
+                DbOpQueue.add("update accounts set expanded=? where name=? and profile=?",
+                        new Object[]{acc.isExpanded(), acc.getName(), Data.profile.get().getUuid()
+                        });
 
                 if (wasExpanded) {
                     Log.d("accounts", String.format("Collapsing account '%s'", acc.getName()));