diff options
author | Adam Cohen <adamcohen@google.com> | 2013-10-16 10:30:50 -0700 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-05 23:03:34 -0700 |
commit | 4db823eb5601e4817010a063457fdae479d3374c (patch) | |
tree | 06f8b354b35e3bdfb400e96b4a2e97aa27cde03a | |
parent | 8a6a85b913ec57b792bc4bcf850bf18433e602bf (diff) | |
download | android_packages_apps_Trebuchet-4db823eb5601e4817010a063457fdae479d3374c.tar.gz android_packages_apps_Trebuchet-4db823eb5601e4817010a063457fdae479d3374c.tar.bz2 android_packages_apps_Trebuchet-4db823eb5601e4817010a063457fdae479d3374c.zip |
Fix issue where you could trigger a click after long pressing a widget (issue 11186227)
Change-Id: I5a767ac6352f7efb4d3c6c2768c8d2aaaa913f3f
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java index 83aef1a2f..51a649a07 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java @@ -65,6 +65,12 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc } public boolean onInterceptTouchEvent(MotionEvent ev) { + // Just in case the previous long press hasn't been cleared, we make sure to start fresh + // on touch down. + if (ev.getAction() == MotionEvent.ACTION_DOWN) { + mLongPressHelper.cancelLongPress(); + } + // Consume any touch events for ourselves after longpress is triggered if (mLongPressHelper.hasPerformedLongPress()) { mLongPressHelper.cancelLongPress(); @@ -110,13 +116,15 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc @Override public void onTouchComplete() { - mLongPressHelper.cancelLongPress(); + if (!mLongPressHelper.hasPerformedLongPress()) { + // If a long press has been performed, we don't want to clear the record of that since + // we still may be receiving a touch up which we want to intercept + mLongPressHelper.cancelLongPress(); + } } @Override public int getDescendantFocusability() { return ViewGroup.FOCUS_BLOCK_DESCENDANTS; } - - } |