mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Cancelling the current drag when customization filter type changes to prevent crashes.
Change-Id: Iaa3f2598325950769d38ad1d6e390ab06ea194d7
This commit is contained in:
@@ -54,13 +54,16 @@ public abstract class PagedViewWithDraggableItems extends PagedView
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
protected void cancelDragging() {
|
||||
mIsDragging = false;
|
||||
mLastTouchedItem = null;
|
||||
}
|
||||
|
||||
private void handleTouchEvent(MotionEvent ev) {
|
||||
final int action = ev.getAction();
|
||||
switch (action & MotionEvent.ACTION_MASK) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mIsDragging = false;
|
||||
mLastTouchedItem = null;
|
||||
cancelDragging();
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (mTouchState != TOUCH_STATE_SCROLLING && !mIsDragging) {
|
||||
@@ -68,32 +71,26 @@ public abstract class PagedViewWithDraggableItems extends PagedView
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
handleTouchEvent(ev);
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
handleTouchEvent(ev);
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
mLastTouchedItem = v;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
final int action = ev.getAction();
|
||||
switch (action & MotionEvent.ACTION_MASK) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mIsDragging = false;
|
||||
mLastTouchedItem = null;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (mTouchState != TOUCH_STATE_SCROLLING && !mIsDragging) {
|
||||
determineDraggingStart(ev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
// Return early if this is not initiated from a touch
|
||||
|
||||
Reference in New Issue
Block a user