summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2015-05-18 13:20:52 -0700
committer Alan Viverette <alanv@google.com> 2015-05-18 13:20:52 -0700
commita19ab347be2ca9c7cac6a1943a658063b3571d92 (patch)
treec6df5291ad6d5d1b8a4b2ce0fe6d91e4e2c2dd00
parentbeda8613ad7bc01affa17857faed04d9589db34c (diff)
Update cached child enabled state before selector state
We reference the cached enabled state from the selector state update code, so we need to ensure it is accurate first. Bug: 20121334 Change-Id: I5859e9e8c594e1ba64ec9f001f47c2a6ea311c4f
-rw-r--r--core/java/android/widget/AbsListView.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 9903b7e88ed9..e963f53dd915 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2568,7 +2568,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
selectorRect.right += mSelectionRightPadding;
selectorRect.bottom += mSelectionBottomPadding;
- // Update the selector drawable.
+ // Update the child enabled state prior to updating the selector.
+ final boolean isChildViewEnabled = sel.isEnabled();
+ if (mIsChildViewEnabled != isChildViewEnabled) {
+ mIsChildViewEnabled = isChildViewEnabled;
+ }
+
+ // Update the selector drawable's state and position.
final Drawable selector = mSelector;
if (selector != null) {
if (positionChanged) {
@@ -2588,14 +2594,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
selector.setHotspot(x, y);
}
}
-
- final boolean isChildViewEnabled = mIsChildViewEnabled;
- if (sel.isEnabled() != isChildViewEnabled) {
- mIsChildViewEnabled = !isChildViewEnabled;
- if (getSelectedItemPosition() != INVALID_POSITION) {
- refreshDrawableState();
- }
- }
}
@Override