OSDN Git Service

DO NOT MERGE: ListView transient state fix
authorChet Haase <chet@google.com>
Tue, 26 Feb 2013 23:12:13 +0000 (16:12 -0700)
committerChet Haase <chet@google.com>
Mon, 18 Mar 2013 17:06:27 +0000 (10:06 -0700)
commit728713258ffef4df053b85e0a3488334cbcba24c
treea5e8eecdaccb1058a519f3a17bccfafa1091d9e9
parent952e4805f72c0835bbd158051fc56dc64d1d660d
DO NOT MERGE: ListView transient state fix

ListView child views with transientState (setHasTransientState(true)) are not
handled correctly when the data set changes, such as when an item is added
or removed. The problem is that the transient views are cached by their
position, but this position is out of sync between the ListView and the adapter
until the ListView layout process is complete.

A better way, which unfortunately only works on ListViews with stable IDs, is
to cache the views by their itemID instead, and to use that ID to determine when
and where to reuse/retrieve a transient view during the ListView layout.

Issue #8254775 View.setHasTransient state has side-effects when deleting content in ListView

Change-Id: I2fc25e71ed6655af30b9c3f47fdf014e9b667616
core/java/android/view/View.java
core/java/android/widget/AbsListView.java