diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/widget/Editor.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 8d35b83..46427ee 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -3739,9 +3739,9 @@ public class Editor { public void show() { super.show(); - final long durationSinceCutOrCopy = - SystemClock.uptimeMillis() - TextView.LAST_CUT_OR_COPY_TIME; - if (durationSinceCutOrCopy < RECENT_CUT_COPY_DURATION) { + final long durationSinceLastCutCopyOrTextChanged = + SystemClock.uptimeMillis() - TextView.sLastCutCopyOrTextChangedTime; + if (durationSinceLastCutCopyOrTextChanged < RECENT_CUT_COPY_DURATION) { startSelectionActionModeWithoutSelection(); } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 449173f..d1ed5dc 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -290,8 +290,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // New state used to change background based on whether this TextView is multiline. private static final int[] MULTILINE_STATE_SET = { R.attr.state_multiline }; - // System wide time for last cut or copy action. - static long LAST_CUT_OR_COPY_TIME; + // System wide time for last cut, copy or text changed action. + static long sLastCutCopyOrTextChangedTime; /** * @hide @@ -7966,6 +7966,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener * through a thunk. */ void sendAfterTextChanged(Editable text) { + sLastCutCopyOrTextChangedTime = 0; + if (mListeners != null) { final ArrayList<TextWatcher> list = mListeners; final int count = list.size(); @@ -9246,7 +9248,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } stopSelectionActionMode(); - LAST_CUT_OR_COPY_TIME = 0; + sLastCutCopyOrTextChangedTime = 0; } } @@ -9266,7 +9268,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener ClipboardManager clipboard = (ClipboardManager) getContext(). getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(clip); - LAST_CUT_OR_COPY_TIME = SystemClock.uptimeMillis(); + sLastCutCopyOrTextChangedTime = SystemClock.uptimeMillis(); } /** |
