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

Commit ef99a8be authored by Roman Birg's avatar Roman Birg
Browse files

Settings: add delete confirmation dialog for profiles



Change-Id: I22744bb55e2800e6ad3d7d6a164df6e5024e15ca
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 6b116f47
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@
    <string name="profile_unknown_nfc_tag">Unknown profile</string>
    <string name="profile_add_nfc_text">This NFC tag refers to an unknown profile. Attaching this NFC tag to an existing profile will allow for selecting the profile in the future.</string>
    <string name="profile_select">Select profile</string>
    <string name="profile_remove_dialog_message">Remove profile %1$s?</string>

    <!-- Add Profile -->
    <string name="add_profile_dialog_title">Create new profile</string>
+16 −2
Original line number Diff line number Diff line
@@ -198,8 +198,7 @@ public class SetupActionsFragment extends SettingsPreferenceFragment
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case MENU_REMOVE:
                mProfileManager.removeProfile(mProfile);
                finishFragment();
                requestRemoveProfileDialog();
                return true;
        }
        return super.onOptionsItemSelected(item);
@@ -250,6 +249,21 @@ public class SetupActionsFragment extends SettingsPreferenceFragment
                : R.string.profile_setup_actions_title_config);
    }

    private void requestRemoveProfileDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(getString(R.string.profile_remove_dialog_message, mProfile.getName()));
        builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                mProfileManager.removeProfile(mProfile);
                finishFragment();
            }
        });
        builder.setNegativeButton(R.string.no, null);
        builder.show();
    }

    private void requestLockscreenModeDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        final String[] lockEntries =