Improved displaying no messages

This commit is contained in:
M66B 2019-06-12 22:21:55 +02:00
parent d169fbd395
commit 3287ce719b
2 changed files with 11 additions and 21 deletions

View File

@ -113,16 +113,16 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
@Override
public void onZeroItemsLoaded() {
Log.i("Boundary zero loaded");
queue_load();
queue_load(true);
}
@Override
public void onItemAtEndLoaded(final TupleMessageEx itemAtEnd) {
Log.i("Boundary at end");
queue_load();
queue_load(false);
}
private void queue_load() {
private void queue_load(final boolean zero) {
executor.submit(new Runnable() {
private int fetched;
@ -158,7 +158,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
handler.post(new Runnable() {
@Override
public void run() {
intf.onLoaded(fetched);
intf.onLoaded(zero ? fetched : Integer.MAX_VALUE);
}
});
}

View File

@ -2700,21 +2700,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
public void onLoading() {
loading = true;
pbWait.setVisibility(View.VISIBLE);
tvNoEmail.setVisibility(View.GONE);
}
@Override
public void onLoaded(int fetched) {
loading = false;
Integer submitted = (Integer) rvMessage.getTag();
if (submitted == null)
return;
if (initialized && busy == 0)
pbWait.setVisibility(View.GONE);
if (submitted + fetched == 0)
tvNoEmail.setVisibility(View.VISIBLE);
tvNoEmail.setVisibility(fetched == 0 ? View.VISIBLE : View.GONE);
}
@Override
@ -2752,18 +2747,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
rvMessage.setTag(messages.size());
initialized = true;
if (!loading && busy == 0) {
if (!loading && busy == 0)
pbWait.setVisibility(View.GONE);
if (messages.size() == 0)
tvNoEmail.setVisibility(View.VISIBLE);
}
if (messages.size() > 0) {
tvNoEmail.setVisibility(View.GONE);
grpReady.setVisibility(View.VISIBLE);
}
if (viewType != AdapterMessage.ViewType.SEARCH)
tvNoEmail.setVisibility(messages.size() == 0 && !loading ? View.VISIBLE : View.GONE);
grpReady.setVisibility(View.VISIBLE);
}
};