summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
diff options
context:
space:
mode:
authorBrian Orr <brianorr@google.com>2021-06-15 12:47:53 -0700
committerDaniel Norman <danielnorman@google.com>2021-06-17 13:37:54 -0700
commit71c831703ae59baf47e0afe611fecd714c481cdf (patch)
tree06731a987032723085b9e1a65951cf96abbc19cf /packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
parent065c9e9a6e9d61d4383a91721eb56a3de253bdbe (diff)
parent81833820d54b9a6b27894f9f8dfd72222d416992 (diff)
Merge SP1A.210604.001
Change-Id: I5200ee05285ae422d5e9c1c00f45709a5d6188be
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java80
1 files changed, 64 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
index baf34589770c..fbea1e9a594d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
@@ -32,8 +32,10 @@ import com.android.keyguard.clock.ClockManager;
import com.android.systemui.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.plugins.ClockPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController;
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator;
@@ -44,7 +46,9 @@ import com.android.systemui.statusbar.phone.NotificationIconContainer;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.util.ViewController;
+import java.util.HashSet;
import java.util.Locale;
+import java.util.Set;
import java.util.TimeZone;
import javax.inject.Inject;
@@ -92,6 +96,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
// If set, will replace keyguard_status_area
private View mSmartspaceView;
+ private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
+ private SmartspaceTransitionController mSmartspaceTransitionController;
+
@Inject
public KeyguardClockSwitchController(
KeyguardClockSwitch keyguardClockSwitch,
@@ -104,7 +111,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
BatteryController batteryController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardBypassController bypassController,
- LockscreenSmartspaceController smartspaceController) {
+ LockscreenSmartspaceController smartspaceController,
+ KeyguardUnlockAnimationController keyguardUnlockAnimationController,
+ SmartspaceTransitionController smartspaceTransitionController) {
super(keyguardClockSwitch);
mStatusBarStateController = statusBarStateController;
mColorExtractor = colorExtractor;
@@ -116,6 +125,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mBypassController = bypassController;
mSmartspaceController = smartspaceController;
+
+ mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
+ mSmartspaceTransitionController = smartspaceTransitionController;
}
/**
@@ -124,16 +136,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
@Override
public void onInit() {
mKeyguardSliceViewController.init();
- }
-
- @Override
- protected void onViewAttached() {
- if (CUSTOM_CLOCKS_ENABLED) {
- mClockManager.addOnClockChangedListener(mClockChangedListener);
- }
- mColorExtractor.addOnColorsChangedListener(mColorsListener);
- mView.updateColors(getGradientColors());
- updateAodIcons();
mClockFrame = mView.findViewById(R.id.lockscreen_clock_view);
mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large);
@@ -157,6 +159,16 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mKeyguardUpdateMonitor,
mBypassController);
mLargeClockViewController.init();
+ }
+
+ @Override
+ protected void onViewAttached() {
+ if (CUSTOM_CLOCKS_ENABLED) {
+ mClockManager.addOnClockChangedListener(mClockChangedListener);
+ }
+ mColorExtractor.addOnColorsChangedListener(mColorsListener);
+ mView.updateColors(getGradientColors());
+ updateAodIcons();
if (mSmartspaceController.isEnabled()) {
mSmartspaceView = mSmartspaceController.buildAndConnectView(mView);
@@ -171,9 +183,11 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view);
mView.addView(mSmartspaceView, ksaIndex, lp);
- int padding = getContext().getResources()
+ int startPadding = getContext().getResources()
.getDimensionPixelSize(R.dimen.below_clock_padding_start);
- mSmartspaceView.setPadding(padding, 0, padding, 0);
+ int endPadding = getContext().getResources()
+ .getDimensionPixelSize(R.dimen.below_clock_padding_end);
+ mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0);
// ... but above the large clock
lp = new RelativeLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
@@ -185,6 +199,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
lp = (RelativeLayout.LayoutParams) nic.getLayoutParams();
lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId());
nic.setLayoutParams(lp);
+
+ mView.setSmartspaceView(mSmartspaceView);
+ mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView);
}
}
@@ -220,7 +237,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
* Set whether or not the lock screen is showing notifications.
*/
public void setHasVisibleNotifications(boolean hasVisibleNotifications) {
- mView.setHasVisibleNotifications(hasVisibleNotifications);
+ if (mView.willSwitchToLargeClock(hasVisibleNotifications)) {
+ mLargeClockViewController.animateAppear();
+ }
}
/**
@@ -255,6 +274,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mClockViewController.refreshTime();
mLargeClockViewController.refreshTime();
}
+ if (mSmartspaceController != null) {
+ mSmartspaceController.requestSmartspaceUpdate();
+ }
mView.refresh();
}
@@ -278,12 +300,40 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
if (mSmartspaceView != null) {
PropertyAnimator.setProperty(mSmartspaceView, AnimatableProperty.TRANSLATION_X,
x, props, animate);
+
+ // If we're unlocking with the SmartSpace shared element transition, let the controller
+ // know that it should re-position our SmartSpace.
+ if (mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
+ mKeyguardUnlockAnimationController.updateLockscreenSmartSpacePosition();
+ }
}
mKeyguardSliceViewController.updatePosition(x, props, animate);
mNotificationIconAreaController.updatePosition(x, props, animate);
}
+ /** Sets an alpha value on every child view except for the smartspace. */
+ public void setChildrenAlphaExcludingSmartspace(float alpha) {
+ final Set<View> excludedViews = new HashSet<>();
+
+ if (mSmartspaceView != null) {
+ excludedViews.add(mSmartspaceView);
+ }
+
+ setChildrenAlphaExcluding(alpha, excludedViews);
+ }
+
+ /** Sets an alpha value on every child view except for the views in the provided set. */
+ public void setChildrenAlphaExcluding(float alpha, Set<View> excludedViews) {
+ for (int i = 0; i < mView.getChildCount(); i++) {
+ final View child = mView.getChildAt(i);
+
+ if (!excludedViews.contains(child)) {
+ child.setAlpha(alpha);
+ }
+ }
+ }
+
void updateTimeZone(TimeZone timeZone) {
mView.onTimeZoneChanged(timeZone);
if (mClockViewController != null) {
@@ -303,8 +353,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
NotificationIconContainer nic = (NotificationIconContainer)
mView.findViewById(
com.android.systemui.R.id.left_aligned_notification_icon_container);
-
- // alt icon area is set in KeyguardClockSwitchController
mNotificationIconAreaController.setupAodIcons(nic);
}