]> git.ktnx.net Git - mobile-ledger.git/commitdiff
more thread pool async task execution
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 27 Feb 2019 17:21:50 +0000 (19:21 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 27 Feb 2019 17:21:50 +0000 (19:21 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryViewModel.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListViewModel.java

index ad250f97fdb108d3c41389c7985fd226eeb0be73..4d210534c5ce1bc2ba0faec6e17269d76b9685c9 100644 (file)
@@ -17,8 +17,8 @@
 
 package net.ktnx.mobileledger.ui.account_summary;
 
-import androidx.lifecycle.ViewModel;
 import android.content.Context;
+import android.os.AsyncTask;
 import android.util.Log;
 
 import net.ktnx.mobileledger.async.CommitAccountsTask;
@@ -29,17 +29,19 @@ import net.ktnx.mobileledger.model.LedgerAccount;
 
 import java.util.ArrayList;
 
+import androidx.lifecycle.ViewModel;
+
 class AccountSummaryViewModel extends ViewModel {
     static void commitSelections(Context context) {
         CAT task = new CAT();
-        task.execute(
+        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
                 new CommitAccountsTaskParams(Data.accounts.get(), Data.optShowOnlyStarred.get()));
     }
     static void scheduleAccountListReload() {
         if (Data.profile.get() == null) return;
 
         UAT task = new UAT();
-        task.execute();
+        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
 
     }
 
index 558ca691da3a49ec8e3b1132a70b1d0e9481b8b0..3d53dd50094bf8e8df82f181d48d43b6fb59d4de 100644 (file)
@@ -21,6 +21,7 @@ import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.res.ColorStateList;
 import android.graphics.Color;
+import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
 import android.util.Log;
@@ -401,7 +402,7 @@ public class MainActivity extends CrashReportingActivity {
         if (error == null) {
             updateLastUpdateTextFromDB();
 
-            new RefreshDescriptionsTask().execute();
+            new RefreshDescriptionsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
         }
         else Toast.makeText(this, error, Toast.LENGTH_LONG).show();
     }
index 7bc1a866f453d35ba5958f70ab1248af995ab607..513bf9f48f0aeef72e8649955a19ac48d574de15 100644 (file)
@@ -17,7 +17,6 @@
 
 package net.ktnx.mobileledger.ui.transaction_list;
 
-import androidx.lifecycle.ViewModel;
 import android.os.AsyncTask;
 
 import net.ktnx.mobileledger.async.UpdateTransactionsTask;
@@ -27,6 +26,8 @@ import net.ktnx.mobileledger.utils.ObservableValue;
 
 import java.util.List;
 
+import androidx.lifecycle.ViewModel;
+
 public class TransactionListViewModel extends ViewModel {
     public static ObservableValue<Boolean> updating = new ObservableValue<>();
     public static ObservableValue<String> updateError = new ObservableValue<>();
@@ -36,7 +37,7 @@ public class TransactionListViewModel extends ViewModel {
 
         String filter = TransactionListFragment.accountFilter.get();
         AsyncTask<String, Void, String> task = new UTT();
-        task.execute(filter);
+        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, filter);
     }
     public static TransactionListItem getTransactionListItem(int position) {
         List<TransactionListItem> transactions = Data.transactions.get();