Loading core/java/android/widget/Editor.java +20 −0 Original line number Diff line number Diff line Loading @@ -3193,47 +3193,66 @@ public class Editor { menuItemOrderPasteAsPlainText = 11; } final TypedArray a = mTextView.getContext().obtainStyledAttributes(new int[] { // TODO: Make Undo/Redo be public attribute. com.android.internal.R.attr.actionModeUndoDrawable, com.android.internal.R.attr.actionModeRedoDrawable, android.R.attr.actionModeCutDrawable, android.R.attr.actionModeCopyDrawable, android.R.attr.actionModePasteDrawable, android.R.attr.actionModeSelectAllDrawable, android.R.attr.actionModeShareDrawable, }); menu.add(CONTEXT_MENU_GROUP_UNDO_REDO, TextView.ID_UNDO, menuItemOrderUndo, com.android.internal.R.string.undo) .setAlphabeticShortcut('z') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(0)) .setEnabled(mTextView.canUndo()); menu.add(CONTEXT_MENU_GROUP_UNDO_REDO, TextView.ID_REDO, menuItemOrderRedo, com.android.internal.R.string.redo) .setAlphabeticShortcut('z', KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON) .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(1)) .setEnabled(mTextView.canRedo()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_CUT, menuItemOrderCut, com.android.internal.R.string.cut) .setAlphabeticShortcut('x') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(2)) .setEnabled(mTextView.canCut()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_COPY, menuItemOrderCopy, com.android.internal.R.string.copy) .setAlphabeticShortcut('c') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(3)) .setEnabled(mTextView.canCopy()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_PASTE, menuItemOrderPaste, com.android.internal.R.string.paste) .setAlphabeticShortcut('v') .setEnabled(mTextView.canPaste()) .setIcon(a.getDrawable(4)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_PASTE_AS_PLAIN_TEXT, menuItemOrderPasteAsPlainText, com.android.internal.R.string.paste_as_plain_text) .setAlphabeticShortcut('v', KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON) .setEnabled(mTextView.canPasteAsPlainText()) .setIcon(a.getDrawable(4)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_SELECT_ALL, menuItemOrderSelectAll, com.android.internal.R.string.selectAll) .setAlphabeticShortcut('a') .setEnabled(mTextView.canSelectAllText()) .setIcon(a.getDrawable(5)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_MISC, TextView.ID_SHARE, menuItemOrderShare, com.android.internal.R.string.share) .setEnabled(mTextView.canShare()) .setIcon(a.getDrawable(6)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_MISC, TextView.ID_AUTOFILL, menuItemOrderAutofill, android.R.string.autofill) Loading @@ -3241,6 +3260,7 @@ public class Editor { .setOnMenuItemClickListener(mOnContextMenuItemClickListener); mPreserveSelection = true; a.recycle(); // No-op for the old context menu because it doesn't have icons. adjustIconSpacing(menu); Loading core/res/res/drawable/ic_menu_redo_material.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M9.9,19Q7.475,19 5.738,17.425Q4,15.85 4,13.5Q4,11.15 5.738,9.575Q7.475,8 9.9,8H16.2L13.6,5.4L15,4L20,9L15,14L13.6,12.6L16.2,10H9.9Q8.325,10 7.163,11Q6,12 6,13.5Q6,15 7.163,16Q8.325,17 9.9,17H17V19Z"/> </vector> core/res/res/drawable/ic_menu_undo_material.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M14.1,19H7V17H14.1Q15.675,17 16.837,16Q18,15 18,13.5Q18,12 16.837,11Q15.675,10 14.1,10H7.8L10.4,12.6L9,14L4,9L9,4L10.4,5.4L7.8,8H14.1Q16.525,8 18.263,9.575Q20,11.15 20,13.5Q20,15.85 18.263,17.425Q16.525,19 14.1,19Z"/> </vector> core/res/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,10 @@ <attr name="actionModeFindDrawable" format="reference" /> <!-- Drawable to use for the Web Search action button in WebView selection action modes. --> <attr name="actionModeWebSearchDrawable" format="reference" /> <!-- Drawable to use for the Undo action button in WebView selection action modes. --> <attr name="actionModeUndoDrawable" format="reference" /> <!-- Drawable to use for the Redo action button in WebView selection action modes. --> <attr name="actionModeRedoDrawable" format="reference" /> <!-- PopupWindow style to use for action modes when showing as a window overlay. --> <attr name="actionModePopupWindowStyle" format="reference" /> Loading core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -5037,4 +5037,6 @@ <java-symbol name="materialColorSurfaceContainer" type="attr"/> <java-symbol name="materialColorSurfaceContainer" type="attr"/> <java-symbol type="attr" name="actionModeUndoDrawable" /> <java-symbol type="attr" name="actionModeRedoDrawable" /> </resources> Loading
core/java/android/widget/Editor.java +20 −0 Original line number Diff line number Diff line Loading @@ -3193,47 +3193,66 @@ public class Editor { menuItemOrderPasteAsPlainText = 11; } final TypedArray a = mTextView.getContext().obtainStyledAttributes(new int[] { // TODO: Make Undo/Redo be public attribute. com.android.internal.R.attr.actionModeUndoDrawable, com.android.internal.R.attr.actionModeRedoDrawable, android.R.attr.actionModeCutDrawable, android.R.attr.actionModeCopyDrawable, android.R.attr.actionModePasteDrawable, android.R.attr.actionModeSelectAllDrawable, android.R.attr.actionModeShareDrawable, }); menu.add(CONTEXT_MENU_GROUP_UNDO_REDO, TextView.ID_UNDO, menuItemOrderUndo, com.android.internal.R.string.undo) .setAlphabeticShortcut('z') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(0)) .setEnabled(mTextView.canUndo()); menu.add(CONTEXT_MENU_GROUP_UNDO_REDO, TextView.ID_REDO, menuItemOrderRedo, com.android.internal.R.string.redo) .setAlphabeticShortcut('z', KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON) .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(1)) .setEnabled(mTextView.canRedo()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_CUT, menuItemOrderCut, com.android.internal.R.string.cut) .setAlphabeticShortcut('x') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(2)) .setEnabled(mTextView.canCut()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_COPY, menuItemOrderCopy, com.android.internal.R.string.copy) .setAlphabeticShortcut('c') .setOnMenuItemClickListener(mOnContextMenuItemClickListener) .setIcon(a.getDrawable(3)) .setEnabled(mTextView.canCopy()); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_PASTE, menuItemOrderPaste, com.android.internal.R.string.paste) .setAlphabeticShortcut('v') .setEnabled(mTextView.canPaste()) .setIcon(a.getDrawable(4)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_PASTE_AS_PLAIN_TEXT, menuItemOrderPasteAsPlainText, com.android.internal.R.string.paste_as_plain_text) .setAlphabeticShortcut('v', KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON) .setEnabled(mTextView.canPasteAsPlainText()) .setIcon(a.getDrawable(4)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_CLIPBOARD, TextView.ID_SELECT_ALL, menuItemOrderSelectAll, com.android.internal.R.string.selectAll) .setAlphabeticShortcut('a') .setEnabled(mTextView.canSelectAllText()) .setIcon(a.getDrawable(5)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_MISC, TextView.ID_SHARE, menuItemOrderShare, com.android.internal.R.string.share) .setEnabled(mTextView.canShare()) .setIcon(a.getDrawable(6)) .setOnMenuItemClickListener(mOnContextMenuItemClickListener); menu.add(CONTEXT_MENU_GROUP_MISC, TextView.ID_AUTOFILL, menuItemOrderAutofill, android.R.string.autofill) Loading @@ -3241,6 +3260,7 @@ public class Editor { .setOnMenuItemClickListener(mOnContextMenuItemClickListener); mPreserveSelection = true; a.recycle(); // No-op for the old context menu because it doesn't have icons. adjustIconSpacing(menu); Loading
core/res/res/drawable/ic_menu_redo_material.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M9.9,19Q7.475,19 5.738,17.425Q4,15.85 4,13.5Q4,11.15 5.738,9.575Q7.475,8 9.9,8H16.2L13.6,5.4L15,4L20,9L15,14L13.6,12.6L16.2,10H9.9Q8.325,10 7.163,11Q6,12 6,13.5Q6,15 7.163,16Q8.325,17 9.9,17H17V19Z"/> </vector>
core/res/res/drawable/ic_menu_undo_material.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M14.1,19H7V17H14.1Q15.675,17 16.837,16Q18,15 18,13.5Q18,12 16.837,11Q15.675,10 14.1,10H7.8L10.4,12.6L9,14L4,9L9,4L10.4,5.4L7.8,8H14.1Q16.525,8 18.263,9.575Q20,11.15 20,13.5Q20,15.85 18.263,17.425Q16.525,19 14.1,19Z"/> </vector>
core/res/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,10 @@ <attr name="actionModeFindDrawable" format="reference" /> <!-- Drawable to use for the Web Search action button in WebView selection action modes. --> <attr name="actionModeWebSearchDrawable" format="reference" /> <!-- Drawable to use for the Undo action button in WebView selection action modes. --> <attr name="actionModeUndoDrawable" format="reference" /> <!-- Drawable to use for the Redo action button in WebView selection action modes. --> <attr name="actionModeRedoDrawable" format="reference" /> <!-- PopupWindow style to use for action modes when showing as a window overlay. --> <attr name="actionModePopupWindowStyle" format="reference" /> Loading
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -5037,4 +5037,6 @@ <java-symbol name="materialColorSurfaceContainer" type="attr"/> <java-symbol name="materialColorSurfaceContainer" type="attr"/> <java-symbol type="attr" name="actionModeUndoDrawable" /> <java-symbol type="attr" name="actionModeRedoDrawable" /> </resources>