From 87aa9e4fad3b02e4118e8ed0b17778ba78fcc0b9 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 20 Jul 2020 07:59:53 +0000 Subject: [PATCH] drop remnants of "starring" accounts --- .../async/CommitAccountsTask.java | 65 ------------------- .../mobileledger/model/LedgerAccount.java | 10 --- 2 files changed, 75 deletions(-) delete mode 100644 app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.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 index eb3dfbba..00000000 --- a/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java +++ /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 . - */ - -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> { - protected ArrayList doInBackground(CommitAccountsTaskParams... params) { - Data.backgroundTaskStarted(); - ArrayList 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; - } -} diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java index 2aa558bb..19a33ad6 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java @@ -32,7 +32,6 @@ public class LedgerAccount { private String shortName; private int level; private String parentName; - private boolean hiddenByStarToBe; private boolean expanded; private List 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; } -- 2.39.2