diff options
author | Adam Powell <adamp@google.com> | 2012-02-03 19:00:49 -0800 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2012-02-17 16:40:24 -0800 |
commit | 539ee8716b4f81260bab2e9f3dc5d88d81c99985 (patch) | |
tree | 8019a11d8462118fd17bce538a22af5f2590f006 /core/java/android/view/ViewParent.java | |
parent | 6917e6550d2dc11ad3b794be08cc9caa53970d32 (diff) | |
download | frameworks_base-539ee8716b4f81260bab2e9f3dc5d88d81c99985.zip frameworks_base-539ee8716b4f81260bab2e9f3dc5d88d81c99985.tar.gz frameworks_base-539ee8716b4f81260bab2e9f3dc5d88d81c99985.tar.bz2 |
Add transient state tracking to Views
Transient state is temporary bookkeeping that Views need to perform
that the app should not need to be aware of. Examples include text
selection regions and animation state.
Transient state is a problem for AdapterViews like ListView that do
view recycling. Unless the app takes responsibility for tracking and
restoring transient state as if it were a part of the adapter's data
set, it cannot correctly recycle views. Selections disappear when an
EditText is scrolled out of sight and animations seem to play on the
wrong views.
Views can now flag themselves as having transient state. (As the name
implies, this should be a temporary condition.) If a ViewGroup
contains a child with transient state, that ViewGroup also has
transient state.
AbsListView's recycler now tracks views with transient state
separately. Views with transient state will be retained, and until a
data set change occurs the same view will be reused for that position
instead of calling the adapter's getView() method.
The API to set and check transient state is currently hidden.
Change-Id: Idfd8eaac2c548337686d8d9f98fda4c64be5b8a0
Diffstat (limited to 'core/java/android/view/ViewParent.java')
-rw-r--r-- | core/java/android/view/ViewParent.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java index 873d4bb..8395f1b 100644 --- a/core/java/android/view/ViewParent.java +++ b/core/java/android/view/ViewParent.java @@ -261,4 +261,14 @@ public interface ViewParent { * @return True if the event was sent. */ public boolean requestSendAccessibilityEvent(View child, AccessibilityEvent event); + + /** + * Called when a child view now has or no longer is tracking transient state. + * + * @param child Child view whose state has changed + * @param hasTransientState true if this child has transient state + * + * @hide + */ + public void childHasTransientStateChanged(View child, boolean hasTransientState); } |