Added dialog life cycle

pull/162/head
M66B 5 years ago
parent ff9803e075
commit f73476bdfc

@ -3787,7 +3787,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
tvOwner.setText(ex.getMessage()); tvOwner.setText(ex.getMessage());
} }
}.execute(getContext(), getActivity(), args, "link:owner"); }.execute(FragmentDialogLink.this, args, "link:owner");
} }
}); });
@ -3839,7 +3839,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), getArguments(), "view:image"); }.execute(this, getArguments(), "view:image");
final Dialog dialog = new Dialog(getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen); final Dialog dialog = new Dialog(getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(pv); dialog.setContentView(pv);
@ -3970,7 +3970,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), getArguments(), "message:full"); }.execute(this, getArguments(), "message:full");
return dialog; return dialog;
} }
@ -4123,7 +4123,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), args, "message:keywords:manage"); }.execute(FragmentKeywordManage.this, args, "message:keywords:manage");
} }
}) })
.setNeutralButton(R.string.title_add, new DialogInterface.OnClickListener() { .setNeutralButton(R.string.title_add, new DialogInterface.OnClickListener() {
@ -4186,7 +4186,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), args, "message:keyword:add"); }.execute(FragmentKeywordAdd.this, args, "message:keyword:add");
} }
} }
}).create(); }).create();

