diff options
| author | Adam Powell <adamp@google.com> | 2012-05-11 10:28:38 -0700 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2012-05-11 14:26:17 -0700 |
| commit | 057a585fba01d92c38f27a8c080622dfd0c6f556 (patch) | |
| tree | 5dec02f7ff799ede24f808d15a6a0c0bf8dd74bf /core/java/android/widget/TextView.java | |
| parent | d303dd3da2af272d0beaac956a12e145b8386f45 (diff) | |
Automatic persistent text selection for ListViews
Use View transient state tracking to allow selection to persist across
ListView-style item view recycling.
Fix some bugs with transient state tracking.
Bug 6110122
Change-Id: Ic084b8fc2289bff718b19478a37ce64459b3ed4c
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 098a034b2e64..56eca01fb00b 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -7257,10 +7257,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // usually because this instance is an editable field in a list if (!mDispatchTemporaryDetach) mTemporaryDetach = true; - // Because of View recycling in ListView, there is no easy way to know when a TextView with - // selection becomes visible again. Until a better solution is found, stop text selection - // mode (if any) as soon as this TextView is recycled. - if (mEditor != null) mEditor.hideControllers(); + // Tell the editor that we are temporarily detached. It can use this to preserve + // selection state as needed. + if (mEditor != null) mEditor.mTemporaryDetach = true; } @Override @@ -7269,6 +7268,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // Only track when onStartTemporaryDetach() is called directly, // usually because this instance is an editable field in a list if (!mDispatchTemporaryDetach) mTemporaryDetach = false; + if (mEditor != null) mEditor.mTemporaryDetach = false; } @Override |
