Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b995e2c authored by Katherine Kuan's avatar Katherine Kuan
Browse files

Fix InstantiationException in GroupDeletionDialogFragment

Fragments should have a public and empty constructor, so
make endActivity parameter be part of the dialog arguments.

Bug: 5133793
Change-Id: I58cd1745c07f57073fb4e4029b7a5f68456426f4
parent 735f2fa8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -32,19 +32,15 @@ public class GroupDeletionDialogFragment extends DialogFragment {

    private static final String ARG_GROUP_ID = "groupId";
    private static final String ARG_LABEL = "label";

    private boolean mEndActivity;

    public GroupDeletionDialogFragment(boolean endActivity) {
        mEndActivity = endActivity;
    }
    private static final String ARG_SHOULD_END_ACTIVITY = "endActivity";

    public static void show(FragmentManager fragmentManager, long groupId, String label,
            boolean endActivity) {
        GroupDeletionDialogFragment dialog = new GroupDeletionDialogFragment(endActivity);
        GroupDeletionDialogFragment dialog = new GroupDeletionDialogFragment();
        Bundle args = new Bundle();
        args.putLong(ARG_GROUP_ID, groupId);
        args.putString(ARG_LABEL, label);
        args.putBoolean(ARG_SHOULD_END_ACTIVITY, endActivity);
        dialog.setArguments(args);
        dialog.show(fragmentManager, "deleteGroup");
    }
@@ -76,8 +72,12 @@ public class GroupDeletionDialogFragment extends DialogFragment {

        getActivity().startService(ContactSaveService.createGroupDeletionIntent(
                getActivity(), groupId));
        if (mEndActivity) {
        if (shouldEndActivity()) {
            getActivity().finish();
        }
    }

    private boolean shouldEndActivity() {
        return getArguments().getBoolean(ARG_SHOULD_END_ACTIVITY);
    }
}