move reloading of transaction list in the postExecute method
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 5 Mar 2019 19:17:50 +0000 (21:17 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 5 Mar 2019 19:17:50 +0000 (21:17 +0200)
seems more logical, when one thread finishes and signals that to the main
thread, the new task is started

app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index 7be2c74..0fea300 100644 (file)
@@ -359,7 +359,6 @@ public class RetrieveTransactionsTask
                         Date now = new Date();
                         profile.setLongOption(MLDB.OPT_LAST_SCRAPE, now.getTime());
                         Data.lastUpdateDate.set(now);
-                        TransactionListViewModel.scheduleTransactionListReload();
 
                         return null;
                     }
index 2083039..b2ac0ae 100644 (file)
@@ -46,6 +46,7 @@ import net.ktnx.mobileledger.ui.account_summary.AccountSummaryFragment;
 import net.ktnx.mobileledger.ui.profiles.ProfileDetailFragment;
 import net.ktnx.mobileledger.ui.profiles.ProfilesRecyclerViewAdapter;
 import net.ktnx.mobileledger.ui.transaction_list.TransactionListFragment;
+import net.ktnx.mobileledger.ui.transaction_list.TransactionListViewModel;
 import net.ktnx.mobileledger.utils.Colors;
 import net.ktnx.mobileledger.utils.MLDB;
 
@@ -442,6 +443,7 @@ public class MainActivity extends ProfileThemedActivity {
             updateLastUpdateTextFromDB();
 
             new RefreshDescriptionsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+            TransactionListViewModel.scheduleTransactionListReload();
         }
         else Toast.makeText(this, error, Toast.LENGTH_LONG).show();
     }