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

Commit 829de65b authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Select all for text shown as an icon on smaller screens"

parents 703d3279 5e9af2dd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -201,6 +201,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
@@ -8787,10 +8787,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