@ -496,7 +496,7 @@ public class FragmentAccount extends FragmentBase {
else else
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentAccount.this, args, "account:config"); }.execute(this, args, "account:config");
} }
private void onCheck() { private void onCheck() {
@ -693,7 +693,7 @@ public class FragmentAccount extends FragmentBase {
else else
showError(ex); showError(ex);
} }
}.execute(FragmentAccount.this, args, "account:check"); }.execute(this, args, "account:check");
} }
private void onSave(boolean should) { private void onSave(boolean should) {
@ -1121,7 +1121,7 @@ public class FragmentAccount extends FragmentBase {
else else
showError(ex); showError(ex);
} }
}.execute(FragmentAccount.this, args, "account:save"); }.execute(this, args, "account:save");
} }
private void showError(Throwable ex) { private void showError(Throwable ex) {
@ -1417,7 +1417,7 @@ public class FragmentAccount extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentAccount.this, args, "account:delete"); }.execute(this, args, "account:delete");
} }
private void setFolders(List<EntityFolder> _folders, EntityAccount account) { private void setFolders(List<EntityFolder> _folders, EntityAccount account) {

@ -262,7 +262,7 @@ public class FragmentAnswer extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentAnswer.this, args, "answer:delete"); }.execute(this, args, "answer:delete");
} }
public static class FragmentInfo extends FragmentDialogEx { public static class FragmentInfo extends FragmentDialogEx {

@ -650,7 +650,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentCompose.this, args, "compose:refdelete"); }.execute(this, args, "compose:refdelete");
} }
private void onReferenceEdit() { private void onReferenceEdit() {
@ -733,7 +733,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentCompose.this, args, "compose:refedit"); }.execute(this, args, "compose:refedit");
} }
private void onReferenceImages() { private void onReferenceImages() {
@ -1655,7 +1655,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getViewLifecycleOwner(), args, "compose:picked"); }.execute(this, args, "compose:picked");
} }
private void onAnswerSelected(Bundle args) { private void onAnswerSelected(Bundle args) {
@ -2946,7 +2946,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentCompose.this, args, "compose:show"); }.execute(this, args, "compose:show");
} }
private void showDraft(final EntityMessage draft) { private void showDraft(final EntityMessage draft) {
@ -3070,7 +3070,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentCompose.this, args, "compose:show"); }.execute(this, args, "compose:show");
} }
private Html.ImageGetter cidGetter = new Html.ImageGetter() { private Html.ImageGetter cidGetter = new Html.ImageGetter() {
@ -3473,7 +3473,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), new Bundle(), "compose:answer"); }.execute(this, new Bundle(), "compose:answer");
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_insert_template) .setTitle(R.string.title_insert_template)
@ -3552,15 +3552,13 @@ public class FragmentCompose extends FragmentBase {
long id = getArguments().getLong("id"); long id = getArguments().getLong("id");
boolean remind = getArguments().getBoolean("remind", false); boolean remind = getArguments().getBoolean("remind", false);
Context context = getContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int send_delayed = prefs.getInt("send_delayed", 0); int send_delayed = prefs.getInt("send_delayed", 0);
final int[] sendDelayedValues = context.getResources().getIntArray(R.array.sendDelayedValues); final int[] sendDelayedValues = getResources().getIntArray(R.array.sendDelayedValues);
final String[] sendDelayedNames = context.getResources().getStringArray(R.array.sendDelayedNames); final String[] sendDelayedNames = getResources().getStringArray(R.array.sendDelayedNames);
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_send, null); View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_send, null);
final TextView tvTo = dview.findViewById(R.id.tvTo); final TextView tvTo = dview.findViewById(R.id.tvTo);
final TextView tvVia = dview.findViewById(R.id.tvVia); final TextView tvVia = dview.findViewById(R.id.tvVia);
final CheckBox cbPlainOnly = dview.findViewById(R.id.cbPlainOnly); final CheckBox cbPlainOnly = dview.findViewById(R.id.cbPlainOnly);
@ -3574,8 +3572,8 @@ public class FragmentCompose extends FragmentBase {
tvSendAt.setText(null); tvSendAt.setText(null);
tvRemindAttachment.setVisibility(remind ? View.VISIBLE : View.GONE); tvRemindAttachment.setVisibility(remind ? View.VISIBLE : View.GONE);
DB db = DB.getInstance(context); DB db = DB.getInstance(getContext());
db.message().liveMessage(id).observe(getActivity(), new Observer<TupleMessageEx>() { db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer<TupleMessageEx>() {
@Override @Override
public void onChanged(TupleMessageEx draft) { public void onChanged(TupleMessageEx draft) {
int plus = (draft.cc == null ? 0 : draft.cc.length) + int plus = (draft.cc == null ? 0 : draft.cc.length) +
@ -3588,15 +3586,15 @@ public class FragmentCompose extends FragmentBase {
if (draft.ui_snoozed == null) { if (draft.ui_snoozed == null) {
if (send_delayed == 0) if (send_delayed == 0)
tvSendAt.setText(context.getString(R.string.title_now)); tvSendAt.setText(getString(R.string.title_now));
else else
for (int pos = 0; pos < sendDelayedValues.length; pos++) for (int pos = 0; pos < sendDelayedValues.length; pos++)
if (sendDelayedValues[pos] == send_delayed) { if (sendDelayedValues[pos] == send_delayed) {
tvSendAt.setText(context.getString(R.string.title_after, sendDelayedNames[pos])); tvSendAt.setText(getString(R.string.title_after, sendDelayedNames[pos]));
break; break;
} }
} else { } else {
DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.MEDIUM, SimpleDateFormat.SHORT); DateFormat DTF = Helper.getDateTimeInstance(getContext(), SimpleDateFormat.MEDIUM, SimpleDateFormat.SHORT);
DateFormat D = new SimpleDateFormat("E"); DateFormat D = new SimpleDateFormat("E");
tvSendAt.setText(D.format(draft.ui_snoozed) + " " + DTF.format(draft.ui_snoozed)); tvSendAt.setText(D.format(draft.ui_snoozed) + " " + DTF.format(draft.ui_snoozed));
} }
@ -3626,7 +3624,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(context, getActivity(), args, "compose:plain_only"); }.execute(FragmentDialogSend.this, args, "compose:plain_only");
} }
}); });
@ -3653,7 +3651,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(context, getActivity(), args, "compose:plain_only"); }.execute(FragmentDialogSend.this, args, "compose:encrypt");
} }
}); });
@ -3661,7 +3659,7 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("title", context.getString(R.string.title_send_at)); args.putString("title", getString(R.string.title_send_at));
args.putLong("id", id); args.putLong("id", id);
FragmentDialogDuration fragment = new FragmentDialogDuration(); FragmentDialogDuration fragment = new FragmentDialogDuration();
@ -3671,7 +3669,7 @@ public class FragmentCompose extends FragmentBase {
} }
}); });
return new AlertDialog.Builder(context) return new AlertDialog.Builder(getContext())
.setView(dview) .setView(dview)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
@ -3721,7 +3719,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(context, getActivity(), args, "compose:snooze"); }.execute(this, args, "compose:snooze");
} }
} }

