diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-06-08 03:38:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-06-08 03:38:01 +0000 |
commit | c28e772042cb0b8a2d6867df20ea40ea13a04bc7 (patch) | |
tree | cc147b11fb46e77e71196c7d66ef4f607da65ae7 | |
parent | 97995da6e1d40a053402cc120944e3738a18d1a0 (diff) | |
parent | 09952ee560cdfaa8b5b69c184390b8ae24f0c1af (diff) | |
download | base-c28e772042cb0b8a2d6867df20ea40ea13a04bc7.tar.gz |
Merge "Animate owner info during wake-up transition" into pi-dev
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 49dba6833a3a..41df196c62b0 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -282,6 +282,7 @@ public class KeyguardStatusView extends GridLayout implements mClockView.setPivotX(mClockView.getWidth() / 2); mClockView.setPivotY(0); mLastLayoutHeight = getHeight(); + layoutOwnerInfo(); } @Override @@ -418,9 +419,11 @@ public class KeyguardStatusView extends GridLayout implements if (mLogoutView != null) { mLogoutView.setAlpha(dark ? 0 : 1); } + if (mOwnerInfo != null) { boolean hasText = !TextUtils.isEmpty(mOwnerInfo.getText()); - mOwnerInfo.setVisibility(hasText && mDarkAmount != 1 ? VISIBLE : GONE); + mOwnerInfo.setVisibility(hasText ? VISIBLE : GONE); + layoutOwnerInfo(); } final int blendedTextColor = ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount); @@ -430,6 +433,20 @@ public class KeyguardStatusView extends GridLayout implements mClockSeparator.setBackgroundColor(blendedTextColor); } + private void layoutOwnerInfo() { + if (mOwnerInfo != null && mOwnerInfo.getVisibility() != GONE) { + // Animate owner info during wake-up transition + mOwnerInfo.setAlpha(1f - mDarkAmount); + + float ratio = mDarkAmount; + // Calculate how much of it we should crop in order to have a smooth transition + int collapsed = mOwnerInfo.getTop() - mOwnerInfo.getPaddingTop(); + int expanded = mOwnerInfo.getBottom() + mOwnerInfo.getPaddingBottom(); + int toRemove = (int) ((expanded - collapsed) * ratio); + setBottom(getMeasuredHeight() - toRemove); + } + } + public void setPulsing(boolean pulsing, boolean animate) { mPulsing = pulsing; mKeyguardSlice.setPulsing(pulsing, animate); |