Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +13 −22 Original line number Original line Diff line number Diff line Loading @@ -843,7 +843,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override @Override public void onCameraLaunchedSuccessfully() { public void onCameraLaunchedSuccessfully() { if (isCameraPage(mAppWidgetContainer.getCurrentPage())) { if (mAppWidgetContainer.isCameraPage(mAppWidgetContainer.getCurrentPage())) { mAppWidgetContainer.scrollLeft(); mAppWidgetContainer.scrollLeft(); } } setSliderHandleAlpha(1); setSliderHandleAlpha(1); Loading Loading @@ -932,7 +932,8 @@ public class KeyguardHostView extends KeyguardViewBase { int lastWidget = mAppWidgetContainer.getChildCount() - 1; int lastWidget = mAppWidgetContainer.getChildCount() - 1; int position = 0; // handle no widget case int position = 0; // handle no widget case if (lastWidget >= 0) { if (lastWidget >= 0) { position = isCameraPage(lastWidget) ? lastWidget : lastWidget + 1; position = mAppWidgetContainer.isCameraPage(lastWidget) ? lastWidget : lastWidget + 1; } } mAppWidgetContainer.addWidget(mTransportControl, position); mAppWidgetContainer.addWidget(mTransportControl, position); mTransportControl.setVisibility(View.VISIBLE); mTransportControl.setVisibility(View.VISIBLE); Loading Loading @@ -1146,7 +1147,7 @@ public class KeyguardHostView extends KeyguardViewBase { private CameraWidgetFrame findCameraPage() { private CameraWidgetFrame findCameraPage() { for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) { for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) { if (isCameraPage(i)) { if (mAppWidgetContainer.isCameraPage(i)) { return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i); return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i); } } } } Loading @@ -1162,20 +1163,6 @@ public class KeyguardHostView extends KeyguardViewBase { return false; return false; } } private boolean isCameraPage(int pageIndex) { View v = mAppWidgetContainer.getChildAt(pageIndex); return v != null && v instanceof CameraWidgetFrame; } private boolean isAddPage(int pageIndex) { View v = mAppWidgetContainer.getChildAt(pageIndex); return v != null && v.getId() == R.id.keyguard_add_widget; } private boolean isMusicPage(int pageIndex) { return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control); } private int getStickyWidget() { private int getStickyWidget() { // The first time we query the persistent state. From that point, we use a locally updated // The first time we query the persistent state. From that point, we use a locally updated // notion of the sticky widget page. // notion of the sticky widget page. Loading @@ -1190,10 +1177,10 @@ public class KeyguardHostView extends KeyguardViewBase { if (index < 0 || index >= mAppWidgetContainer.getChildCount()) { if (index < 0 || index >= mAppWidgetContainer.getChildCount()) { return; return; } } if (isAddPage(index)) { if (mAppWidgetContainer.isAddPage(index)) { return; return; } } if (isCameraPage(index)) { if (mAppWidgetContainer.isCameraPage(index)) { return; return; } } if (isMusicPage(index)) { if (isMusicPage(index)) { Loading @@ -1203,6 +1190,10 @@ public class KeyguardHostView extends KeyguardViewBase { mLocalStickyWidget = index; mLocalStickyWidget = index; } } boolean isMusicPage(int pageIndex) { return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control); } private int getAppropriateWidgetPage(boolean isMusicPlaying) { private int getAppropriateWidgetPage(boolean isMusicPlaying) { // assumes at least one widget (besides camera + add) // assumes at least one widget (besides camera + add) Loading @@ -1216,15 +1207,15 @@ public class KeyguardHostView extends KeyguardViewBase { int stickyWidgetIndex = getStickyWidget(); int stickyWidgetIndex = getStickyWidget(); if (stickyWidgetIndex > -1 if (stickyWidgetIndex > -1 && stickyWidgetIndex < mAppWidgetContainer.getChildCount() && stickyWidgetIndex < mAppWidgetContainer.getChildCount() && !isAddPage(stickyWidgetIndex) && !mAppWidgetContainer.isAddPage(stickyWidgetIndex) && !isCameraPage(stickyWidgetIndex)) { && !mAppWidgetContainer.isCameraPage(stickyWidgetIndex)) { if (DEBUG) Log.d(TAG, "Valid sticky widget found, show page " + stickyWidgetIndex); if (DEBUG) Log.d(TAG, "Valid sticky widget found, show page " + stickyWidgetIndex); return stickyWidgetIndex; return stickyWidgetIndex; } } // else show the right-most widget (except for camera) // else show the right-most widget (except for camera) int rightMost = mAppWidgetContainer.getChildCount() - 1; int rightMost = mAppWidgetContainer.getChildCount() - 1; if (isCameraPage(rightMost)) { if (mAppWidgetContainer.isCameraPage(rightMost)) { rightMost--; rightMost--; } } if (DEBUG) Log.d(TAG, "Show right-most page " + rightMost); if (DEBUG) Log.d(TAG, "Show right-most page " + rightMost); Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -782,4 +782,19 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit mZoomInOutAnim.start(); mZoomInOutAnim.start(); } } } } boolean isAddPage(int pageIndex) { View v = getChildAt(pageIndex); return v != null && v.getId() == R.id.keyguard_add_widget; } boolean isCameraPage(int pageIndex) { View v = getChildAt(pageIndex); return v != null && v instanceof CameraWidgetFrame; } @Override protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) { return !isCameraPage(childIndex) && super.shouldSetTopAlignedPivotForWidget(childIndex); } } } policy/src/com/android/internal/policy/impl/keyguard/PagedView.java +37 −16 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.util.Log; import android.view.InputDevice; import android.view.InputDevice; import android.view.KeyEvent; import android.view.KeyEvent; Loading Loading @@ -577,6 +578,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc computeScrollHelper(); computeScrollHelper(); } } protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) { return mTopAlignPageWhenShrinkingForBouncer; } @Override @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!mIsDataReady || getChildCount() == 0) { if (!mIsDataReady || getChildCount() == 0) { Loading @@ -593,8 +598,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc int heightSize = MeasureSpec.getSize(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the // viewport, we can be at most one and a half screens offset once we scale down // viewport, we can be at most one and a half screens offset once we scale down int parentWidthSize = (int) (1.5f * parent.getMeasuredWidth()); DisplayMetrics dm = getResources().getDisplayMetrics(); int parentHeightSize = parent.getMeasuredHeight(); int maxSize = Math.max(dm.widthPixels, dm.heightPixels); int parentWidthSize = (int) (1.5f * maxSize); int parentHeightSize = maxSize; int scaledWidthSize = (int) (parentWidthSize / mMinScale); int scaledWidthSize = (int) (parentWidthSize / mMinScale); int scaledHeightSize = (int) (parentHeightSize / mMinScale); int scaledHeightSize = (int) (parentHeightSize / mMinScale); mViewport.set(0, 0, widthSize, heightSize); mViewport.set(0, 0, widthSize, heightSize); Loading Loading @@ -651,7 +658,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode); MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); if (mTopAlignPageWhenShrinkingForBouncer) { if (shouldSetTopAlignedPivotForWidget(i)) { child.setPivotX(child.getWidth() / 2); child.setPivotX(child.getWidth() / 2); child.setPivotY(0f); child.setPivotY(0f); } } Loading Loading @@ -1015,6 +1022,17 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc return (x > (getViewportOffsetX() + getViewportWidth() - getRelativeChildOffset(mCurrentPage) + mPageSpacing)); return (x > (getViewportOffsetX() + getViewportWidth() - getRelativeChildOffset(mCurrentPage) + mPageSpacing)); } } /** Returns whether x and y originated within the buffered/unbuffered viewport */ private boolean isTouchPointInViewport(int x, int y, boolean buffer) { if (buffer) { mTmpRect.set(mViewport.left - mViewport.width() / 2, mViewport.top, mViewport.right + mViewport.width() / 2, mViewport.bottom); return mTmpRect.contains(x, y); } else { return mViewport.contains(x, y); } } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { if (DISABLE_TOUCH_INTERACTION) { if (DISABLE_TOUCH_INTERACTION) { Loading Loading @@ -1093,7 +1111,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc mTouchState = TOUCH_STATE_REST; mTouchState = TOUCH_STATE_REST; mScroller.abortAnimation(); mScroller.abortAnimation(); } else { } else { if (isTouchPointInViewport((int) mDownMotionX, (int) mDownMotionY, true)) { mTouchState = TOUCH_STATE_SCROLLING; mTouchState = TOUCH_STATE_SCROLLING; } else { mTouchState = TOUCH_STATE_REST; } } } // check if this can be the beginning of a tap on the side of the pages // check if this can be the beginning of a tap on the side of the pages Loading @@ -1115,6 +1137,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL: resetTouchState(); resetTouchState(); // Just intercept the touch event on up if we tap outside the strict viewport if (!isTouchPointInViewport((int) mLastMotionX, (int) mLastMotionY, false)) { return true; } break; break; case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_POINTER_UP: Loading @@ -1139,24 +1165,19 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc * user moves their touch point too far. * user moves their touch point too far. */ */ protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) { protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) { /* // Disallow scrolling if we don't have a valid pointer index * Locally do absolute value. mLastMotionX is set to the y value * of the down event. */ final int pointerIndex = ev.findPointerIndex(mActivePointerId); final int pointerIndex = ev.findPointerIndex(mActivePointerId); if (pointerIndex == -1) return; if (pointerIndex == -1) { // Disallow scrolling if we started the gesture from outside the viewport return; final float x = ev.getX(pointerIndex); } final float y = ev.getY(pointerIndex); if (!isTouchPointInViewport((int) x, (int) y, true)) return; // If we're only allowing edge swipes, we break out early if the down event wasn't // If we're only allowing edge swipes, we break out early if the down event wasn't // at the edge. // at the edge. if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) { if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) return; return; } final float x = ev.getX(pointerIndex); final float y = ev.getY(pointerIndex); final int xDiff = (int) Math.abs(x - mLastMotionX); final int xDiff = (int) Math.abs(x - mLastMotionX); final int yDiff = (int) Math.abs(y - mLastMotionY); final int yDiff = (int) Math.abs(y - mLastMotionY); Loading policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -469,8 +469,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout public void showBouncer() { public void showBouncer() { if (mIsBouncing) return; if (mIsBouncing) return; mWasChallengeShowing = mChallengeShowing; mWasChallengeShowing = mChallengeShowing; showChallenge(true); mIsBouncing = true; mIsBouncing = true; showChallenge(true); if (mScrimView != null) { if (mScrimView != null) { mScrimView.setVisibility(VISIBLE); mScrimView.setVisibility(VISIBLE); } } Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +13 −22 Original line number Original line Diff line number Diff line Loading @@ -843,7 +843,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override @Override public void onCameraLaunchedSuccessfully() { public void onCameraLaunchedSuccessfully() { if (isCameraPage(mAppWidgetContainer.getCurrentPage())) { if (mAppWidgetContainer.isCameraPage(mAppWidgetContainer.getCurrentPage())) { mAppWidgetContainer.scrollLeft(); mAppWidgetContainer.scrollLeft(); } } setSliderHandleAlpha(1); setSliderHandleAlpha(1); Loading Loading @@ -932,7 +932,8 @@ public class KeyguardHostView extends KeyguardViewBase { int lastWidget = mAppWidgetContainer.getChildCount() - 1; int lastWidget = mAppWidgetContainer.getChildCount() - 1; int position = 0; // handle no widget case int position = 0; // handle no widget case if (lastWidget >= 0) { if (lastWidget >= 0) { position = isCameraPage(lastWidget) ? lastWidget : lastWidget + 1; position = mAppWidgetContainer.isCameraPage(lastWidget) ? lastWidget : lastWidget + 1; } } mAppWidgetContainer.addWidget(mTransportControl, position); mAppWidgetContainer.addWidget(mTransportControl, position); mTransportControl.setVisibility(View.VISIBLE); mTransportControl.setVisibility(View.VISIBLE); Loading Loading @@ -1146,7 +1147,7 @@ public class KeyguardHostView extends KeyguardViewBase { private CameraWidgetFrame findCameraPage() { private CameraWidgetFrame findCameraPage() { for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) { for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) { if (isCameraPage(i)) { if (mAppWidgetContainer.isCameraPage(i)) { return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i); return (CameraWidgetFrame) mAppWidgetContainer.getChildAt(i); } } } } Loading @@ -1162,20 +1163,6 @@ public class KeyguardHostView extends KeyguardViewBase { return false; return false; } } private boolean isCameraPage(int pageIndex) { View v = mAppWidgetContainer.getChildAt(pageIndex); return v != null && v instanceof CameraWidgetFrame; } private boolean isAddPage(int pageIndex) { View v = mAppWidgetContainer.getChildAt(pageIndex); return v != null && v.getId() == R.id.keyguard_add_widget; } private boolean isMusicPage(int pageIndex) { return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control); } private int getStickyWidget() { private int getStickyWidget() { // The first time we query the persistent state. From that point, we use a locally updated // The first time we query the persistent state. From that point, we use a locally updated // notion of the sticky widget page. // notion of the sticky widget page. Loading @@ -1190,10 +1177,10 @@ public class KeyguardHostView extends KeyguardViewBase { if (index < 0 || index >= mAppWidgetContainer.getChildCount()) { if (index < 0 || index >= mAppWidgetContainer.getChildCount()) { return; return; } } if (isAddPage(index)) { if (mAppWidgetContainer.isAddPage(index)) { return; return; } } if (isCameraPage(index)) { if (mAppWidgetContainer.isCameraPage(index)) { return; return; } } if (isMusicPage(index)) { if (isMusicPage(index)) { Loading @@ -1203,6 +1190,10 @@ public class KeyguardHostView extends KeyguardViewBase { mLocalStickyWidget = index; mLocalStickyWidget = index; } } boolean isMusicPage(int pageIndex) { return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control); } private int getAppropriateWidgetPage(boolean isMusicPlaying) { private int getAppropriateWidgetPage(boolean isMusicPlaying) { // assumes at least one widget (besides camera + add) // assumes at least one widget (besides camera + add) Loading @@ -1216,15 +1207,15 @@ public class KeyguardHostView extends KeyguardViewBase { int stickyWidgetIndex = getStickyWidget(); int stickyWidgetIndex = getStickyWidget(); if (stickyWidgetIndex > -1 if (stickyWidgetIndex > -1 && stickyWidgetIndex < mAppWidgetContainer.getChildCount() && stickyWidgetIndex < mAppWidgetContainer.getChildCount() && !isAddPage(stickyWidgetIndex) && !mAppWidgetContainer.isAddPage(stickyWidgetIndex) && !isCameraPage(stickyWidgetIndex)) { && !mAppWidgetContainer.isCameraPage(stickyWidgetIndex)) { if (DEBUG) Log.d(TAG, "Valid sticky widget found, show page " + stickyWidgetIndex); if (DEBUG) Log.d(TAG, "Valid sticky widget found, show page " + stickyWidgetIndex); return stickyWidgetIndex; return stickyWidgetIndex; } } // else show the right-most widget (except for camera) // else show the right-most widget (except for camera) int rightMost = mAppWidgetContainer.getChildCount() - 1; int rightMost = mAppWidgetContainer.getChildCount() - 1; if (isCameraPage(rightMost)) { if (mAppWidgetContainer.isCameraPage(rightMost)) { rightMost--; rightMost--; } } if (DEBUG) Log.d(TAG, "Show right-most page " + rightMost); if (DEBUG) Log.d(TAG, "Show right-most page " + rightMost); Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -782,4 +782,19 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit mZoomInOutAnim.start(); mZoomInOutAnim.start(); } } } } boolean isAddPage(int pageIndex) { View v = getChildAt(pageIndex); return v != null && v.getId() == R.id.keyguard_add_widget; } boolean isCameraPage(int pageIndex) { View v = getChildAt(pageIndex); return v != null && v instanceof CameraWidgetFrame; } @Override protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) { return !isCameraPage(childIndex) && super.shouldSetTopAlignedPivotForWidget(childIndex); } } }
policy/src/com/android/internal/policy/impl/keyguard/PagedView.java +37 −16 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.util.Log; import android.view.InputDevice; import android.view.InputDevice; import android.view.KeyEvent; import android.view.KeyEvent; Loading Loading @@ -577,6 +578,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc computeScrollHelper(); computeScrollHelper(); } } protected boolean shouldSetTopAlignedPivotForWidget(int childIndex) { return mTopAlignPageWhenShrinkingForBouncer; } @Override @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!mIsDataReady || getChildCount() == 0) { if (!mIsDataReady || getChildCount() == 0) { Loading @@ -593,8 +598,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc int heightSize = MeasureSpec.getSize(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the // viewport, we can be at most one and a half screens offset once we scale down // viewport, we can be at most one and a half screens offset once we scale down int parentWidthSize = (int) (1.5f * parent.getMeasuredWidth()); DisplayMetrics dm = getResources().getDisplayMetrics(); int parentHeightSize = parent.getMeasuredHeight(); int maxSize = Math.max(dm.widthPixels, dm.heightPixels); int parentWidthSize = (int) (1.5f * maxSize); int parentHeightSize = maxSize; int scaledWidthSize = (int) (parentWidthSize / mMinScale); int scaledWidthSize = (int) (parentWidthSize / mMinScale); int scaledHeightSize = (int) (parentHeightSize / mMinScale); int scaledHeightSize = (int) (parentHeightSize / mMinScale); mViewport.set(0, 0, widthSize, heightSize); mViewport.set(0, 0, widthSize, heightSize); Loading Loading @@ -651,7 +658,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode); MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); if (mTopAlignPageWhenShrinkingForBouncer) { if (shouldSetTopAlignedPivotForWidget(i)) { child.setPivotX(child.getWidth() / 2); child.setPivotX(child.getWidth() / 2); child.setPivotY(0f); child.setPivotY(0f); } } Loading Loading @@ -1015,6 +1022,17 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc return (x > (getViewportOffsetX() + getViewportWidth() - getRelativeChildOffset(mCurrentPage) + mPageSpacing)); return (x > (getViewportOffsetX() + getViewportWidth() - getRelativeChildOffset(mCurrentPage) + mPageSpacing)); } } /** Returns whether x and y originated within the buffered/unbuffered viewport */ private boolean isTouchPointInViewport(int x, int y, boolean buffer) { if (buffer) { mTmpRect.set(mViewport.left - mViewport.width() / 2, mViewport.top, mViewport.right + mViewport.width() / 2, mViewport.bottom); return mTmpRect.contains(x, y); } else { return mViewport.contains(x, y); } } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { if (DISABLE_TOUCH_INTERACTION) { if (DISABLE_TOUCH_INTERACTION) { Loading Loading @@ -1093,7 +1111,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc mTouchState = TOUCH_STATE_REST; mTouchState = TOUCH_STATE_REST; mScroller.abortAnimation(); mScroller.abortAnimation(); } else { } else { if (isTouchPointInViewport((int) mDownMotionX, (int) mDownMotionY, true)) { mTouchState = TOUCH_STATE_SCROLLING; mTouchState = TOUCH_STATE_SCROLLING; } else { mTouchState = TOUCH_STATE_REST; } } } // check if this can be the beginning of a tap on the side of the pages // check if this can be the beginning of a tap on the side of the pages Loading @@ -1115,6 +1137,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL: resetTouchState(); resetTouchState(); // Just intercept the touch event on up if we tap outside the strict viewport if (!isTouchPointInViewport((int) mLastMotionX, (int) mLastMotionY, false)) { return true; } break; break; case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_POINTER_UP: Loading @@ -1139,24 +1165,19 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc * user moves their touch point too far. * user moves their touch point too far. */ */ protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) { protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) { /* // Disallow scrolling if we don't have a valid pointer index * Locally do absolute value. mLastMotionX is set to the y value * of the down event. */ final int pointerIndex = ev.findPointerIndex(mActivePointerId); final int pointerIndex = ev.findPointerIndex(mActivePointerId); if (pointerIndex == -1) return; if (pointerIndex == -1) { // Disallow scrolling if we started the gesture from outside the viewport return; final float x = ev.getX(pointerIndex); } final float y = ev.getY(pointerIndex); if (!isTouchPointInViewport((int) x, (int) y, true)) return; // If we're only allowing edge swipes, we break out early if the down event wasn't // If we're only allowing edge swipes, we break out early if the down event wasn't // at the edge. // at the edge. if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) { if (mOnlyAllowEdgeSwipes && !mDownEventOnEdge) return; return; } final float x = ev.getX(pointerIndex); final float y = ev.getY(pointerIndex); final int xDiff = (int) Math.abs(x - mLastMotionX); final int xDiff = (int) Math.abs(x - mLastMotionX); final int yDiff = (int) Math.abs(y - mLastMotionY); final int yDiff = (int) Math.abs(y - mLastMotionY); Loading
policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -469,8 +469,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout public void showBouncer() { public void showBouncer() { if (mIsBouncing) return; if (mIsBouncing) return; mWasChallengeShowing = mChallengeShowing; mWasChallengeShowing = mChallengeShowing; showChallenge(true); mIsBouncing = true; mIsBouncing = true; showChallenge(true); if (mScrimView != null) { if (mScrimView != null) { mScrimView.setVisibility(VISIBLE); mScrimView.setVisibility(VISIBLE); } } Loading