]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java
move setting case_sensitive_like=ON to helper.onOpen
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / CommitAccountsTask.java
index cb13d6db3a8b757a0fff2ef4cd687f3699d3e27c..eb3dfbba51b0997424114ac55ba5a59782eebc80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -20,10 +20,10 @@ package net.ktnx.mobileledger.async;
 import android.database.sqlite.SQLiteDatabase;
 import android.os.AsyncTask;
 
+import net.ktnx.mobileledger.App;
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerAccount;
 import net.ktnx.mobileledger.utils.LockHolder;
-import net.ktnx.mobileledger.utils.MLDB;
 
 import java.util.ArrayList;
 
@@ -37,8 +37,8 @@ public class CommitAccountsTask
         String profile = Data.profile.getValue().getUuid();
         try {
 
-            SQLiteDatabase db = MLDB.getDatabase();
-            db.beginTransaction();
+            SQLiteDatabase db = App.getDatabase();
+            db.beginTransactionNonExclusive();
             try {
                 try (LockHolder lh = params[0].accountList.lockForWriting()) {
                     for (int i = 0; i < params[0].accountList.size(); i++ ){
@@ -48,9 +48,6 @@ public class CommitAccountsTask
                         db.execSQL("UPDATE accounts SET hidden=? WHERE profile=? AND name=?",
                                 new Object[]{acc.isHiddenByStarToBe() ? 1 : 0, profile, acc.getName()
                                 });
-
-                        acc.setHiddenByStar(acc.isHiddenByStarToBe());
-                        if (!params[0].showOnlyStarred || !acc.isHiddenByStar()) newList.add(acc);
                     }
                     db.setTransactionSuccessful();
                 }