summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragLayer.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-10-08 19:16:14 -0700
committerAdam Cohen <adamcohen@google.com>2013-10-08 19:17:12 -0700
commitb0f3d74815417acc3a9d3dce90cbf34b772847f0 (patch)
tree05a7409f57c6348c08baa12c453769810332789d /src/com/android/launcher3/DragLayer.java
parent47ec25f380688fc8786bc900308ac28106ccda9a (diff)
downloadandroid_packages_apps_Trebuchet-b0f3d74815417acc3a9d3dce90cbf34b772847f0.tar.gz
android_packages_apps_Trebuchet-b0f3d74815417acc3a9d3dce90cbf34b772847f0.tar.bz2
android_packages_apps_Trebuchet-b0f3d74815417acc3a9d3dce90cbf34b772847f0.zip
Fix widget longpress issue where longpress misfires (issue 10988288)
Change-Id: Ibe4aa4d92a1b419b63ff3cf61164c637fb579221
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r--src/com/android/launcher3/DragLayer.java32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 3c955cbe3..89f8275bf 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -69,6 +69,8 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
public static final int ANIMATION_END_FADE_OUT = 1;
public static final int ANIMATION_END_REMAIN_VISIBLE = 2;
+ private TouchCompleteListener mTouchCompleteListener;
+
private final Rect mInsets = new Rect();
/**
@@ -173,10 +175,17 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ int action = ev.getAction();
+
+ if (action == MotionEvent.ACTION_DOWN) {
if (handleTouchDown(ev, true)) {
return true;
}
+ } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
+ if (mTouchCompleteListener != null) {
+ mTouchCompleteListener.onTouchComplete();
+ }
+ mTouchCompleteListener = null;
}
clearAllResizeFrames();
return mDragController.onInterceptTouchEvent(ev);
@@ -278,12 +287,15 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
int x = (int) ev.getX();
int y = (int) ev.getY();
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (handleTouchDown(ev, false)) {
- return true;
- }
+ if (action == MotionEvent.ACTION_DOWN) {
+ if (handleTouchDown(ev, false)) {
+ return true;
+ }
+ } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
+ if (mTouchCompleteListener != null) {
+ mTouchCompleteListener.onTouchComplete();
}
+ mTouchCompleteListener = null;
}
if (mCurrentResizeFrame != null) {
@@ -818,4 +830,12 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
}
}
}
+
+ public void setTouchCompleteListener(TouchCompleteListener listener) {
+ mTouchCompleteListener = listener;
+ }
+
+ public interface TouchCompleteListener {
+ public void onTouchComplete();
+ }
}