@ -193,7 +193,7 @@ public class FragmentContacts extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), new Bundle(), "contacts:delete"); }.execute(FragmentDelete.this, new Bundle(), "contacts:delete");
} }
}) })
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)

@ -11,44 +11,75 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleRegistry;
import androidx.lifecycle.OnLifecycleEvent; import androidx.lifecycle.OnLifecycleEvent;
import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_CANCELED;
public class FragmentDialogEx extends DialogFragment { public class FragmentDialogEx extends DialogFragment {
private boolean once = false; private boolean once = false;
private LifecycleOwner owner;
private LifecycleRegistry registry;
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
owner = new LifecycleOwner() {
@NonNull
@Override
public Lifecycle getLifecycle() {
return registry;
}
};
registry = new LifecycleRegistry(owner);
registry.setCurrentState(Lifecycle.State.CREATED);
Log.i("Create " + this); Log.i("Create " + this);
} }
@Override @Override
public void onResume() { public void onResume() {
registry.setCurrentState(Lifecycle.State.RESUMED);
super.onResume(); super.onResume();
Log.i("Resume " + this); Log.i("Resume " + this);
} }
@Override @Override
public void onPause() { public void onPause() {
registry.setCurrentState(Lifecycle.State.STARTED);
super.onPause(); super.onPause();
Log.i("Pause " + this); Log.i("Pause " + this);
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
registry.setCurrentState(Lifecycle.State.DESTROYED);
super.onDestroy(); super.onDestroy();
Log.i("Destroy " + this); Log.i("Destroy " + this);
} }
@Override @Override
public void onStart() { public void onStart() {
registry.setCurrentState(Lifecycle.State.STARTED);
try { try {
super.onStart(); super.onStart();
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
Log.i("Start " + this);
}
@Override
public void onStop() {
registry.setCurrentState(Lifecycle.State.CREATED);
super.onStop();
Log.i("Stop " + this);
}
@NonNull
@Override
public LifecycleOwner getViewLifecycleOwner() {
return owner;
} }
@Override @Override
@ -73,15 +104,13 @@ public class FragmentDialogEx extends DialogFragment {
super.setTargetFragment(fragment, requestCode); super.setTargetFragment(fragment, requestCode);
Log.i("Set target " + this + " " + fragment); Log.i("Set target " + this + " " + fragment);
if (getView() != null) { fragment.getViewLifecycleOwner().getLifecycle().addObserver(new LifecycleObserver() {
fragment.getViewLifecycleOwner().getLifecycle().addObserver(new LifecycleObserver() { @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) public void onDestroy() {
public void onDestroy() { Log.i("Reset target " + FragmentDialogEx.this);
Log.i("Reset target " + FragmentDialogEx.this); FragmentDialogEx.super.setTargetFragment(null, requestCode);
FragmentDialogEx.super.setTargetFragment(null, requestCode); }
} });
});
}
} }
protected void sendResult(int result) { protected void sendResult(int result) {

@ -53,7 +53,7 @@ public class FragmentDialogFolder extends FragmentDialogEx {
LinearLayoutManager llm = new LinearLayoutManager(getContext()); LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvFolder.setLayoutManager(llm); rvFolder.setLayoutManager(llm);
final AdapterFolder adapter = new AdapterFolder(getContext(), getActivity(), final AdapterFolder adapter = new AdapterFolder(getContext(), getViewLifecycleOwner(),
account, false, new AdapterFolder.IFolderSelectedListener() { account, false, new AdapterFolder.IFolderSelectedListener() {
@Override @Override
public void onFolderSelected(TupleFolderEx folder) { public void onFolderSelected(TupleFolderEx folder) {
@ -106,7 +106,7 @@ public class FragmentDialogFolder extends FragmentDialogEx {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), args, "folder:select"); }.execute(this, args, "folder:select");
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
.setTitle(title) .setTitle(title)

@ -90,7 +90,7 @@ public class FragmentDialogMarkdown extends FragmentDialogEx {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), getArguments(), "markdown:read"); }.execute(this, getArguments(), "markdown:read");
return dialog; return dialog;
} }

@ -507,7 +507,7 @@ public class FragmentFolder extends FragmentBase {
else else
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentFolder.this, args, "folder:save"); }.execute(this, args, "folder:save");
} }
private void onDelete() { private void onDelete() {
@ -551,6 +551,6 @@ public class FragmentFolder extends FragmentBase {
else else
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentFolder.this, args, "folder:delete"); }.execute(this, args, "folder:delete");
} }
} }

