From: Damyan Ivanov Date: Sun, 24 Mar 2019 09:47:17 +0000 (+0200) Subject: account list: queue db updates when an account is expanded/collapsed X-Git-Tag: v0.8.1~15 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=1dbcd1db47c028de232f5f024996b902d91c6279;p=mobile-ledger.git account list: queue db updates when an account is expanded/collapsed avoids a possible huge delay in UI if the account list is being updated --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index cfceb7ca..fbfb9f59 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -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()));