Use view handler for boundary callbacks

pull/184/head
M66B 4 years ago
parent 5f6ee3c3ad
commit d0858f3862

@ -85,9 +85,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
private int pageSize;
private IBoundaryCallbackMessages intf;
private Handler handler;
private State state;
private static final int SEARCH_LIMIT_DEVICE = 1000;
@ -111,9 +109,9 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
this.pageSize = pageSize;
}
void setCallback(IBoundaryCallbackMessages intf) {
this.handler = new Handler();
void setCallback(IBoundaryCallbackMessages intf, Handler handler) {
this.intf = intf;
this.handler = handler;
this.state = new State();
}

@ -4331,7 +4331,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
getContext(), getViewLifecycleOwner(),
viewType, type, account, folder, thread, id, filter_archive, criteria, server);
vmodel.setCallback(getViewLifecycleOwner(), callback);
vmodel.setCallback(getViewLifecycleOwner(), callback, view.getHandler());
vmodel.setObserver(getViewLifecycleOwner(), observer);
}

@ -23,6 +23,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Pair;
@ -516,9 +517,9 @@ public class ViewModelMessages extends ViewModel {
this.boundary = boundary;
}
void setCallback(LifecycleOwner owner, BoundaryCallbackMessages.IBoundaryCallbackMessages callback) {
void setCallback(LifecycleOwner owner, BoundaryCallbackMessages.IBoundaryCallbackMessages callback, Handler handler) {
if (boundary != null) {
boundary.setCallback(callback);
boundary.setCallback(callback, handler);
owner.getLifecycle().addObserver(new LifecycleObserver() {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)

Loading…
Cancel
Save