Browse Source

Fixed displaying no messages while searching

main
M66B 6 years ago
parent
commit
eddbf29175
2 changed files with 12 additions and 2 deletions
  1. +6
    -0
      app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java
  2. +6
    -2
      app/src/main/java/eu/faircode/email/FragmentMessages.java

+ 6
- 0
app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java View File

@ -64,6 +64,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
private Message[] imessages = null;
private int index;
private boolean searching = false;
private int loaded = 0;
interface IBoundaryCallbackMessages {
void onLoading();
@ -111,6 +112,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
return searching;
}
int getLoaded() {
return loaded;
}
@Override
public void onZeroItemsLoaded() {
Log.i(Helper.TAG, "onZeroItemsLoaded");
@ -196,6 +201,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (db.message().getMessageByUid(fid, uid) == null) {
ServiceSynchronize.synchronizeMessage(context, folder, ifolder, (IMAPMessage) isub[j], true);
count++;
loaded++;
}
} catch (MessageRemovedException ex) {
Log.w(Helper.TAG, "Boundary " + ex + "\n" + Log.getStackTraceString(ex));


+ 6
- 2
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -708,12 +708,15 @@ public class FragmentMessages extends FragmentEx {
new BoundaryCallbackMessages.IBoundaryCallbackMessages() {
@Override
public void onLoading() {
tvNoEmail.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
}
@Override
public void onLoaded() {
pbWait.setVisibility(View.GONE);
if (searchCallback.getLoaded() == 0)
tvNoEmail.setVisibility(View.VISIBLE);
}
@Override
@ -751,8 +754,9 @@ public class FragmentMessages extends FragmentEx {
pbWait.setVisibility(View.GONE);
grpReady.setVisibility(View.VISIBLE);
if (messages.size() == 0 && !searching) {
tvNoEmail.setVisibility(View.VISIBLE);
if (messages.size() == 0) {
if (searchCallback == null)
tvNoEmail.setVisibility(View.VISIBLE);
rvMessage.setVisibility(View.GONE);
} else {
tvNoEmail.setVisibility(View.GONE);


Loading…
Cancel
Save