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

Commit cb22900b authored by Sven Dawitz's avatar Sven Dawitz Committed by Michael Bestas
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.

Change-Id: I474d5ba4753e7d6cd21a916f2e2aaf8ddb224fd2
parent f54744a5
Loading
Loading
Loading
Loading
+12 −21
Original line number Original line Diff line number Diff line
@@ -380,7 +380,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    }
    }


    private void createProfileDialog() {
    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();
        final Profile[] profiles = profileManager.getProfiles();
        UUID activeProfile = profileManager.getActiveProfile().getUuid();
        UUID activeProfile = profileManager.getActiveProfile().getUuid();
@@ -399,24 +400,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac


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


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


        abstract public void onPress();
        abstract public void onPress();


        public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
        public View create(
                Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
            View v = inflater.inflate(R.layout.global_actions_item, parent, false);
            View v = inflater.inflate(R.layout.global_actions_item, parent, false);


            ImageView icon = (ImageView) v.findViewById(R.id.icon);
            ImageView icon = (ImageView) v.findViewById(R.id.icon);