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

Commit 78a8f126 authored by John Spurlock's avatar John Spurlock
Browse files

Properly disable challenge handle.

Bug:7464304
Change-Id: Ib69ccc66bbd348fc3ad17e5097522a0976838daa
parent a9b46824
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -122,7 +122,6 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    private final Rect mTempRect = new Rect();
    private final Rect mTempRect = new Rect();


    private boolean mHasGlowpad;
    private boolean mHasGlowpad;
    private boolean mChallengeInteractive = true;


    static final Property<SlidingChallengeLayout, Float> HANDLE_ALPHA =
    static final Property<SlidingChallengeLayout, Float> HANDLE_ALPHA =
            new FloatProperty<SlidingChallengeLayout>("handleAlpha") {
            new FloatProperty<SlidingChallengeLayout>("handleAlpha") {
@@ -187,7 +186,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    private final OnClickListener mExpandChallengeClickListener = new OnClickListener() {
    private final OnClickListener mExpandChallengeClickListener = new OnClickListener() {
        @Override
        @Override
        public void onClick(View v) {
        public void onClick(View v) {
            if (!isChallengeShowing() && mChallengeInteractive) {
            if (!isChallengeShowing()) {
                showChallenge(true);
                showChallenge(true);
            }
            }
        }
        }
@@ -277,7 +276,9 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    }
    }


    public void setChallengeInteractive(boolean interactive) {
    public void setChallengeInteractive(boolean interactive) {
        mChallengeInteractive = interactive;
        if (mExpandChallengeView != null) {
            mExpandChallengeView.setEnabled(interactive);
        }
    }
    }


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


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


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