Added simple task/destroyed

This commit is contained in:
M66B
2022-05-14 21:48:19 +02:00
parent 372f0b1b5e
commit 3cfa634ac9
6 changed files with 40 additions and 0 deletions

View File

@@ -155,6 +155,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
public void onDestroy() {
EntityLog.log(context, EntityLog.Type.Debug, "Owner gone task=" + name);
destroyed = true;
onDestroyed(args);
owner.getLifecycle().removeObserver(this);
}
};
@@ -225,6 +226,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
state = owner.getLifecycle().getCurrentState();
if (state.equals(Lifecycle.State.DESTROYED)) {
Log.i("Destroyed task " + name);
onDestroyed(args);
owner.getLifecycle().removeObserver(this);
cleanup(context);
} else if (state.isAtLeast(Lifecycle.State.RESUMED)) {
@@ -366,6 +368,9 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
protected void onPostExecute(Bundle args) {
}
protected void onDestroyed(Bundle args) {
}
@Override
public String toString() {
long now = new Date().getTime();