]> git.ktnx.net Git - mobile-ledger.git/commitdiff
increment background task count while retrieving accounts too
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 5 Jan 2019 07:52:19 +0000 (07:52 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 5 Jan 2019 07:52:19 +0000 (07:52 +0000)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveAccountsTask.java

index a27b1c8cb5b27b5c2b0567726c1a139026cbaff8..e046040e137b92431615455e20b9e89adaff7829 100644 (file)
@@ -23,6 +23,7 @@ import android.os.OperationCanceledException;
 import android.util.Log;
 
 import net.ktnx.mobileledger.R;
+import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerAccount;
 import net.ktnx.mobileledger.ui.activity.MainActivity;
 import net.ktnx.mobileledger.utils.MLDB;
@@ -55,6 +56,7 @@ public class RetrieveAccountsTask extends android.os.AsyncTask<Void, Integer, Vo
     }
 
     protected Void doInBackground(Void... params) {
+        Data.backgroundTaskCount.incrementAndGet();
         try {
             HttpURLConnection http = NetworkUtil.prepare_connection(pref, "add");
             publishProgress(0);
@@ -188,6 +190,10 @@ public class RetrieveAccountsTask extends android.os.AsyncTask<Void, Integer, Vo
             error = R.string.err_net_error;
             e.printStackTrace();
         }
+        finally {
+            Log.d("RAT", "decrementing background task count");
+            Data.backgroundTaskCount.decrementAndGet();
+        }
 
         return null;
     }