From 5eadaa3fd9348a396f541ee96a8608dd200e8a7f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 25 Aug 2021 23:27:23 +0300 Subject: [PATCH] replace AsyncCrasher with a Runnable run by GeneralBackgroundTasks a step in removing usages of deprecated AsyncTask --- .../ktnx/mobileledger/async/AsyncCrasher.java | 27 ------------------- .../NewTransactionActivity.java | 4 +-- 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 app/src/main/java/net/ktnx/mobileledger/async/AsyncCrasher.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 index 0ec9bb27..00000000 --- a/app/src/main/java/net/ktnx/mobileledger/async/AsyncCrasher.java +++ /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 . - */ - -package net.ktnx.mobileledger.async; - -import android.os.AsyncTask; - -public class AsyncCrasher extends AsyncTask { - @Override - protected Void doInBackground(Void... voids) { - throw new RuntimeException("Simulated crash"); - } -} diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java index 0c0cfac0..50b8c63e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java @@ -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) { -- 2.39.5