Loading policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java +18 −13 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.policy.impl.keyguard; import com.android.internal.R; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; Loading @@ -29,7 +31,6 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; import android.util.MathUtils; import android.util.Property; import android.view.MotionEvent; import android.view.VelocityTracker; Loading @@ -40,8 +41,6 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.Interpolator; import android.widget.Scroller; import com.android.internal.R; /** * This layout handles interaction with the sliding security challenge views * that overlay/resize other keyguard contents. Loading @@ -53,7 +52,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout // The drag handle is measured in dp above & below the top edge of the // challenge view; these parameters change based on whether the challenge // is open or closed. private static final int DRAG_HANDLE_CLOSED_ABOVE = 64; // dp private static final int DRAG_HANDLE_CLOSED_ABOVE = 8; // dp private static final int DRAG_HANDLE_CLOSED_BELOW = 0; // dp private static final int DRAG_HANDLE_OPEN_ABOVE = 8; // dp private static final int DRAG_HANDLE_OPEN_BELOW = 0; // dp Loading Loading @@ -581,9 +580,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout final float x = ev.getX(i); final float y = ev.getY(i); if (!mIsBouncing && mActivePointerId == INVALID_POINTER && ((isInDragHandle(x, y) && MathUtils.sq(x - mGestureStartX) + MathUtils.sq(y - mGestureStartY) > mTouchSlopSquare) || crossedDragHandle(x, y, mGestureStartY) && (crossedDragHandle(x, y, mGestureStartY) || (isInChallengeView(x, y) && mScrollState == SCROLL_STATE_SETTLING))) { mActivePointerId = ev.getPointerId(i); Loading @@ -592,7 +589,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout mGestureStartChallengeBottom = getChallengeBottom(); mDragging = true; mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); } else if (isInChallengeView(x, y)) { } else if (mChallengeShowing && isInChallengeView(x, y)) { mBlockDrag = true; } } Loading Loading @@ -767,11 +764,19 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout } private boolean crossedDragHandle(float x, float y, float initialY) { final int challengeTop = mChallengeView.getTop(); return x >= 0 && x < getWidth() && initialY < (challengeTop - getDragHandleSizeAbove()) && final boolean horizOk = x >= 0 && x < getWidth(); final boolean vertOk; if (mChallengeShowing) { vertOk = initialY < (challengeTop - getDragHandleSizeAbove()) && y > challengeTop + getDragHandleSizeBelow(); } else { vertOk = initialY > challengeTop + getDragHandleSizeBelow() && y < challengeTop - getDragHandleSizeAbove(); } return horizOk && vertOk; } @Override Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java +18 −13 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.policy.impl.keyguard; import com.android.internal.R; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; Loading @@ -29,7 +31,6 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; import android.util.MathUtils; import android.util.Property; import android.view.MotionEvent; import android.view.VelocityTracker; Loading @@ -40,8 +41,6 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.Interpolator; import android.widget.Scroller; import com.android.internal.R; /** * This layout handles interaction with the sliding security challenge views * that overlay/resize other keyguard contents. Loading @@ -53,7 +52,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout // The drag handle is measured in dp above & below the top edge of the // challenge view; these parameters change based on whether the challenge // is open or closed. private static final int DRAG_HANDLE_CLOSED_ABOVE = 64; // dp private static final int DRAG_HANDLE_CLOSED_ABOVE = 8; // dp private static final int DRAG_HANDLE_CLOSED_BELOW = 0; // dp private static final int DRAG_HANDLE_OPEN_ABOVE = 8; // dp private static final int DRAG_HANDLE_OPEN_BELOW = 0; // dp Loading Loading @@ -581,9 +580,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout final float x = ev.getX(i); final float y = ev.getY(i); if (!mIsBouncing && mActivePointerId == INVALID_POINTER && ((isInDragHandle(x, y) && MathUtils.sq(x - mGestureStartX) + MathUtils.sq(y - mGestureStartY) > mTouchSlopSquare) || crossedDragHandle(x, y, mGestureStartY) && (crossedDragHandle(x, y, mGestureStartY) || (isInChallengeView(x, y) && mScrollState == SCROLL_STATE_SETTLING))) { mActivePointerId = ev.getPointerId(i); Loading @@ -592,7 +589,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout mGestureStartChallengeBottom = getChallengeBottom(); mDragging = true; mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); } else if (isInChallengeView(x, y)) { } else if (mChallengeShowing && isInChallengeView(x, y)) { mBlockDrag = true; } } Loading Loading @@ -767,11 +764,19 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout } private boolean crossedDragHandle(float x, float y, float initialY) { final int challengeTop = mChallengeView.getTop(); return x >= 0 && x < getWidth() && initialY < (challengeTop - getDragHandleSizeAbove()) && final boolean horizOk = x >= 0 && x < getWidth(); final boolean vertOk; if (mChallengeShowing) { vertOk = initialY < (challengeTop - getDragHandleSizeAbove()) && y > challengeTop + getDragHandleSizeBelow(); } else { vertOk = initialY > challengeTop + getDragHandleSizeBelow() && y < challengeTop - getDragHandleSizeAbove(); } return horizOk && vertOk; } @Override Loading