@ -508,7 +508,7 @@ public class FragmentIdentity extends FragmentBase {
else else
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentIdentity.this, args, "identity:config"); }.execute(this, args, "identity:config");
} }
private void onSave(boolean should) { private void onSave(boolean should) {
@ -815,7 +815,7 @@ public class FragmentIdentity extends FragmentBase {
else else
showError(ex); showError(ex);
} }
}.execute(FragmentIdentity.this, args, "identity:save"); }.execute(this, args, "identity:save");
} }
private void showError(Throwable ex) { private void showError(Throwable ex) {
@ -1134,7 +1134,7 @@ public class FragmentIdentity extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentIdentity.this, args, "identity:delete"); }.execute(this, args, "identity:delete");
} }
private void onHtml(Bundle args) { private void onHtml(Bundle args) {

@ -304,6 +304,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
primary = args.getLong("primary", -1); primary = args.getLong("primary", -1);
connected = args.getBoolean("connected", false); connected = args.getBoolean("connected", false);
if (folder > 0 && type == null)
Log.e("Messages for folder without type");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swipenav = prefs.getBoolean("swipenav", true); swipenav = prefs.getBoolean("swipenav", true);
@ -4706,7 +4709,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), new Bundle(), "messages:accounts"); }.execute(this, new Bundle(), "messages:accounts");
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
.setAdapter(adapter, new DialogInterface.OnClickListener() { .setAdapter(adapter, new DialogInterface.OnClickListener() {

@ -154,7 +154,7 @@ public class FragmentOperations extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), new Bundle(), "operations:delete"); }.execute(DialogDelete.this, new Bundle(), "operations:delete");
} }
}) })
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)

@ -220,8 +220,7 @@ public class FragmentOrder extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getViewLifecycleOwner(), args, "order:set"); }.execute(this, args, "order:set");
} }
private ItemTouchHelper.Callback touchHelper = new ItemTouchHelper.Callback() { private ItemTouchHelper.Callback touchHelper = new ItemTouchHelper.Callback() {

@ -481,7 +481,7 @@ public class FragmentQuickSetup extends FragmentBase {
}); });
} }
}.execute(FragmentQuickSetup.this, args, "setup:quick"); }.execute(this, args, "setup:quick");
} }
@Override @Override

@ -577,7 +577,7 @@ public class FragmentRule extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentRule.this, args, "rule:delete"); }.execute(this, args, "rule:delete");
} }
private void onScheduleStart(Intent data) { private void onScheduleStart(Intent data) {
@ -724,7 +724,7 @@ public class FragmentRule extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(FragmentRule.this, rargs, "rule:get"); }.execute(this, rargs, "rule:get");
} }
private void showActionParameters(int type) { private void showActionParameters(int type) {
@ -1043,7 +1043,7 @@ public class FragmentRule extends FragmentBase {
LinearLayoutManager llm = new LinearLayoutManager(getContext()); LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvMessage.setLayoutManager(llm); rvMessage.setLayoutManager(llm);
final AdapterRuleMatch adapter = new AdapterRuleMatch(getContext(), getActivity()); final AdapterRuleMatch adapter = new AdapterRuleMatch(getContext(), getViewLifecycleOwner());
rvMessage.setAdapter(adapter); rvMessage.setAdapter(adapter);
tvNoMessages.setVisibility(View.GONE); tvNoMessages.setVisibility(View.GONE);
@ -1093,7 +1093,7 @@ public class FragmentRule extends FragmentBase {
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex); Helper.unexpectedError(getFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), args, "rule:check"); }.execute(this, args, "rule:check");
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_rule_matched) .setTitle(R.string.title_rule_matched)

@ -507,7 +507,7 @@ public class Helper {
else else
ToastEx.makeText(context, ex.toString(), Toast.LENGTH_LONG).show(); ToastEx.makeText(context, ex.toString(), Toast.LENGTH_LONG).show();
} }
}.execute(context, getActivity(), new Bundle(), "error:unexpected"); }.execute(FragmentDialogUnexpected.this, new Bundle(), "error:unexpected");
} }
}) })
.create(); .create();

Loading…
Cancel
Save