Merge "Remove the custom clock from LS during transition from AOD" into qt-r1-dev am: 5fccfe7491

am: 90509b2d16

Change-Id: I2a62766c01cc5bbc5803d114a59ec5c51cb06c46
This commit is contained in:
Robert Snoeberger
2019-06-20 16:05:12 -07:00
committed by android-build-merger
3 changed files with 47 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import android.content.Context;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.os.Build;
import android.transition.Fade;
import android.transition.Transition;
import android.transition.TransitionListenerAdapter;
import android.transition.TransitionManager;
@@ -115,6 +116,11 @@ public class KeyguardClockSwitch extends RelativeLayout {
*/
private float mDarkAmount;
/**
* Boolean value indicating if notifications are visible on lock screen.
*/
private boolean mHasVisibleNotifications;
/**
* If the Keyguard Slice has a header (big center-aligned text.)
*/
@@ -325,6 +331,24 @@ public class KeyguardClockSwitch extends RelativeLayout {
if (mClockPlugin != null) {
mClockPlugin.setDarkAmount(darkAmount);
}
updateBigClockAlpha();
}
/**
* Set whether or not the lock screen is showing notifications.
*/
void setHasVisibleNotifications(boolean hasVisibleNotifications) {
if (hasVisibleNotifications == mHasVisibleNotifications) {
return;
}
mHasVisibleNotifications = hasVisibleNotifications;
if (mDarkAmount == 0f && mBigClockContainer != null) {
// Starting a fade transition since the visibility of the big clock will change.
TransitionManager.beginDelayedTransition(mBigClockContainer,
new Fade().setDuration(KeyguardSliceView.DEFAULT_ANIM_DURATION / 2).addTarget(
mBigClockContainer));
}
updateBigClockAlpha();
}
public Paint getPaint() {
@@ -401,6 +425,18 @@ public class KeyguardClockSwitch extends RelativeLayout {
}
}
private void updateBigClockAlpha() {
if (mBigClockContainer != null) {
final float alpha = mHasVisibleNotifications ? mDarkAmount : 1f;
mBigClockContainer.setAlpha(alpha);
if (alpha == 0f) {
mBigClockContainer.setVisibility(INVISIBLE);
} else if (mBigClockContainer.getVisibility() == INVISIBLE) {
mBigClockContainer.setVisibility(VISIBLE);
}
}
}
/**
* Sets if the keyguard slice is showing a center-aligned header. We need a smaller clock in
* these cases.

View File

@@ -145,6 +145,13 @@ public class KeyguardStatusView extends GridLayout implements
return mClockView.hasCustomClock();
}
/**
* Set whether or not the lock screen is showing notifications.
*/
public void setHasVisibleNotifications(boolean hasVisibleNotifications) {
mClockView.setHasVisibleNotifications(hasVisibleNotifications);
}
private void setEnableMarquee(boolean enabled) {
if (DEBUG) Log.v(TAG, "Schedule setEnableMarquee: " + (enabled ? "Enable" : "Disable"));
if (enabled) {

View File

@@ -710,6 +710,9 @@ public class NotificationPanelView extends PanelView implements
int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
int clockPreferredY = mKeyguardStatusView.getClockPreferredY(totalHeight);
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
final boolean hasVisibleNotifications =
!bypassEnabled && mNotificationStackScroller.getVisibleNotificationCount() != 0;
mKeyguardStatusView.setHasVisibleNotifications(hasVisibleNotifications);
mClockPositionAlgorithm.setup(
mStatusBarMinHeight,
totalHeight - bottomPadding,
@@ -720,7 +723,7 @@ public class NotificationPanelView extends PanelView implements
- mShelfHeight / 2.0f - mDarkIconSize / 2.0f),
clockPreferredY,
hasCustomClock(),
mNotificationStackScroller.getVisibleNotificationCount() != 0,
hasVisibleNotifications,
mInterpolatedDarkAmount,
mEmptyDragAmount,
bypassEnabled,