mirror of https://github.com/M66B/FairEmail.git
Cleanup
This commit is contained in:
parent
5a5842272f
commit
0ea95b7a3d
|
@ -86,7 +86,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
interface IBoundaryCallbackMessages {
|
interface IBoundaryCallbackMessages {
|
||||||
void onLoading();
|
void onLoading();
|
||||||
|
|
||||||
void onLoaded(int fetched);
|
void onLoaded();
|
||||||
|
|
||||||
void onException(@NonNull Throwable ex);
|
void onException(@NonNull Throwable ex);
|
||||||
}
|
}
|
||||||
|
@ -109,33 +109,30 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
@Override
|
@Override
|
||||||
public void onZeroItemsLoaded() {
|
public void onZeroItemsLoaded() {
|
||||||
Log.i("Boundary zero loaded");
|
Log.i("Boundary zero loaded");
|
||||||
queue_load(true);
|
queue_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemAtEndLoaded(@NonNull final TupleMessageEx itemAtEnd) {
|
public void onItemAtEndLoaded(@NonNull final TupleMessageEx itemAtEnd) {
|
||||||
Log.i("Boundary at end");
|
Log.i("Boundary at end");
|
||||||
queue_load(false);
|
queue_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
void retry() {
|
void retry() {
|
||||||
state.reset();
|
state.reset();
|
||||||
queue_load(true);
|
queue_load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queue_load(final boolean zero) {
|
private void queue_load() {
|
||||||
final State state = this.state;
|
final State state = this.state;
|
||||||
|
|
||||||
executor.submit(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
private int fetched;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (state.destroyed || state.error)
|
if (state.destroyed || state.error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fetched = 0;
|
|
||||||
if (intf != null)
|
if (intf != null)
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,7 +142,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
});
|
});
|
||||||
if (server)
|
if (server)
|
||||||
try {
|
try {
|
||||||
fetched = load_server(state);
|
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;
|
||||||
|
@ -155,10 +152,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
state.reset();
|
state.reset();
|
||||||
|
|
||||||
// Retry
|
// Retry
|
||||||
fetched = load_server(state);
|
load_server(state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fetched = load_device(state);
|
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);
|
||||||
|
@ -174,7 +171,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
intf.onLoaded(zero ? fetched : Integer.MAX_VALUE);
|
intf.onLoaded();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -585,7 +582,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void close() {
|
private void close() {
|
||||||
Log.i("Boundary close");
|
Log.i("Boundary close");
|
||||||
try {
|
try {
|
||||||
if (state.ifolder != null)
|
if (state.ifolder != null)
|
||||||
|
|
|
@ -3787,7 +3787,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoaded(int fetched) {
|
public void onLoaded() {
|
||||||
loading = false;
|
loading = false;
|
||||||
updateListState("Loaded");
|
updateListState("Loaded");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue