]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/UpdateAccountsTask.java
store a weak reference to the profile in the account object
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / UpdateAccountsTask.java
index 88ff97b81b4eeeaf923a6704a61d6b7f8821b3e9..8beab181c3b0a86ea7258a553d061f521e37e8ec 100644 (file)
@@ -21,10 +21,10 @@ import android.database.Cursor;
 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.model.MobileLedgerProfile;
-import net.ktnx.mobileledger.utils.MLDB;
 
 import java.util.ArrayList;
 
@@ -35,16 +35,14 @@ public class UpdateAccountsTask extends AsyncTask<Void, Void, ArrayList<LedgerAc
         Data.backgroundTaskStarted();
         try {
             MobileLedgerProfile profile = Data.profile.getValue();
-            assert profile != null;
+            if (profile == null) throw new AssertionError();
             String profileUUID = profile.getUuid();
-            boolean onlyStarred = Data.optShowOnlyStarred.get();
             ArrayList<LedgerAccount> newList = new ArrayList<>();
 
             String sql = "SELECT a.name from accounts a WHERE a.profile = ?";
-            if (onlyStarred) sql += " AND a.hidden = 0";
             sql += " ORDER BY a.name";
 
-            SQLiteDatabase db = MLDB.getDatabase();
+            SQLiteDatabase db = App.getDatabase();
             try (Cursor cursor = db.rawQuery(sql, new String[]{profileUUID})) {
                 while (cursor.moveToNext()) {
                     final String accName = cursor.getString(0);