am 3798b643: Fix issue where you could trigger a click after long pressing a widget (issue 11186227)
* commit '3798b643cd8a5c7c85864eced90374cf0fb45640': Fix issue where you could trigger a click after long pressing a widget (issue 11186227)
This commit is contained in:
@@ -65,6 +65,12 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
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
|
// Consume any touch events for ourselves after longpress is triggered
|
||||||
if (mLongPressHelper.hasPerformedLongPress()) {
|
if (mLongPressHelper.hasPerformedLongPress()) {
|
||||||
mLongPressHelper.cancelLongPress();
|
mLongPressHelper.cancelLongPress();
|
||||||
@@ -110,13 +116,15 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTouchComplete() {
|
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
|
@Override
|
||||||
public int getDescendantFocusability() {
|
public int getDescendantFocusability() {
|
||||||
return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
|
return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user