summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2011-11-11 07:59:30 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-11 07:59:30 -0800
commit944f4a5584504d1eecb25107d54a55c48e9a2290 (patch)
treebd311257d72115a49acd921d74a7448df4275357 /src
parentcb5679ca3e32e9020b5877f53d53fa91c1895de6 (diff)
parent447399928346f0f2a826423511cb241cd89db407 (diff)
downloadLegacyCamera-944f4a5584504d1eecb25107d54a55c48e9a2290.zip
LegacyCamera-944f4a5584504d1eecb25107d54a55c48e9a2290.tar.gz
LegacyCamera-944f4a5584504d1eecb25107d54a55c48e9a2290.tar.bz2
Merge "Fix 5603781: The pressed state of close icon does not disappear." into ics-mr1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/ui/SecondLevelIndicatorControlBar.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java
index bc29d88..c1b9b2f 100644
--- a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java
+++ b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java
@@ -106,23 +106,31 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements
if (x > width) x = width;
int index = getTouchViewIndex((int) x, width);
- View b = getChildAt(index);
- if (b == null) return true;
- dispatchRelativeTouchEvent(b, event);
+
+ // Cancel the previous target if we moved out of it
if ((mSelectedIndex != -1) && (index != mSelectedIndex)) {
- View v = getChildAt(mSelectedIndex);
- if (v instanceof AbstractIndicatorButton) {
- AbstractIndicatorButton c = (AbstractIndicatorButton) v;
- event.setAction(MotionEvent.ACTION_CANCEL);
- dispatchRelativeTouchEvent(c, event);
- c.dismissPopup();
- }
+ View p = getChildAt(mSelectedIndex);
+
+ int oldAction = event.getAction();
+ event.setAction(MotionEvent.ACTION_CANCEL);
+ dispatchRelativeTouchEvent(p, event);
+ event.setAction(oldAction);
- if (action == MotionEvent.ACTION_MOVE) {
- event.setAction(MotionEvent.ACTION_DOWN);
- dispatchRelativeTouchEvent(b, event);
+ if (p instanceof AbstractIndicatorButton) {
+ AbstractIndicatorButton b = (AbstractIndicatorButton) p;
+ b.dismissPopup();
}
}
+
+ // Send event to the target
+ View v = getChildAt(index);
+ if (v == null) return true;
+
+ // Change MOVE to DOWN if this is a new target
+ if (mSelectedIndex != index && action == MotionEvent.ACTION_MOVE) {
+ event.setAction(MotionEvent.ACTION_DOWN);
+ }
+ dispatchRelativeTouchEvent(v, event);
mSelectedIndex = index;
return true;
}