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

Commit 5e9af2dd authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Select all for text shown as an icon on smaller screens

Text has been removed to leave space for 4 icons, that should fit
even in portrait mode.

Note: requires a definitive selectAll icon from designers.

Change-Id: I65547527e9ca872aa8888467f31fa7de9653fa77
parent 39a8dc4a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ package android {
    field public static final int actionModeCopyDrawable = 16843538; // 0x1010312
    field public static final int actionModeCutDrawable = 16843537; // 0x1010311
    field public static final int actionModePasteDrawable = 16843539; // 0x1010313
    field public static final int actionModeSelectAllDrawable = 16843641; // 0x1010379
    field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
    field public static final int actionViewClass = 16843516; // 0x10102fc
    field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
+13 −1
Original line number Diff line number Diff line
@@ -8785,10 +8785,22 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            TypedArray styledAttributes = mContext.obtainStyledAttributes(R.styleable.Theme);

            mode.setTitle(mContext.getString(com.android.internal.R.string.textSelectionCABTitle));
            boolean allowText = getContext().getResources().getBoolean(
                    com.android.internal.R.bool.allow_action_menu_item_text_with_icon);

            mode.setTitle(allowText ? 
                    mContext.getString(com.android.internal.R.string.textSelectionCABTitle) : null);
            mode.setSubtitle(null);

            int selectAllIconId = 0; // No icon by default
            if (!allowText) {
                // Provide an icon, text will not be displayed on smaller screens.
                selectAllIconId = styledAttributes.getResourceId(
                        R.styleable.Theme_actionModeSelectAllDrawable, 0);
            }

            menu.add(0, ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll).
                    setIcon(selectAllIconId).
                    setAlphabeticShortcut('a').
                    setShowAsAction(
                            MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+709 B
Loading image diff...
+945 B
Loading image diff...
+586 B
Loading image diff...
Loading