X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fasync%2FCommitAccountsTask.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fasync%2FCommitAccountsTask.java;h=0000000000000000000000000000000000000000;hb=87aa9e4fad3b02e4118e8ed0b17778ba78fcc0b9;hp=eb3dfbba51b0997424114ac55ba5a59782eebc80;hpb=64bb8277f3c747f0ef2dcb48f898fb4ec07b64ee;p=mobile-ledger-staging.git
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;
- }
-}