Skip to content

Commit ab8635d

Browse files
author
Adam Cohen
committed
Fix content alpha
Change-Id: I13e8ad73baf768976240c1c7c5a2cb05d5d62061
1 parent d76b320 commit ab8635d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,13 @@ public float getAlphaForPage(int screenCenter, int index) {
6060
View child = getChildAt(index);
6161
if (child == null) return 0f;
6262

63-
float maxAlpha = KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER;
64-
6563
float scrollProgress = getScrollProgress(screenCenter, child, index);
6664
if (!isOverScrollChild(index, scrollProgress)) {
6765
scrollProgress = getBoundedScrollProgress(screenCenter, child, index);
68-
float alpha = maxAlpha - maxAlpha * Math.abs(scrollProgress / MAX_SCROLL_PROGRESS);
66+
float alpha = 1.0f - 1.0f * Math.abs(scrollProgress / MAX_SCROLL_PROGRESS);
6967
return alpha;
7068
} else {
71-
return maxAlpha;
69+
return 1.0f;
7270
}
7371
}
7472

@@ -81,9 +79,8 @@ private void updatePageAlphaValues(int screenCenter) {
8179
for (int i = 0; i < getChildCount(); i++) {
8280
KeyguardWidgetFrame child = getWidgetPageAt(i);
8381
if (child != null) {
84-
float alpha = getAlphaForPage(screenCenter, i);
85-
child.setBackgroundAlpha(alpha);
86-
child.setContentAlpha(alpha);
82+
child.setBackgroundAlpha(getOutlineAlphaForPage(screenCenter, i));
83+
child.setContentAlpha(getAlphaForPage(screenCenter, i));
8784
}
8885
}
8986
}
@@ -144,7 +141,8 @@ void animatePagesToNeutral() {
144141
child.setRotationY(0f);
145142
}
146143
alpha = PropertyValuesHolder.ofFloat("contentAlpha", 1.0f);
147-
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 1.0f);
144+
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha",
145+
KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER);
148146
rotationY = PropertyValuesHolder.ofFloat("rotationY", 0f);
149147
ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha, outlineAlpha, rotationY);
150148
child.setVisibility(VISIBLE);
@@ -212,13 +210,14 @@ void animatePagesToCarousel() {
212210
for (int i = 0; i < count; i++) {
213211
KeyguardWidgetFrame child = getWidgetPageAt(i);
214212
float finalAlpha = getAlphaForPage(mScreenCenter, i);
213+
float finalOutlineAlpha = getOutlineAlphaForPage(mScreenCenter, i);
215214
getTransformForPage(mScreenCenter, i, mTmpTransform);
216215

217216
boolean inVisibleRange = (i >= mCurrentPage - 1 && i <= mCurrentPage + 1);
218217

219218
ObjectAnimator a;
220219
alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalAlpha);
221-
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", finalAlpha);
220+
outlineAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", finalOutlineAlpha);
222221
pivotX = PropertyValuesHolder.ofFloat("pivotX", mTmpTransform[0]);
223222
pivotY = PropertyValuesHolder.ofFloat("pivotY", mTmpTransform[1]);
224223
rotationY = PropertyValuesHolder.ofFloat("rotationY", mTmpTransform[2]);

0 commit comments

Comments
 (0)