From 1dbcd1db47c028de232f5f024996b902d91c6279 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 24 Mar 2019 11:47:17 +0200 Subject: [PATCH] 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 --- .../java/net/ktnx/mobileledger/ui/activity/MainActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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())); -- 2.39.5