summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2014-10-01 23:43:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-10-01 23:43:03 +0000
commita5ecdbb1a82f93a4feeefb2a905cb3881ab3bc3a (patch)
tree531b62cb042c7f07169d8c31c516d092f408dd74
parent84402777841a1e884d867ff1ccff301b3a49259a (diff)
parent62a8b61f929315c82448888a7addb0853f62293e (diff)
Merge "Manage pressed state during drag-to-open" into lmp-mr1-dev
-rw-r--r--core/java/android/widget/ListPopupWindow.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index 3c186e3b9d2b..9f540c020139 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1639,6 +1639,11 @@ public class ListPopupWindow {
setPressed(false);
updateSelectorState();
+ final View motionView = getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ motionView.setPressed(false);
+ }
+
if (mClickAnimation != null) {
mClickAnimation.cancel();
mClickAnimation = null;
@@ -1653,6 +1658,15 @@ public class ListPopupWindow {
setPressed(true);
layoutChildren();
+ // Manage the pressed view based on motion position. This allows us to
+ // play nicely with actual touch and scroll events.
+ final View motionView = getChildAt(mMotionPosition - mFirstPosition);
+ if (motionView != null) {
+ motionView.setPressed(false);
+ }
+ mMotionPosition = position;
+ child.setPressed(true);
+
// Ensure that keyboard focus starts from the last touched position.
setSelectedPositionInt(position);
positionSelectorLikeTouch(position, child, x, y);