Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,7 @@ package android { field public static final int allowParallelSyncs = 16843570; // 0x1010332 field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 field public static final int allowUndo = 16844006; // 0x10104e6 field public static final int alpha = 16843551; // 0x101031f field public static final int alphabeticShortcut = 16843235; // 0x10101e3 field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,7 @@ package android { field public static final int allowParallelSyncs = 16843570; // 0x1010332 field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 field public static final int allowUndo = 16844006; // 0x10104e6 field public static final int alpha = 16843551; // 0x101031f field public static final int alphabeticShortcut = 16843235; // 0x10101e3 field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef core/java/android/widget/Editor.java +15 −2 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class Editor { private final UndoManager mUndoManager = new UndoManager(); private UndoOwner mUndoOwner = mUndoManager.getOwner(UNDO_OWNER_TAG, this); final InputFilter mUndoInputFilter = new UndoInputFilter(this); boolean mAllowUndo = true; // Cursor Controllers. InsertionPointCursorController mInsertionPointCursorController; Loading Loading @@ -243,20 +244,26 @@ public class Editor { boolean canUndo() { UndoOwner[] owners = { mUndoOwner }; return mUndoManager.countUndos(owners) > 0; return mAllowUndo && mUndoManager.countUndos(owners) > 0; } boolean canRedo() { UndoOwner[] owners = { mUndoOwner }; return mUndoManager.countRedos(owners) > 0; return mAllowUndo && mUndoManager.countRedos(owners) > 0; } void undo() { if (!mAllowUndo) { return; } UndoOwner[] owners = { mUndoOwner }; mUndoManager.undo(owners, 1); // Undo 1 action. } void redo() { if (!mAllowUndo) { return; } UndoOwner[] owners = { mUndoOwner }; mUndoManager.redo(owners, 1); // Redo 1 action. } Loading Loading @@ -4223,6 +4230,12 @@ public class Editor { Log.d(TAG, "filter: source=" + source + " (" + start + "-" + end + ") " + "dest=" + dest + " (" + dstart + "-" + dend + ")"); } if (!mEditor.mAllowUndo) { if (DEBUG_UNDO) Log.d(TAG, "filter: undo is disabled"); return null; } final UndoManager um = mEditor.mUndoManager; if (um.isInUndo()) { if (DEBUG_UNDO) Log.d(TAG, "filter: skipping, currently performing undo/redo"); Loading core/java/android/widget/TextView.java +5 −0 Original line number Diff line number Diff line Loading @@ -1055,6 +1055,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener inputType = a.getInt(attr, EditorInfo.TYPE_NULL); break; case com.android.internal.R.styleable.TextView_allowUndo: createEditorIfNeeded(); mEditor.mAllowUndo = a.getBoolean(attr, true); break; case com.android.internal.R.styleable.TextView_imeOptions: createEditorIfNeeded(); mEditor.createInputContentTypeIfNeeded(); Loading core/res/res/values/attrs.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4215,6 +4215,8 @@ <enum name="marquee_forever" value="-1" /> </attr> <attr name="inputType" /> <!-- Whether undo should be allowed for editable text. Defaults to true. --> <attr name="allowUndo" format="boolean" /> <attr name="imeOptions" /> <!-- An addition content type description to supply to the input method attached to the text view, which is private to the Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,7 @@ package android { field public static final int allowParallelSyncs = 16843570; // 0x1010332 field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 field public static final int allowUndo = 16844006; // 0x10104e6 field public static final int alpha = 16843551; // 0x101031f field public static final int alphabeticShortcut = 16843235; // 0x10101e3 field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,7 @@ package android { field public static final int allowParallelSyncs = 16843570; // 0x1010332 field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 field public static final int allowUndo = 16844006; // 0x10104e6 field public static final int alpha = 16843551; // 0x101031f field public static final int alphabeticShortcut = 16843235; // 0x10101e3 field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef
core/java/android/widget/Editor.java +15 −2 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class Editor { private final UndoManager mUndoManager = new UndoManager(); private UndoOwner mUndoOwner = mUndoManager.getOwner(UNDO_OWNER_TAG, this); final InputFilter mUndoInputFilter = new UndoInputFilter(this); boolean mAllowUndo = true; // Cursor Controllers. InsertionPointCursorController mInsertionPointCursorController; Loading Loading @@ -243,20 +244,26 @@ public class Editor { boolean canUndo() { UndoOwner[] owners = { mUndoOwner }; return mUndoManager.countUndos(owners) > 0; return mAllowUndo && mUndoManager.countUndos(owners) > 0; } boolean canRedo() { UndoOwner[] owners = { mUndoOwner }; return mUndoManager.countRedos(owners) > 0; return mAllowUndo && mUndoManager.countRedos(owners) > 0; } void undo() { if (!mAllowUndo) { return; } UndoOwner[] owners = { mUndoOwner }; mUndoManager.undo(owners, 1); // Undo 1 action. } void redo() { if (!mAllowUndo) { return; } UndoOwner[] owners = { mUndoOwner }; mUndoManager.redo(owners, 1); // Redo 1 action. } Loading Loading @@ -4223,6 +4230,12 @@ public class Editor { Log.d(TAG, "filter: source=" + source + " (" + start + "-" + end + ") " + "dest=" + dest + " (" + dstart + "-" + dend + ")"); } if (!mEditor.mAllowUndo) { if (DEBUG_UNDO) Log.d(TAG, "filter: undo is disabled"); return null; } final UndoManager um = mEditor.mUndoManager; if (um.isInUndo()) { if (DEBUG_UNDO) Log.d(TAG, "filter: skipping, currently performing undo/redo"); Loading
core/java/android/widget/TextView.java +5 −0 Original line number Diff line number Diff line Loading @@ -1055,6 +1055,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener inputType = a.getInt(attr, EditorInfo.TYPE_NULL); break; case com.android.internal.R.styleable.TextView_allowUndo: createEditorIfNeeded(); mEditor.mAllowUndo = a.getBoolean(attr, true); break; case com.android.internal.R.styleable.TextView_imeOptions: createEditorIfNeeded(); mEditor.createInputContentTypeIfNeeded(); Loading
core/res/res/values/attrs.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4215,6 +4215,8 @@ <enum name="marquee_forever" value="-1" /> </attr> <attr name="inputType" /> <!-- Whether undo should be allowed for editable text. Defaults to true. --> <attr name="allowUndo" format="boolean" /> <attr name="imeOptions" /> <!-- An addition content type description to supply to the input method attached to the text view, which is private to the Loading