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

Commit 7c2d2052 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Don't obtain attributes for the whole theme when looking for selection mode drawables."

parents d87448f7 d2b58940
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -10248,7 +10248,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            TypedArray styledAttributes = mContext.obtainStyledAttributes(R.styleable.Theme);
            TypedArray styledAttributes = mContext.obtainStyledAttributes(
                    com.android.internal.R.styleable.SelectionModeDrawables);

            boolean allowText = getContext().getResources().getBoolean(
                    com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon);
@@ -10261,7 +10262,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (!allowText) {
                // Provide an icon, text will not be displayed on smaller screens.
                selectAllIconId = styledAttributes.getResourceId(
                        R.styleable.Theme_actionModeSelectAllDrawable, 0);
                        R.styleable.SelectionModeDrawables_actionModeSelectAllDrawable, 0);
            }

            menu.add(0, ID_SELECT_ALL, 0, com.android.internal.R.string.selectAll).
@@ -10273,7 +10274,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (canCut()) {
                menu.add(0, ID_CUT, 0, com.android.internal.R.string.cut).
                    setIcon(styledAttributes.getResourceId(
                            R.styleable.Theme_actionModeCutDrawable, 0)).
                            R.styleable.SelectionModeDrawables_actionModeCutDrawable, 0)).
                    setAlphabeticShortcut('x').
                    setShowAsAction(
                            MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
@@ -10282,7 +10283,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (canCopy()) {
                menu.add(0, ID_COPY, 0, com.android.internal.R.string.copy).
                    setIcon(styledAttributes.getResourceId(
                            R.styleable.Theme_actionModeCopyDrawable, 0)).
                            R.styleable.SelectionModeDrawables_actionModeCopyDrawable, 0)).
                    setAlphabeticShortcut('c').
                    setShowAsAction(
                            MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
@@ -10291,7 +10292,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (canPaste()) {
                menu.add(0, ID_PASTE, 0, com.android.internal.R.string.paste).
                        setIcon(styledAttributes.getResourceId(
                                R.styleable.Theme_actionModePasteDrawable, 0)).
                                R.styleable.SelectionModeDrawables_actionModePasteDrawable, 0)).
                        setAlphabeticShortcut('v').
                        setShowAsAction(
                                MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+6 −0
Original line number Diff line number Diff line
@@ -3181,6 +3181,12 @@
        <!-- Base text color, typeface, size, and style. -->
        <attr name="textAppearance" />
    </declare-styleable>
    <declare-styleable name="SelectionModeDrawables">
        <attr name="actionModeSelectAllDrawable" />
        <attr name="actionModeCutDrawable" />
        <attr name="actionModeCopyDrawable" />
        <attr name="actionModePasteDrawable" />
    </declare-styleable>
    <declare-styleable name="SuggestionSpan">
        <attr name="textUnderlineColor" />
        <attr name="textUnderlineThickness" />