|
|
@ -21,9 +21,10 @@ package eu.faircode.email;
|
|
|
|
|
|
|
|
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.lifecycle.GenericLifecycleObserver;
|
|
|
|
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
|
|
|
|
import androidx.lifecycle.LifecycleObserver;
|
|
|
|
import androidx.lifecycle.LifecycleOwner;
|
|
|
|
import androidx.lifecycle.LifecycleOwner;
|
|
|
|
|
|
|
|
import androidx.lifecycle.OnLifecycleEvent;
|
|
|
|
import androidx.paging.PagedList;
|
|
|
|
import androidx.paging.PagedList;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
@ -50,17 +51,17 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|
|
|
this.handler = new Handler();
|
|
|
|
this.handler = new Handler();
|
|
|
|
this.intf = intf;
|
|
|
|
this.intf = intf;
|
|
|
|
|
|
|
|
|
|
|
|
owner.getLifecycle().addObserver(new GenericLifecycleObserver() {
|
|
|
|
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
|
|
|
@Override
|
|
|
|
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
|
|
|
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
|
|
|
|
public void onDestroyed() {
|
|
|
|
if (event == Lifecycle.Event.ON_DESTROY)
|
|
|
|
executor.submit(new Runnable() {
|
|
|
|
executor.submit(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
Log.i("Boundary destroy");
|
|
|
|
model.clear();
|
|
|
|
model.clear();
|
|
|
|
model = null;
|
|
|
|
model = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|