Added simple task/destroyed

pull/207/head
M66B 2 years ago
parent 372f0b1b5e
commit 3cfa634ac9

@ -677,6 +677,11 @@ public class ActivityEML extends ActivityBase {
ToastEx.makeText(ActivityEML.this, name, Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, @NonNull Throwable ex) {
if (ex instanceof IllegalArgumentException)

@ -781,6 +781,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
ToastEx.makeText(ActivitySetup.this, R.string.title_setup_exported, Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
boolean expected =

@ -411,6 +411,11 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex, false);

@ -2384,6 +2384,11 @@ public class FragmentCompose extends FragmentBase {
activity.invalidateOptionsMenu();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
etBody.setSelection(paragraph.second);
@ -2456,6 +2461,11 @@ public class FragmentCompose extends FragmentBase {
}
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Throwable exex = new Throwable("LanguageTool", ex);

@ -482,6 +482,11 @@ public class FragmentContacts extends FragmentBase {
ToastEx.makeText(getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
if (ex instanceof NoStreamException)
@ -576,6 +581,11 @@ public class FragmentContacts extends FragmentBase {
ToastEx.makeText(getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroyed(Bundle args) {
toast = null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);

@ -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();

Loading…
Cancel
Save