mirror of https://github.com/M66B/FairEmail.git
Report number of found message for list state
This commit is contained in:
parent
d791788985
commit
5a15249ed4
|
@ -96,7 +96,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
interface IBoundaryCallbackMessages {
|
interface IBoundaryCallbackMessages {
|
||||||
void onLoading();
|
void onLoading();
|
||||||
|
|
||||||
void onLoaded();
|
void onLoaded(int found);
|
||||||
|
|
||||||
void onException(@NonNull Throwable ex);
|
void onException(@NonNull Throwable ex);
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
executor.submit(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
int found = 0;
|
||||||
try {
|
try {
|
||||||
if (state.destroyed || state.error)
|
if (state.destroyed || state.error)
|
||||||
return;
|
return;
|
||||||
|
@ -154,7 +155,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
});
|
});
|
||||||
if (server)
|
if (server)
|
||||||
try {
|
try {
|
||||||
load_server(state);
|
found = load_server(state);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
if (state.error || ex instanceof IllegalArgumentException)
|
if (state.error || ex instanceof IllegalArgumentException)
|
||||||
throw ex;
|
throw ex;
|
||||||
|
@ -163,10 +164,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
close(state, true);
|
close(state, true);
|
||||||
|
|
||||||
// Retry
|
// Retry
|
||||||
load_server(state);
|
found = load_server(state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
load_device(state);
|
found = load_device(state);
|
||||||
} catch (final Throwable ex) {
|
} catch (final Throwable ex) {
|
||||||
state.error = true;
|
state.error = true;
|
||||||
Log.e("Boundary", ex);
|
Log.e("Boundary", ex);
|
||||||
|
@ -178,15 +179,17 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
if (intf != null)
|
if (intf != null) {
|
||||||
|
final int f = found;
|
||||||
ApplicationEx.getMainHandler().post(new Runnable() {
|
ApplicationEx.getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
intf.onLoaded();
|
intf.onLoaded(f);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4537,9 +4537,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoaded() {
|
public void onLoaded(int found) {
|
||||||
loading = false;
|
loading = false;
|
||||||
updateListState("Loaded", SimpleTask.getCount(), adapter.getItemCount());
|
updateListState("Loaded found=" + found, SimpleTask.getCount(), adapter.getItemCount() + found);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue