Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5c06a64 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing issue with touch events not being forwarded to task switch fling detector. (Bug 16656169)

Change-Id: Id8f96455f6e11a13a8ac12d341464bca4419d7c5
parent 3aa9c221
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
    private final GestureDetector mTaskSwitcherDetector;
    private final int mScrollTouchSlop;
    private final int mMinFlingVelocity;
    private boolean mInterceptTouches;
    private int mTouchDownX;
    private int mTouchDownY;

@@ -56,11 +55,11 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
        // task switcher detector
        mTaskSwitcherDetector.onTouchEvent(event);
        int action = event.getAction();
        boolean interceptTouches = false;
        switch (action & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN: {
                mTouchDownX = (int) event.getX();
                mTouchDownY = (int) event.getY();
                mInterceptTouches = false;
                break;
            }
            case MotionEvent.ACTION_MOVE: {
@@ -72,21 +71,19 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
                        ? xDiff > mScrollTouchSlop && xDiff > yDiff
                        : yDiff > mScrollTouchSlop && yDiff > xDiff;
                if (exceededTouchSlop) {
                    mInterceptTouches = true;
                    interceptTouches = true;
                    return true;
                }
                break;
            }
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                mInterceptTouches = false;
                break;
        }
        return mInterceptTouches;
        return interceptTouches;
    }

    public boolean onTouchEvent(MotionEvent event) {
        if (!mInterceptTouches) return false;
        return mTaskSwitcherDetector.onTouchEvent(event);
    }