]> git.ktnx.net Git - mobile-ledger.git/commitdiff
drop remnants of "starring" accounts
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 20 Jul 2020 07:59:53 +0000 (07:59 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 20 Jul 2020 07:59:53 +0000 (07:59 +0000)
app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java [deleted file]
app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java

diff --git a/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java
deleted file mode 100644 (file)
index eb3dfbb..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your opinion), any later version.
- *
- * MoLe is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License terms for details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
- */
-
-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 java.util.ArrayList;
-
-import static net.ktnx.mobileledger.utils.Logger.debug;
-
-public class CommitAccountsTask
-        extends AsyncTask<CommitAccountsTaskParams, Void, ArrayList<LedgerAccount>> {
-    protected ArrayList<LedgerAccount> doInBackground(CommitAccountsTaskParams... params) {
-        Data.backgroundTaskStarted();
-        ArrayList<LedgerAccount> newList = new ArrayList<>();
-        String profile = Data.profile.getValue().getUuid();
-        try {
-
-            SQLiteDatabase db = App.getDatabase();
-            db.beginTransactionNonExclusive();
-            try {
-                try (LockHolder lh = params[0].accountList.lockForWriting()) {
-                    for (int i = 0; i < params[0].accountList.size(); i++ ){
-                        LedgerAccount acc = params[0].accountList.get(i);
-                        debug("CAT", String.format("Setting %s to %s", acc.getName(),
-                                acc.isHiddenByStarToBe() ? "hidden" : "starred"));
-                        db.execSQL("UPDATE accounts SET hidden=? WHERE profile=? AND name=?",
-                                new Object[]{acc.isHiddenByStarToBe() ? 1 : 0, profile, acc.getName()
-                                });
-                    }
-                    db.setTransactionSuccessful();
-                }
-            }
-            finally {
-                db.endTransaction();
-            }
-        }
-        finally {
-            Data.backgroundTaskFinished();
-        }
-
-        return newList;
-    }
-}
index 2aa558bbb599a0a3af99817d0fdd7bf7d7dad16b..19a33ad6166f2f6f2231d619d9b02ddd28550c36 100644 (file)
@@ -32,7 +32,6 @@ public class LedgerAccount {
     private String shortName;
     private int level;
     private String parentName;
-    private boolean hiddenByStarToBe;
     private boolean expanded;
     private List<LedgerAmount> amounts;
     private boolean hasSubAccounts;
@@ -160,15 +159,6 @@ public class LedgerAccount {
     public String getParentName() {
         return parentName;
     }
-    public boolean isHiddenByStarToBe() {
-        return hiddenByStarToBe;
-    }
-    public void setHiddenByStarToBe(boolean hiddenByStarToBe) {
-        this.hiddenByStarToBe = hiddenByStarToBe;
-    }
-    public void toggleHiddenToBe() {
-        setHiddenByStarToBe(!hiddenByStarToBe);
-    }
     public boolean hasSubAccounts() {
         return hasSubAccounts;
     }