Skip to content

Commit 1e0f6fa

Browse files
Adam CohenAndroid (Google) Code Review
authored andcommitted
Merge "Clean up some flashy jank (issue 7454766)" into jb-mr1-lockscreen-dev
2 parents 70c2f87 + 44dc141 commit 1e0f6fa

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
@@ -220,6 +220,11 @@ public void onScrollStateChanged(int scrollState) {
220220
mKeyguardWidgetPager.setWidgetToResetOnPageFadeOut(mPageListeningToSlider);
221221
}
222222
}
223+
if (frame.isSmall()) {
224+
// This is to make sure that if the scroller animation gets cut off midway
225+
// that the frame doesn't stay in a partial down position.
226+
frame.setFrameHeight(frame.getSmallFrameHeight());
227+
}
223228
if (scrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
224229
frame.hideFrame(this);
225230
}
@@ -250,7 +255,7 @@ public void onScrollStateChanged(int scrollState) {
250255
if (!frame.isSmall()) {
251256
// We need to fetch the final page, in case the pages are in motion.
252257
mPageListeningToSlider = mKeyguardWidgetPager.getNextPage();
253-
frame.shrinkWidget();
258+
frame.shrinkWidget(false);
254259
}
255260
} else {
256261
if (!frame.isSmall()) {
@@ -269,7 +274,7 @@ public void onScrollStateChanged(int scrollState) {
269274
public void onScrollPositionChanged(float scrollPosition, int challengeTop) {
270275
mChallengeTop = challengeTop;
271276
KeyguardWidgetFrame frame = mKeyguardWidgetPager.getWidgetPageAt(mPageListeningToSlider);
272-
if (frame != null && !mKeyguardWidgetPager.isPageMoving()) {
277+
if (frame != null && mLastScrollState != SlidingChallengeLayout.SCROLL_STATE_FADING) {
273278
frame.adjustFrame(getChallengeTopRelativeToFrame(frame, mChallengeTop));
274279
}
275280
}

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)