diff options
| author | Andrei Stingaceanu <stg@google.com> | 2015-05-06 13:25:19 +0100 |
|---|---|---|
| committer | Andrei Stingaceanu <stg@google.com> | 2015-05-07 10:18:22 +0100 |
| commit | 77b9c388c9e1d34fedcd08c5c227fb072bd06786 (patch) | |
| tree | d9bfdb3f3abd7f4983ded08ee52546533518a9e0 /core/java/android/widget | |
| parent | fbb34dd8df7bc89ae972c545130e76c5bbb4176e (diff) | |
| download | frameworks_base-77b9c388c9e1d34fedcd08c5c227fb072bd06786.zip frameworks_base-77b9c388c9e1d34fedcd08c5c227fb072bd06786.tar.gz frameworks_base-77b9c388c9e1d34fedcd08c5c227fb072bd06786.tar.bz2 | |
Fix floating toolbar popping frequently after Replace/Copy
Invalidate the LAST_CUT_OR_COPY_TIME when text changes. Reflect
this in the variable names. Fixes the selection mode without
selection (PASTE|SELECT_ALL) toggling when changing text in the
15 sec window this mode has to show.
Bug: 20440790
Change-Id: Ie7ea55916e1633ed4981654c6d80168b1247bc35
Diffstat (limited to 'core/java/android/widget')
| -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(); } /** |
