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

Commit a7651b87 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Increases the falsing threshold when for the keyguard affordances" into lmp-mr1-dev

parents 4d269ba3 1dc40650
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -321,7 +321,7 @@
    <dimen name="heads_up_window_height">250dp</dimen>
    <dimen name="heads_up_window_height">250dp</dimen>


    <!-- The minimum amount the user needs to swipe to go to the camera / phone. -->
    <!-- The minimum amount the user needs to swipe to go to the camera / phone. -->
    <dimen name="keyguard_min_swipe_amount">90dp</dimen>
    <dimen name="keyguard_min_swipe_amount">110dp</dimen>


    <!-- The minimum background radius when swiping to a side for the camera / phone affordances. -->
    <!-- The minimum background radius when swiping to a side for the camera / phone affordances. -->
    <dimen name="keyguard_affordance_min_background_radius">30dp</dimen>
    <dimen name="keyguard_affordance_min_background_radius">30dp</dimen>
+20 −29
Original line number Original line Diff line number Diff line
@@ -46,7 +46,6 @@ public class KeyguardAffordanceHelper {


    private FlingAnimationUtils mFlingAnimationUtils;
    private FlingAnimationUtils mFlingAnimationUtils;
    private Callback mCallback;
    private Callback mCallback;
    private int mTrackingPointer;
    private VelocityTracker mVelocityTracker;
    private VelocityTracker mVelocityTracker;
    private boolean mSwipingInProgress;
    private boolean mSwipingInProgress;
    private float mInitialTouchX;
    private float mInitialTouchX;
@@ -65,6 +64,7 @@ public class KeyguardAffordanceHelper {
    private Animator mSwipeAnimator;
    private Animator mSwipeAnimator;
    private int mMinBackgroundRadius;
    private int mMinBackgroundRadius;
    private boolean mMotionPerformedByUser;
    private boolean mMotionPerformedByUser;
    private boolean mMotionCancelled;
    private AnimatorListenerAdapter mFlingEndListener = new AnimatorListenerAdapter() {
    private AnimatorListenerAdapter mFlingEndListener = new AnimatorListenerAdapter() {
        @Override
        @Override
        public void onAnimationEnd(Animator animation) {
        public void onAnimationEnd(Animator animation) {
@@ -117,13 +117,11 @@ public class KeyguardAffordanceHelper {
    }
    }


    public boolean onTouchEvent(MotionEvent event) {
    public boolean onTouchEvent(MotionEvent event) {
        int pointerIndex = event.findPointerIndex(mTrackingPointer);
        if (mMotionCancelled && event.getActionMasked() != MotionEvent.ACTION_DOWN) {
        if (pointerIndex < 0) {
            return false;
            pointerIndex = 0;
            mTrackingPointer = event.getPointerId(pointerIndex);
        }
        }
        final float y = event.getY(pointerIndex);
        final float y = event.getY();
        final float x = event.getX(pointerIndex);
        final float x = event.getX();


        boolean isUp = false;
        boolean isUp = false;
        switch (event.getActionMasked()) {
        switch (event.getActionMasked()) {
@@ -137,22 +135,12 @@ public class KeyguardAffordanceHelper {
                initVelocityTracker();
                initVelocityTracker();
                trackMovement(event);
                trackMovement(event);
                mMotionPerformedByUser = false;
                mMotionPerformedByUser = false;
                mMotionCancelled = false;
                break;
                break;

            case MotionEvent.ACTION_POINTER_DOWN:
            case MotionEvent.ACTION_POINTER_UP:
                mMotionCancelled = true;
                final int upPointer = event.getPointerId(event.getActionIndex());
                endMotion(event, true /* forceSnapBack */);
                if (mTrackingPointer == upPointer) {
                    // gesture is ongoing, find a new pointer to track
                    final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1;
                    final float newY = event.getY(newIndex);
                    final float newX = event.getX(newIndex);
                    mTrackingPointer = event.getPointerId(newIndex);
                    mInitialTouchY = newY;
                    mInitialTouchX = newX;
                    mTranslationOnDown = mTranslation;
                }
                break;
                break;

            case MotionEvent.ACTION_MOVE:
            case MotionEvent.ACTION_MOVE:
                final float w = x - mInitialTouchX;
                final float w = x - mInitialTouchX;
                trackMovement(event);
                trackMovement(event);
@@ -174,18 +162,21 @@ public class KeyguardAffordanceHelper {
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_UP:
                isUp = true;
                isUp = true;
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_CANCEL:
                mTrackingPointer = -1;
                trackMovement(event);
                trackMovement(event);
                endMotion(event, !isUp);
                break;
        }
        return true;
    }

    private void endMotion(MotionEvent event, boolean forceSnapBack) {
        if (mSwipingInProgress) {
        if (mSwipingInProgress) {
                    flingWithCurrentVelocity(!isUp);
            flingWithCurrentVelocity(forceSnapBack);
        }
        }
        if (mVelocityTracker != null) {
        if (mVelocityTracker != null) {
            mVelocityTracker.recycle();
            mVelocityTracker.recycle();
            mVelocityTracker = null;
            mVelocityTracker = null;
        }
        }
                break;
        }
        return true;
    }
    }


    private void setSwipingInProgress(boolean inProgress) {
    private void setSwipingInProgress(boolean inProgress) {