]> git.ktnx.net Git - mobile-ledger.git/commitdiff
execute transaction loader task using the thread pool executor for maximum performance
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 27 Feb 2019 17:13:19 +0000 (19:13 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 27 Feb 2019 17:13:19 +0000 (19:13 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListAdapter.java

index 32164cdc41814b52b3647a8e7a7ae8b0aa0e03c8..45d63af47c3760e1f1226ab00061fd46fd9dd49a 100644 (file)
@@ -21,9 +21,6 @@ import android.content.Context;
 import android.database.sqlite.SQLiteDatabase;
 import android.graphics.Typeface;
 import android.os.AsyncTask;
-import androidx.annotation.NonNull;
-import androidx.appcompat.widget.AppCompatTextView;
-import androidx.recyclerview.widget.RecyclerView;
 import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.style.StyleSpan;
@@ -47,6 +44,10 @@ import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatTextView;
+import androidx.recyclerview.widget.RecyclerView;
+
 import static net.ktnx.mobileledger.utils.DimensionUtils.dp2px;
 
 public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowHolder> {
@@ -71,8 +72,9 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
                 //                tr.getAccounts().size()));
 
                 TransactionLoader loader = new TransactionLoader();
-                loader.execute(new TransactionLoaderParams(tr, holder, position, boldAccountName,
-                        item.isOdd()));
+                loader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
+                        new TransactionLoaderParams(tr, holder, position, boldAccountName,
+                                item.isOdd()));
 
                 // WORKAROUND what seems to be a bug in CardHolder somewhere
                 // when a view that was previously holding a delimiter is re-purposed