mirror of https://github.com/M66B/FairEmail.git
Fixed invalid "no messages"
This commit is contained in:
parent
09f0fa55d4
commit
e0e4b4730d
|
@ -39,7 +39,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
interface IBoundaryCallbackMessages {
|
||||
void onLoading();
|
||||
|
||||
void onLoaded(boolean empty);
|
||||
void onLoaded();
|
||||
|
||||
void onError(Throwable ex);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
intf.onLoaded(model == null || model.isEmpty());
|
||||
intf.onLoaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1733,9 +1733,11 @@ public class FragmentMessages extends FragmentBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLoaded(boolean empty) {
|
||||
public void onLoaded() {
|
||||
RecyclerView.Adapter adapter = rvMessage.getAdapter();
|
||||
int items = (adapter == null ? 0 : adapter.getItemCount());
|
||||
tvNoEmail.setVisibility(items == 0 ? View.VISIBLE : View.GONE);
|
||||
pbWait.setVisibility(View.GONE);
|
||||
tvNoEmail.setVisibility(empty ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -64,7 +64,6 @@ public class ViewModelBrowse extends ViewModel {
|
|||
private int pageSize;
|
||||
|
||||
int local = 0;
|
||||
int matched = 0;
|
||||
List<Long> messages = null;
|
||||
IMAPStore istore = null;
|
||||
IMAPFolder ifolder = null;
|
||||
|
@ -84,13 +83,6 @@ public class ViewModelBrowse extends ViewModel {
|
|||
currentState.error = false;
|
||||
}
|
||||
|
||||
boolean isEmpty() {
|
||||
final State state = currentState;
|
||||
if (state == null)
|
||||
return true;
|
||||
return (state.matched == 0 && (state.imessages == null || state.imessages.length == 0));
|
||||
}
|
||||
|
||||
void load() throws MessagingException, IOException {
|
||||
final State state = currentState;
|
||||
if (state == null || state.error)
|
||||
|
@ -136,10 +128,8 @@ public class ViewModelBrowse extends ViewModel {
|
|||
if (!match && message.content)
|
||||
match = body.toLowerCase().contains(find);
|
||||
|
||||
if (match) {
|
||||
state.matched++;
|
||||
if (match)
|
||||
db.message().setMessageFound(message.account, message.thread);
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
|
Loading…
Reference in New Issue