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

Commit 5bab242a authored by Sven Dawitz's avatar Sven Dawitz Committed by Ricardo Cerqueira
Browse files

Changed profile selection to single-tap action

The behavior taken from reboot (choose action, select okay) was
inappropriate for profile selection, which has no big impact at all.

so now, simply selecting a new profile will toggle the action and close the dialog.

this patch is needed for the power menu qs tile (WiP)

Patchset 2: Remove cancel button and title to stay consistent with power
menu

Change-Id: I474d5ba4753e7d6cd21a916f2e2aaf8ddb224fd2
parent b8d3bbf4
Loading
Loading
Loading
Loading
+5 −16
Original line number Diff line number Diff line
@@ -95,24 +95,13 @@ public class ProfileTile extends QuickSettingsTile {

        final AlertDialog.Builder ab = new AlertDialog.Builder(mContext);

        AlertDialog dialog = ab
                .setTitle(R.string.quick_settings_profile_label)
                .setSingleChoiceItems(names, checkedItem, new DialogInterface.OnClickListener() {
        AlertDialog dialog = ab.setSingleChoiceItems(names, checkedItem,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        if (which < 0)
                            return;
                        mChosenProfile = profiles[which];
                    }
                })
                .setPositiveButton(com.android.internal.R.string.yes,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                        profileManager.setActiveProfile(mChosenProfile.getUuid());
                            }
                        })
                .setNegativeButton(com.android.internal.R.string.no,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                }).create();
+16 −26
Original line number Diff line number Diff line
@@ -504,7 +504,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    }

    private void createProfileDialog() {
        final ProfileManager profileManager = (ProfileManager)mContext.getSystemService(Context.PROFILE_SERVICE);
        final ProfileManager profileManager = (ProfileManager) mContext
                .getSystemService(Context.PROFILE_SERVICE);

        final Profile[] profiles = profileManager.getProfiles();
        UUID activeProfile = profileManager.getActiveProfile().getUuid();
@@ -523,24 +524,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac

        final AlertDialog.Builder ab = new AlertDialog.Builder(getUiContext());

        AlertDialog dialog = ab
                .setTitle(R.string.global_action_choose_profile)
                .setSingleChoiceItems(names, checkedItem, new DialogInterface.OnClickListener() {
        AlertDialog dialog = ab.setSingleChoiceItems(names, checkedItem,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        if (which < 0)
                            return;
                        mChosenProfile = profiles[which];
                    }
                })
                .setPositiveButton(com.android.internal.R.string.yes,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                        profileManager.setActiveProfile(mChosenProfile.getUuid());
                            }
                        })
                .setNegativeButton(com.android.internal.R.string.no,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                }).create();