]> git.ktnx.net Git - mobile-ledger.git/commitdiff
drop functionality for limiting account tree display to selected accounts
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Dec 2019 12:21:49 +0000 (14:21 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Dec 2019 12:21:49 +0000 (14:21 +0200)
not used since the introduction of collapsible sub-trees

app/src/main/java/net/ktnx/mobileledger/App.java
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
app/src/main/java/net/ktnx/mobileledger/async/UpdateAccountsTask.java
app/src/main/java/net/ktnx/mobileledger/model/Data.java
app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java

index 920187e9fb54d98b69e0766ff097031ae0b53c7a..bec320e00d3e8db688ede6bf2bc0d559ae690986 100644 (file)
 package net.ktnx.mobileledger;
 
 import android.app.Application;
-import android.content.SharedPreferences;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.sqlite.SQLiteDatabase;
-import android.preference.PreferenceManager;
 import android.util.Log;
 
 import net.ktnx.mobileledger.model.Data;
@@ -36,8 +34,6 @@ import java.net.MalformedURLException;
 import java.net.PasswordAuthentication;
 import java.net.URL;
 
-import static net.ktnx.mobileledger.ui.activity.SettingsActivity.PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS;
-
 public class App extends Application {
     public static App instance;
     private MobileLedgerDatabase dbHelper;
@@ -52,12 +48,6 @@ public class App extends Application {
         instance = this;
         super.onCreate();
         updateMonthNames();
-        SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
-        Data.optShowOnlyStarred.set(p.getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false));
-        SharedPreferences.OnSharedPreferenceChangeListener handler =
-                (preference, value) -> Data.optShowOnlyStarred
-                        .set(preference.getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false));
-        p.registerOnSharedPreferenceChangeListener(handler);
         Authenticator.setDefault(new Authenticator() {
             @Override
             protected PasswordAuthentication getPasswordAuthentication() {
index 5aebe219ffa6cb9650ce15afd30719b6ce2ae150..807e43752cffd6aa7b6ef4427d8b438f7c584247 100644 (file)
@@ -122,7 +122,6 @@ public class RetrieveTransactionsTask
         HashMap<String, Void> accountNames = new HashMap<>();
         HashMap<String, LedgerAccount> syntheticAccounts = new HashMap<>();
         LedgerAccount lastAccount = null, prevAccount = null;
-        boolean onlyStarred = Data.optShowOnlyStarred.get();
 
         HttpURLConnection http = NetworkUtil.prepareConnection(profile, "journal");
         http.setAllowUserInteraction(false);
@@ -218,8 +217,8 @@ public class RetrieveTransactionsTask
                                         }
                                         acc.setHasSubAccounts(true);
                                         acc.removeAmounts();    // filled below when amounts are parsed
-                                        if ((!onlyStarred || !acc.isHiddenByStar()) &&
-                                            acc.isVisible(accountList)) accountList.add(acc);
+                                        if (acc.isVisible(accountList))
+                                            accountList.add(acc);
                                         L(String.format("gap-filling with %s", aName));
                                         accountNames.put(aName, null);
                                         profile.storeAccount(db, acc);
@@ -227,8 +226,7 @@ public class RetrieveTransactionsTask
                                     }
                                 }
 
-                                if ((!onlyStarred || !lastAccount.isHiddenByStar()) &&
-                                    lastAccount.isVisible(accountList))
+                                if (lastAccount.isVisible(accountList))
                                     accountList.add(lastAccount);
                                 accountNames.put(acct_name, null);
 
index 667bf99809f6e29f6da971651f70cd5e673e4823..8beab181c3b0a86ea7258a553d061f521e37e8ec 100644 (file)
@@ -37,11 +37,9 @@ public class UpdateAccountsTask extends AsyncTask<Void, Void, ArrayList<LedgerAc
             MobileLedgerProfile profile = Data.profile.getValue();
             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 = App.getDatabase();
index 223a61e8aa7ebe621a2df2b3b051c2d589a31378..4a79095a1e95b3d28f915f507b435854daf5c71c 100644 (file)
@@ -21,6 +21,8 @@ import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.os.AsyncTask;
 
+import androidx.lifecycle.MutableLiveData;
+
 import net.ktnx.mobileledger.App;
 import net.ktnx.mobileledger.async.RetrieveTransactionsTask;
 import net.ktnx.mobileledger.ui.activity.MainActivity;
@@ -29,7 +31,6 @@ import net.ktnx.mobileledger.utils.Locker;
 import net.ktnx.mobileledger.utils.Logger;
 import net.ktnx.mobileledger.utils.MLDB;
 import net.ktnx.mobileledger.utils.ObservableList;
-import net.ktnx.mobileledger.utils.ObservableValue;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
@@ -38,8 +39,6 @@ import java.util.List;
 import java.util.Locale;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import androidx.lifecycle.MutableLiveData;
-
 import static net.ktnx.mobileledger.utils.Logger.debug;
 
 public final class Data {
@@ -51,7 +50,6 @@ public final class Data {
     public static MutableLiveData<MobileLedgerProfile> profile = new MutableLiveData<>();
     public static MutableLiveData<ArrayList<MobileLedgerProfile>> profiles =
             new MutableLiveData<>(null);
-    public static ObservableValue<Boolean> optShowOnlyStarred = new ObservableValue<>();
     public static MutableLiveData<String> accountFilter = new MutableLiveData<>();
     private static AtomicInteger backgroundTaskCount = new AtomicInteger(0);
     private static Locker profilesLocker = new Locker();
index 3e9af7ba5be9edccbac5eabad9c44b0b2348af38..45a088cc71fbd04e8925c25b0ea0a6cfc6e65089 100644 (file)
 
 package net.ktnx.mobileledger.ui.account_summary;
 
-import android.content.Context;
 import android.os.AsyncTask;
 
 import net.ktnx.mobileledger.async.CommitAccountsTask;
-import net.ktnx.mobileledger.async.CommitAccountsTaskParams;
 import net.ktnx.mobileledger.async.UpdateAccountsTask;
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerAccount;
@@ -33,11 +31,6 @@ import androidx.lifecycle.ViewModel;
 import static net.ktnx.mobileledger.utils.Logger.debug;
 
 public class AccountSummaryViewModel extends ViewModel {
-    static void commitSelections(Context context) {
-        CAT task = new CAT();
-        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
-                new CommitAccountsTaskParams(Data.accounts, Data.optShowOnlyStarred.get()));
-    }
     static public void scheduleAccountListReload() {
         if (Data.profile.getValue() == null) return;