mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Clearing the touch state on ACTON_UP/ACTIUON_CANCEL
The touch listener may not get ACTION_DOWN if it came through an intercept, in which case it will continue to use the previous state. Clearing the state ensures that the next touch is not affected. Bug: 76152745 Change-Id: I18cfbac67aa373e935822003e746af9def6d9122
This commit is contained in:
@@ -102,23 +102,30 @@ public class WorkspaceTouchListener implements OnTouchListener, Runnable {
|
||||
// Inform the workspace to cancel touch handling
|
||||
ev.setAction(ACTION_CANCEL);
|
||||
mWorkspace.onTouchEvent(ev);
|
||||
|
||||
ev.setAction(action);
|
||||
mLongPressState = STATE_COMPLETED;
|
||||
}
|
||||
|
||||
final boolean result;
|
||||
if (mLongPressState == STATE_COMPLETED) {
|
||||
// We have handled the touch, so workspace does not need to know anything anymore.
|
||||
return true;
|
||||
result = true;
|
||||
} else if (mLongPressState == STATE_REQUESTED) {
|
||||
mWorkspace.onTouchEvent(ev);
|
||||
if (action == ACTION_UP || action == ACTION_CANCEL || mWorkspace.isHandlingTouch()) {
|
||||
if (mWorkspace.isHandlingTouch()) {
|
||||
cancelLongPress();
|
||||
}
|
||||
return true;
|
||||
|
||||
result = true;
|
||||
} else {
|
||||
// We don't want to handle touch, let workspace handle it as usual.
|
||||
return false;
|
||||
result = false;
|
||||
}
|
||||
if (action == ACTION_UP || action == ACTION_CANCEL) {
|
||||
cancelLongPress();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void cancelLongPress() {
|
||||
|
||||
Reference in New Issue
Block a user