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

Commit 1ec46467 authored by John Spurlock's avatar John Spurlock
Browse files

Block swipe up gesture if challenge non-interactive.

Change-Id: I0f9ba918c072261614011cd675e417e54296366f
parent 79417e89
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    private final Rect mTempRect = new Rect();

    private boolean mHasGlowpad;
    private boolean mChallengeInteractive = true;

    static final Property<SlidingChallengeLayout, Float> HANDLE_ALPHA =
            new FloatProperty<SlidingChallengeLayout>("handleAlpha") {
@@ -276,6 +277,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    }

    public void setChallengeInteractive(boolean interactive) {
        mChallengeInteractive = interactive;
        if (mExpandChallengeView != null) {
            mExpandChallengeView.setEnabled(interactive);
        }
@@ -585,7 +587,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
                for (int i = 0; i < count; i++) {
                    final float x = ev.getX(i);
                    final float y = ev.getY(i);
                    if (!mIsBouncing && mActivePointerId == INVALID_POINTER
                    if (!mIsBouncing && mChallengeInteractive && mActivePointerId == INVALID_POINTER
                                && (crossedDragHandle(x, y, mGestureStartY)
                                || (isInChallengeView(x, y) &&
                                        mScrollState == SCROLL_STATE_SETTLING))) {
@@ -633,7 +635,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
                break;

            case MotionEvent.ACTION_CANCEL:
                if (mDragging) {
                if (mDragging && mChallengeInteractive) {
                    showChallenge(0);
                }
                resetTouch();
@@ -644,7 +646,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
                    break;
                }
            case MotionEvent.ACTION_UP:
                if (mDragging) {
                if (mDragging && mChallengeInteractive) {
                    mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity);
                    showChallenge((int) mVelocityTracker.getYVelocity(mActivePointerId));
                }
@@ -660,7 +662,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout

                        if ((isInDragHandle(x, y) || crossedDragHandle(x, y, mGestureStartY) ||
                                (isInChallengeView(x, y) && mScrollState == SCROLL_STATE_SETTLING))
                                && mActivePointerId == INVALID_POINTER) {
                                && mActivePointerId == INVALID_POINTER
                                && mChallengeInteractive) {
                            mGestureStartX = x;
                            mGestureStartY = y;
                            mActivePointerId = ev.getPointerId(i);