Fixed simple task count

This commit is contained in:
M66B
2019-07-24 19:07:07 +02:00
parent a0c2e41adb
commit c40beae0fa
2 changed files with 11 additions and 5 deletions

View File

@@ -216,7 +216,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean manual = false;
private Integer lastUnseen = null;
private boolean swiping = false;
private int busy = 0;
private AdapterMessage adapter;
@@ -942,8 +941,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private BroadcastReceiver creceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
busy = intent.getIntExtra("count", 0);
if (busy == 0) {
Log.i("Received " + intent);
Log.logExtras(intent);
int count = intent.getIntExtra("count", 0);
if (count == 0) {
if (initialized && !loading)
pbWait.setVisibility(View.GONE);
} else
@@ -2752,7 +2754,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
public void onLoaded(int fetched) {
loading = false;
if (initialized && busy == 0)
if (initialized && SimpleTask.getCount() == 0)
pbWait.setVisibility(View.GONE);
tvNoEmail.setVisibility(fetched == 0 ? View.VISIBLE : View.GONE);
@@ -2807,7 +2809,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
});
initialized = true;
if (!loading && busy == 0)
if (!loading && SimpleTask.getCount() == 0)
pbWait.setVisibility(View.GONE);
if (viewType != AdapterMessage.ViewType.SEARCH)

View File

@@ -195,4 +195,8 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
protected void onPostExecute(Bundle args) {
}
static int getCount() {
return tasks.size();
}
}