Skip to content

Commit 44dc141

Browse files
author
Adam Cohen
committed
Clean up some flashy jank (issue 7454766)
Change-Id: I809f3afbbb70e82847aa4851d20058a2c483a32e
1 parent d51700b commit 44dc141

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ public void onScrollStateChanged(int scrollState) {
214214
mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(mPageListeningToSlider);
215215
}
216216
}
217+
if (frame.isSmall()) {
218+
// This is to make sure that if the scroller animation gets cut off midway
219+
// that the frame doesn't stay in a partial down position.
220+
frame.setFrameHeight(frame.getSmallFrameHeight());
221+
}
217222
if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
218223
frame.hideFrame(this);
219224
}
@@ -244,7 +249,7 @@ public void onScrollStateChanged(int scrollState) {
244249
if (!frame.isSmall()) {
245250
// We need to fetch the final page, in case the pages are in motion.
246251
mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
247-
frame.shrinkWidget();
252+
frame.shrinkWidget(false);
248253
}
249254
} else {
250255
if (!frame.isSmall()) {
@@ -263,7 +268,7 @@ public void onScrollStateChanged(int scrollState) {
263268
public void onScrollPositionChanged(float scrollPosition, int challengeTop) {
264269
mChallengeTop = challengeTop;
265270
KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
266-
if (frame != null && !mKeyguardWidgetPager.isPageMoving()) {
271+
if (frame != null && mLastScrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
267272
frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop));
268273
}
269274
}

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ private void setWidgetHeight(int height) {
329329

330330
public void setMaxChallengeTop(int top) {
331331
boolean dirty = mMaxChallengeTop != top;
332+
mMaxChallengeTop = top;
332333
mSmallWidgetHeight = top - getPaddingTop();
333334
mSmallFrameHeight = top + getPaddingBottom();
334335
if (dirty && mIsSmall) {
@@ -348,10 +349,21 @@ public void adjustFrame(int challengeTop) {
348349
setFrameHeight(frameHeight);
349350
}
350351

351-
public void shrinkWidget() {
352+
public void shrinkWidget(boolean alsoShrinkFrame) {
352353
mIsSmall = true;
353354
setWidgetHeight(mSmallWidgetHeight);
354-
setFrameHeight(mSmallFrameHeight);
355+
356+
if (alsoShrinkFrame) {
357+
setFrameHeight(mSmallFrameHeight);
358+
}
359+
}
360+
361+
public int getSmallFrameHeight() {
362+
return mSmallFrameHeight;
363+
}
364+
365+
public void shrinkWidget() {
366+
shrinkWidget(true);
355367
}
356368

357369
public void setWidgetLockedSmall(boolean locked) {

0 commit comments

Comments
 (0)