Loading policy/src/com/android/internal/policy/impl/keyguard/CheckLongPressHelper.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,10 @@ public class CheckLongPressHelper { public void onMove(MotionEvent ev) { public void onMove(MotionEvent ev) { float x = ev.getX(); float x = ev.getX(); float y = ev.getY(); float y = ev.getY(); boolean xMoved = Math.abs(mDownX - x) > mScaledTouchSlop; boolean yMoved = Math.abs(mDownY - y) > mScaledTouchSlop; if (Math.sqrt(Math.pow(mDownX - x, 2) + Math.pow(mDownY - y, 2)) > mScaledTouchSlop) { if (xMoved || yMoved) { cancelLongPress(); cancelLongPress(); } } } } Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java +67 −32 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.view.View; public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChallengeScrolledListener { public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChallengeScrolledListener { private KeyguardWidgetPager mPagedView; private KeyguardWidgetPager mPagedView; private int mCurrentPageIndex; private ChallengeLayout mChallengeLayout; private ChallengeLayout mChallengeLayout; private Runnable mHideHintsRunnable; private Runnable mHideHintsRunnable; private KeyguardSecurityView mKeyguardSecurityContainer; private KeyguardSecurityView mKeyguardSecurityContainer; Loading @@ -31,6 +30,12 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle private static final int SCREEN_ON_RING_HINT_DELAY = 300; private static final int SCREEN_ON_RING_HINT_DELAY = 300; Handler mMainQueue = new Handler(Looper.myLooper()); Handler mMainQueue = new Handler(Looper.myLooper()); int mLastScrollState = SlidingChallengeLayout.SCROLL_STATE_IDLE; // Paged view state private int mPageListeningToSlider = -1; private int mCurrentPage = -1; int mChallengeTop = 0; int mChallengeTop = 0; public KeyguardViewStateManager() { public KeyguardViewStateManager() { Loading Loading @@ -66,28 +71,39 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle } } public void onPageSwitch(View newPage, int newPageIndex) { public void onPageSwitch(View newPage, int newPageIndex) { // Reset the previous page size and ensure the current page is sized appropriately // Reset the previous page size and ensure the current page is sized appropriately. if (mPagedView != null) { // We only modify the page state if it is not currently under control by the slider. KeyguardWidgetFrame oldPage = mPagedView.getWidgetPageAt(mCurrentPageIndex); // This prevents conflicts. // Reset the old widget page to full size if (mPagedView != null && mChallengeLayout != null) { if (oldPage != null) { KeyguardWidgetFrame prevPage = mPagedView.getWidgetPageAt(mCurrentPage); oldPage.resetSize(); if (prevPage != null && mCurrentPage != mPageListeningToSlider) { prevPage.resetSize(); } } KeyguardWidgetFrame newCurPage = mPagedView.getWidgetPageAt(newPageIndex); KeyguardWidgetFrame newCurPage = mPagedView.getWidgetPageAt(newPageIndex); if (mChallengeLayout.isChallengeOverlapping()) { boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); sizeWidgetFrameToChallengeTop(newCurPage); if (challengeOverlapping && !newCurPage.isSmall() && mPageListeningToSlider != newPageIndex) { shrinkWidget(newCurPage); } } } } mCurrentPageIndex = newPageIndex; mCurrentPage = newPageIndex; } } private void sizeWidgetFrameToChallengeTop(KeyguardWidgetFrame frame) { private int getChallengeTopRelativeToFrame(KeyguardWidgetFrame frame, int top) { if (frame == null) return; mTmpPoint[0] = 0; mTmpPoint[0] = 0; mTmpPoint[1] = mChallengeTop; mTmpPoint[1] = top; mapPoint((View) mChallengeLayout, frame, mTmpPoint); mapPoint((View) mChallengeLayout, frame, mTmpPoint); frame.setChallengeTop(mTmpPoint[1]); return mTmpPoint[1]; } private void shrinkWidget(KeyguardWidgetFrame frame) { if (frame != null && mChallengeLayout != null && mChallengeLayout instanceof SlidingChallengeLayout) { SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout; int top = scl.getMaxChallengeTop(); frame.shrinkWidget(getChallengeTopRelativeToFrame(frame, top)); } } } /** /** Loading @@ -114,20 +130,17 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle @Override @Override public void onScrollStateChanged(int scrollState) { public void onScrollStateChanged(int scrollState) { if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { if (mPagedView == null || mChallengeLayout == null) return; if (mPagedView == null) return; boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); int curPage = mPagedView.getCurrentPage(); KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(curPage); if (frame != null) { if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame == null) return; if (!challengeOverlapping) { if (!challengeOverlapping) { frame.resetSize(); frame.resetSize(); } else { sizeWidgetFrameToChallengeTop(frame); } } } frame.hideFrame(this); if (challengeOverlapping) { if (challengeOverlapping) { mPagedView.setOnlyAllowEdgeSwipes(true); mPagedView.setOnlyAllowEdgeSwipes(true); Loading @@ -140,10 +153,38 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle } else { } else { mKeyguardSecurityContainer.onPause(); mKeyguardSecurityContainer.onPause(); } } } else { mPageListeningToSlider = -1; } else if (mLastScrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { // Whether dragging or settling, if the last state was idle, we use this signal // to update the current page who will receive events from the sliding challenge. // We resize the frame as appropriate. mPageListeningToSlider = mPagedView.getNextPage(); KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame == null) return; frame.showFrame(this); // As soon as the security begins sliding, the widget becomes small (if it wasn't // small to begin with). if (!frame.isSmall()) { // We need to fetch the final page, in case the pages are in motion. mPageListeningToSlider = mPagedView.getNextPage(); System.out.println("Shrink widget from scroll state changed!"); shrinkWidget(frame); } // View is on the move. Pause the security view until it completes. // View is on the move. Pause the security view until it completes. mKeyguardSecurityContainer.onPause(); mKeyguardSecurityContainer.onPause(); } } mLastScrollState = scrollState; } @Override public void onScrollPositionChanged(float scrollPosition, int challengeTop) { mChallengeTop = challengeTop; KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame != null) { frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop)); } } } public void showUsabilityHints() { public void showUsabilityHints() { Loading @@ -164,10 +205,4 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_HINT_DURATION); mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_HINT_DURATION); } } @Override public void onScrollPositionChanged(float scrollPosition, int challengeTop) { mChallengeTop = challengeTop; } } } policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java +78 −11 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.policy.impl.keyguard; package com.android.internal.policy.impl.keyguard; import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetHostView; import android.content.Context; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources; Loading Loading @@ -49,6 +52,8 @@ public class KeyguardWidgetFrame extends FrameLayout { private final Rect mForegroundRect = new Rect(); private final Rect mForegroundRect = new Rect(); private int mForegroundAlpha = 0; private int mForegroundAlpha = 0; private CheckLongPressHelper mLongPressHelper; private CheckLongPressHelper mLongPressHelper; private Animator mFrameFade; private boolean mIsSmall = false; private float mBackgroundAlpha; private float mBackgroundAlpha; private float mContentAlpha; private float mContentAlpha; Loading @@ -56,6 +61,11 @@ public class KeyguardWidgetFrame extends FrameLayout { private Drawable mBackgroundDrawable; private Drawable mBackgroundDrawable; private Rect mBackgroundRect = new Rect(); private Rect mBackgroundRect = new Rect(); // Multiple callers may try and adjust the alpha of the frame. When a caller shows // the outlines, we give that caller control, and nobody else can fade them out. // This prevents animation conflicts. private Object mBgAlphaController; public KeyguardWidgetFrame(Context context) { public KeyguardWidgetFrame(Context context) { this(context, null, 0); this(context, null, 0); } } Loading @@ -80,6 +90,11 @@ public class KeyguardWidgetFrame extends FrameLayout { mGradientPaint.setXfermode(sAddBlendMode); mGradientPaint.setXfermode(sAddBlendMode); } } @Override protected void onDetachedFromWindow() { cancelLongPress(); } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { // Watch for longpress events at this level to make sure // Watch for longpress events at this level to make sure Loading Loading @@ -237,12 +252,29 @@ public class KeyguardWidgetFrame extends FrameLayout { } } } } /** * Set the top location of the challenge. * * @param top The top of the challenge, in _local_ coordinates, or -1 to indicate the challenge * is down. */ private void setChallengeTop(int top, boolean updateWidgetSize) { // The widget starts below the padding, and extends to the top of the challengs. int widgetHeight = top - getPaddingTop(); int frameHeight = top + getPaddingBottom(); setFrameHeight(frameHeight); if (updateWidgetSize) { setWidgetHeight(widgetHeight); } } /** /** * Depending on whether the security is up, the widget size needs to change * Depending on whether the security is up, the widget size needs to change * * * @param height The height of the widget, -1 for full height * @param height The height of the widget, -1 for full height */ */ public void setWidgetHeight(int height) { private void setWidgetHeight(int height) { System.out.println("Set widget height: " + this + " : " + height); boolean needLayout = false; boolean needLayout = false; View widget = getContent(); View widget = getContent(); if (widget != null) { if (widget != null) { Loading @@ -257,22 +289,56 @@ public class KeyguardWidgetFrame extends FrameLayout { } } } } /** public boolean isSmall() { * Set the top location of the challenge. return mIsSmall; * } * @param top The top of the challenge, in _local_ coordinates, or -1 to indicate the challenge * is down. public void adjustFrame(int challengeTop) { */ setChallengeTop(challengeTop, false); public void setChallengeTop(int top) { } // The widget starts below the padding, and extends to the top of the challengs. int widgetHeight = top - getPaddingTop(); public void shrinkWidget(int challengeTop) { setWidgetHeight(widgetHeight); mIsSmall = true; setChallengeTop(challengeTop, true); } } public void resetSize() { public void resetSize() { mIsSmall = false; setFrameHeight(getMeasuredHeight()); setWidgetHeight(LayoutParams.MATCH_PARENT); setWidgetHeight(LayoutParams.MATCH_PARENT); } } public void setFrameHeight(int height) { height = Math.min(height, getMeasuredHeight()); mBackgroundRect.set(0, 0, getMeasuredWidth(), height); invalidate(); } public void hideFrame(Object caller) { fadeFrame(caller, false, 0f, 150); } public void showFrame(Object caller) { fadeFrame(caller, true, 1f, 150); } public void fadeFrame(Object caller, boolean takeControl, float alpha, int duration) { if (takeControl) { mBgAlphaController = caller; } if (mBgAlphaController != caller) return; if (mFrameFade != null) { mFrameFade.cancel(); mFrameFade = null; } PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", alpha); mFrameFade = ObjectAnimator.ofPropertyValuesHolder(this, bgAlpha); mFrameFade.setDuration(duration); mFrameFade.start(); } @Override @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh); Loading @@ -285,6 +351,7 @@ public class KeyguardWidgetFrame extends FrameLayout { mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f, mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f, mGradientColor, 0, Shader.TileMode.CLAMP); mGradientColor, 0, Shader.TileMode.CLAMP); mBackgroundRect.set(0, 0, w, h); mBackgroundRect.set(0, 0, w, h); invalidate(); } } void setOverScrollAmount(float r, boolean left) { void setOverScrollAmount(float r, boolean left) { Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -433,9 +433,11 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit int count = getChildCount(); int count = getChildCount(); PropertyValuesHolder alpha; PropertyValuesHolder alpha; PropertyValuesHolder outlineAlpha; ArrayList<Animator> anims = new ArrayList<Animator>(); ArrayList<Animator> anims = new ArrayList<Animator>(); int duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION; int curPage = getNextPage(); int curPage = getNextPage(); for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) { float finalContentAlpha; float finalContentAlpha; Loading @@ -446,16 +448,15 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit } else { } else { finalContentAlpha = 0f; finalContentAlpha = 0f; } } float finalOutlineAlpha = show ? getAlphaForPage(mScreenCenter, i) : 0f; KeyguardWidgetFrame child = getWidgetPageAt(i); KeyguardWidgetFrame child = getWidgetPageAt(i); alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha); alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha); outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha",finalOutlineAlpha); ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha); ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha); anims.add(a); anims.add(a); float finalOutlineAlpha = show ? getAlphaForPage(mScreenCenter, i) : 0f; child.fadeFrame(this, show, finalOutlineAlpha, duration); } } int duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION; mChildrenOutlineFadeAnimation = new AnimatorSet(); mChildrenOutlineFadeAnimation = new AnimatorSet(); mChildrenOutlineFadeAnimation.playTogether(anims); mChildrenOutlineFadeAnimation.playTogether(anims); Loading policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.Rect; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; import android.view.Gravity; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/CheckLongPressHelper.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -60,8 +60,10 @@ public class CheckLongPressHelper { public void onMove(MotionEvent ev) { public void onMove(MotionEvent ev) { float x = ev.getX(); float x = ev.getX(); float y = ev.getY(); float y = ev.getY(); boolean xMoved = Math.abs(mDownX - x) > mScaledTouchSlop; boolean yMoved = Math.abs(mDownY - y) > mScaledTouchSlop; if (Math.sqrt(Math.pow(mDownX - x, 2) + Math.pow(mDownY - y, 2)) > mScaledTouchSlop) { if (xMoved || yMoved) { cancelLongPress(); cancelLongPress(); } } } } Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java +67 −32 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.view.View; public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChallengeScrolledListener { public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChallengeScrolledListener { private KeyguardWidgetPager mPagedView; private KeyguardWidgetPager mPagedView; private int mCurrentPageIndex; private ChallengeLayout mChallengeLayout; private ChallengeLayout mChallengeLayout; private Runnable mHideHintsRunnable; private Runnable mHideHintsRunnable; private KeyguardSecurityView mKeyguardSecurityContainer; private KeyguardSecurityView mKeyguardSecurityContainer; Loading @@ -31,6 +30,12 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle private static final int SCREEN_ON_RING_HINT_DELAY = 300; private static final int SCREEN_ON_RING_HINT_DELAY = 300; Handler mMainQueue = new Handler(Looper.myLooper()); Handler mMainQueue = new Handler(Looper.myLooper()); int mLastScrollState = SlidingChallengeLayout.SCROLL_STATE_IDLE; // Paged view state private int mPageListeningToSlider = -1; private int mCurrentPage = -1; int mChallengeTop = 0; int mChallengeTop = 0; public KeyguardViewStateManager() { public KeyguardViewStateManager() { Loading Loading @@ -66,28 +71,39 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle } } public void onPageSwitch(View newPage, int newPageIndex) { public void onPageSwitch(View newPage, int newPageIndex) { // Reset the previous page size and ensure the current page is sized appropriately // Reset the previous page size and ensure the current page is sized appropriately. if (mPagedView != null) { // We only modify the page state if it is not currently under control by the slider. KeyguardWidgetFrame oldPage = mPagedView.getWidgetPageAt(mCurrentPageIndex); // This prevents conflicts. // Reset the old widget page to full size if (mPagedView != null && mChallengeLayout != null) { if (oldPage != null) { KeyguardWidgetFrame prevPage = mPagedView.getWidgetPageAt(mCurrentPage); oldPage.resetSize(); if (prevPage != null && mCurrentPage != mPageListeningToSlider) { prevPage.resetSize(); } } KeyguardWidgetFrame newCurPage = mPagedView.getWidgetPageAt(newPageIndex); KeyguardWidgetFrame newCurPage = mPagedView.getWidgetPageAt(newPageIndex); if (mChallengeLayout.isChallengeOverlapping()) { boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); sizeWidgetFrameToChallengeTop(newCurPage); if (challengeOverlapping && !newCurPage.isSmall() && mPageListeningToSlider != newPageIndex) { shrinkWidget(newCurPage); } } } } mCurrentPageIndex = newPageIndex; mCurrentPage = newPageIndex; } } private void sizeWidgetFrameToChallengeTop(KeyguardWidgetFrame frame) { private int getChallengeTopRelativeToFrame(KeyguardWidgetFrame frame, int top) { if (frame == null) return; mTmpPoint[0] = 0; mTmpPoint[0] = 0; mTmpPoint[1] = mChallengeTop; mTmpPoint[1] = top; mapPoint((View) mChallengeLayout, frame, mTmpPoint); mapPoint((View) mChallengeLayout, frame, mTmpPoint); frame.setChallengeTop(mTmpPoint[1]); return mTmpPoint[1]; } private void shrinkWidget(KeyguardWidgetFrame frame) { if (frame != null && mChallengeLayout != null && mChallengeLayout instanceof SlidingChallengeLayout) { SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout; int top = scl.getMaxChallengeTop(); frame.shrinkWidget(getChallengeTopRelativeToFrame(frame, top)); } } } /** /** Loading @@ -114,20 +130,17 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle @Override @Override public void onScrollStateChanged(int scrollState) { public void onScrollStateChanged(int scrollState) { if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { if (mPagedView == null || mChallengeLayout == null) return; if (mPagedView == null) return; boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); boolean challengeOverlapping = mChallengeLayout.isChallengeOverlapping(); int curPage = mPagedView.getCurrentPage(); KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(curPage); if (frame != null) { if (scrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame == null) return; if (!challengeOverlapping) { if (!challengeOverlapping) { frame.resetSize(); frame.resetSize(); } else { sizeWidgetFrameToChallengeTop(frame); } } } frame.hideFrame(this); if (challengeOverlapping) { if (challengeOverlapping) { mPagedView.setOnlyAllowEdgeSwipes(true); mPagedView.setOnlyAllowEdgeSwipes(true); Loading @@ -140,10 +153,38 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle } else { } else { mKeyguardSecurityContainer.onPause(); mKeyguardSecurityContainer.onPause(); } } } else { mPageListeningToSlider = -1; } else if (mLastScrollState == SlidingChallengeLayout.SCROLL_STATE_IDLE) { // Whether dragging or settling, if the last state was idle, we use this signal // to update the current page who will receive events from the sliding challenge. // We resize the frame as appropriate. mPageListeningToSlider = mPagedView.getNextPage(); KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame == null) return; frame.showFrame(this); // As soon as the security begins sliding, the widget becomes small (if it wasn't // small to begin with). if (!frame.isSmall()) { // We need to fetch the final page, in case the pages are in motion. mPageListeningToSlider = mPagedView.getNextPage(); System.out.println("Shrink widget from scroll state changed!"); shrinkWidget(frame); } // View is on the move. Pause the security view until it completes. // View is on the move. Pause the security view until it completes. mKeyguardSecurityContainer.onPause(); mKeyguardSecurityContainer.onPause(); } } mLastScrollState = scrollState; } @Override public void onScrollPositionChanged(float scrollPosition, int challengeTop) { mChallengeTop = challengeTop; KeyguardWidgetFrame frame = mPagedView.getWidgetPageAt(mPageListeningToSlider); if (frame != null) { frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop)); } } } public void showUsabilityHints() { public void showUsabilityHints() { Loading @@ -164,10 +205,4 @@ public class KeyguardViewStateManager implements SlidingChallengeLayout.OnChalle mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_HINT_DURATION); mMainQueue.postDelayed(mHideHintsRunnable, SCREEN_ON_HINT_DURATION); } } @Override public void onScrollPositionChanged(float scrollPosition, int challengeTop) { mChallengeTop = challengeTop; } } }
policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java +78 −11 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.policy.impl.keyguard; package com.android.internal.policy.impl.keyguard; import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetHostView; import android.content.Context; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources; Loading Loading @@ -49,6 +52,8 @@ public class KeyguardWidgetFrame extends FrameLayout { private final Rect mForegroundRect = new Rect(); private final Rect mForegroundRect = new Rect(); private int mForegroundAlpha = 0; private int mForegroundAlpha = 0; private CheckLongPressHelper mLongPressHelper; private CheckLongPressHelper mLongPressHelper; private Animator mFrameFade; private boolean mIsSmall = false; private float mBackgroundAlpha; private float mBackgroundAlpha; private float mContentAlpha; private float mContentAlpha; Loading @@ -56,6 +61,11 @@ public class KeyguardWidgetFrame extends FrameLayout { private Drawable mBackgroundDrawable; private Drawable mBackgroundDrawable; private Rect mBackgroundRect = new Rect(); private Rect mBackgroundRect = new Rect(); // Multiple callers may try and adjust the alpha of the frame. When a caller shows // the outlines, we give that caller control, and nobody else can fade them out. // This prevents animation conflicts. private Object mBgAlphaController; public KeyguardWidgetFrame(Context context) { public KeyguardWidgetFrame(Context context) { this(context, null, 0); this(context, null, 0); } } Loading @@ -80,6 +90,11 @@ public class KeyguardWidgetFrame extends FrameLayout { mGradientPaint.setXfermode(sAddBlendMode); mGradientPaint.setXfermode(sAddBlendMode); } } @Override protected void onDetachedFromWindow() { cancelLongPress(); } @Override @Override public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) { // Watch for longpress events at this level to make sure // Watch for longpress events at this level to make sure Loading Loading @@ -237,12 +252,29 @@ public class KeyguardWidgetFrame extends FrameLayout { } } } } /** * Set the top location of the challenge. * * @param top The top of the challenge, in _local_ coordinates, or -1 to indicate the challenge * is down. */ private void setChallengeTop(int top, boolean updateWidgetSize) { // The widget starts below the padding, and extends to the top of the challengs. int widgetHeight = top - getPaddingTop(); int frameHeight = top + getPaddingBottom(); setFrameHeight(frameHeight); if (updateWidgetSize) { setWidgetHeight(widgetHeight); } } /** /** * Depending on whether the security is up, the widget size needs to change * Depending on whether the security is up, the widget size needs to change * * * @param height The height of the widget, -1 for full height * @param height The height of the widget, -1 for full height */ */ public void setWidgetHeight(int height) { private void setWidgetHeight(int height) { System.out.println("Set widget height: " + this + " : " + height); boolean needLayout = false; boolean needLayout = false; View widget = getContent(); View widget = getContent(); if (widget != null) { if (widget != null) { Loading @@ -257,22 +289,56 @@ public class KeyguardWidgetFrame extends FrameLayout { } } } } /** public boolean isSmall() { * Set the top location of the challenge. return mIsSmall; * } * @param top The top of the challenge, in _local_ coordinates, or -1 to indicate the challenge * is down. public void adjustFrame(int challengeTop) { */ setChallengeTop(challengeTop, false); public void setChallengeTop(int top) { } // The widget starts below the padding, and extends to the top of the challengs. int widgetHeight = top - getPaddingTop(); public void shrinkWidget(int challengeTop) { setWidgetHeight(widgetHeight); mIsSmall = true; setChallengeTop(challengeTop, true); } } public void resetSize() { public void resetSize() { mIsSmall = false; setFrameHeight(getMeasuredHeight()); setWidgetHeight(LayoutParams.MATCH_PARENT); setWidgetHeight(LayoutParams.MATCH_PARENT); } } public void setFrameHeight(int height) { height = Math.min(height, getMeasuredHeight()); mBackgroundRect.set(0, 0, getMeasuredWidth(), height); invalidate(); } public void hideFrame(Object caller) { fadeFrame(caller, false, 0f, 150); } public void showFrame(Object caller) { fadeFrame(caller, true, 1f, 150); } public void fadeFrame(Object caller, boolean takeControl, float alpha, int duration) { if (takeControl) { mBgAlphaController = caller; } if (mBgAlphaController != caller) return; if (mFrameFade != null) { mFrameFade.cancel(); mFrameFade = null; } PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", alpha); mFrameFade = ObjectAnimator.ofPropertyValuesHolder(this, bgAlpha); mFrameFade.setDuration(duration); mFrameFade.start(); } @Override @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh); Loading @@ -285,6 +351,7 @@ public class KeyguardWidgetFrame extends FrameLayout { mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f, mRightToLeftGradient = new LinearGradient(x1, 0f, x0, 0f, mGradientColor, 0, Shader.TileMode.CLAMP); mGradientColor, 0, Shader.TileMode.CLAMP); mBackgroundRect.set(0, 0, w, h); mBackgroundRect.set(0, 0, w, h); invalidate(); } } void setOverScrollAmount(float r, boolean left) { void setOverScrollAmount(float r, boolean left) { Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -433,9 +433,11 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit int count = getChildCount(); int count = getChildCount(); PropertyValuesHolder alpha; PropertyValuesHolder alpha; PropertyValuesHolder outlineAlpha; ArrayList<Animator> anims = new ArrayList<Animator>(); ArrayList<Animator> anims = new ArrayList<Animator>(); int duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION; int curPage = getNextPage(); int curPage = getNextPage(); for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) { float finalContentAlpha; float finalContentAlpha; Loading @@ -446,16 +448,15 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit } else { } else { finalContentAlpha = 0f; finalContentAlpha = 0f; } } float finalOutlineAlpha = show ? getAlphaForPage(mScreenCenter, i) : 0f; KeyguardWidgetFrame child = getWidgetPageAt(i); KeyguardWidgetFrame child = getWidgetPageAt(i); alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha); alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha); outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha",finalOutlineAlpha); ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha); ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha); anims.add(a); anims.add(a); float finalOutlineAlpha = show ? getAlphaForPage(mScreenCenter, i) : 0f; child.fadeFrame(this, show, finalOutlineAlpha, duration); } } int duration = show ? CHILDREN_OUTLINE_FADE_IN_DURATION : CHILDREN_OUTLINE_FADE_OUT_DURATION; mChildrenOutlineFadeAnimation = new AnimatorSet(); mChildrenOutlineFadeAnimation = new AnimatorSet(); mChildrenOutlineFadeAnimation.playTogether(anims); mChildrenOutlineFadeAnimation.playTogether(anims); Loading
policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.Rect; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; import android.view.Gravity; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; Loading