]> git.ktnx.net Git - mobile-ledger.git/commitdiff
replace AsyncCrasher with a Runnable run by GeneralBackgroundTasks
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 25 Aug 2021 20:27:23 +0000 (23:27 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 25 Aug 2021 20:27:23 +0000 (23:27 +0300)
a step in removing usages of deprecated AsyncTask

app/src/main/java/net/ktnx/mobileledger/async/AsyncCrasher.java [deleted file]
app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java

diff --git a/app/src/main/java/net/ktnx/mobileledger/async/AsyncCrasher.java b/app/src/main/java/net/ktnx/mobileledger/async/AsyncCrasher.java
deleted file mode 100644 (file)
index 0ec9bb2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2021 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.os.AsyncTask;
-
-public class AsyncCrasher extends AsyncTask<Void, Void, Void> {
-    @Override
-    protected Void doInBackground(Void... voids) {
-        throw new RuntimeException("Simulated crash");
-    }
-}
index 0c0cfac0ec00985b80f8ba556c7a5b78f1eadb0b..50b8c63ea508513dac4aafc5161d2f1920c77b4a 100644 (file)
@@ -39,8 +39,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
 
 import net.ktnx.mobileledger.BuildConfig;
 import net.ktnx.mobileledger.R;
-import net.ktnx.mobileledger.async.AsyncCrasher;
 import net.ktnx.mobileledger.async.DescriptionSelectedCallback;
+import net.ktnx.mobileledger.async.GeneralBackgroundTasks;
 import net.ktnx.mobileledger.async.SendTransactionTask;
 import net.ktnx.mobileledger.async.TaskCallback;
 import net.ktnx.mobileledger.dao.TransactionDAO;
@@ -173,7 +173,7 @@ public class NewTransactionActivity extends ProfileThemedActivity
     }
     public boolean onSimulateCrashMenuItemClicked(MenuItem item) {
         debug("crash", "Will crash intentionally");
-        new AsyncCrasher().execute();
+        GeneralBackgroundTasks.run(() -> { throw new RuntimeException("Simulated crash");});
         return true;
     }
     public boolean onCreateOptionsMenu(Menu menu) {