Merge "Add transition animation for weather clock in split shade" into udc-dev am: 24e09b6686

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23353623

Change-Id: I23a92b752f6e053a08c1fde39e77f06a2d087660
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-26 23:01:10 +00:00
committed by Automerger Merge Worker
4 changed files with 23 additions and 8 deletions

View File

@@ -50,6 +50,7 @@ class DefaultClockController(
private val layoutInflater: LayoutInflater, private val layoutInflater: LayoutInflater,
private val resources: Resources, private val resources: Resources,
private val settings: ClockSettings?, private val settings: ClockSettings?,
private val hasStepClockAnimation: Boolean = false,
) : ClockController { ) : ClockController {
override val smallClock: DefaultClockFaceController override val smallClock: DefaultClockFaceController
override val largeClock: LargeClockFaceController override val largeClock: LargeClockFaceController
@@ -170,7 +171,8 @@ class DefaultClockController(
view: AnimatableClockView, view: AnimatableClockView,
seedColor: Int?, seedColor: Int?,
) : DefaultClockFaceController(view, seedColor) { ) : DefaultClockFaceController(view, seedColor) {
override val config = ClockFaceConfig(hasCustomPositionUpdatedAnimation = true) override val config =
ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation)
init { init {
animations = LargeClockAnimations(view, 0f, 0f) animations = LargeClockAnimations(view, 0f, 0f)

View File

@@ -29,10 +29,11 @@ const val DEFAULT_CLOCK_NAME = "Default Clock"
const val DEFAULT_CLOCK_ID = "DEFAULT" const val DEFAULT_CLOCK_ID = "DEFAULT"
/** Provides the default system clock */ /** Provides the default system clock */
class DefaultClockProvider constructor( class DefaultClockProvider(
val ctx: Context, val ctx: Context,
val layoutInflater: LayoutInflater, val layoutInflater: LayoutInflater,
val resources: Resources val resources: Resources,
val hasStepClockAnimation: Boolean = false
) : ClockProvider { ) : ClockProvider {
override fun getClocks(): List<ClockMetadata> = override fun getClocks(): List<ClockMetadata> =
listOf(ClockMetadata(DEFAULT_CLOCK_ID, DEFAULT_CLOCK_NAME)) listOf(ClockMetadata(DEFAULT_CLOCK_ID, DEFAULT_CLOCK_NAME))
@@ -42,7 +43,13 @@ class DefaultClockProvider constructor(
throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG") throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG")
} }
return DefaultClockController(ctx, layoutInflater, resources, settings) return DefaultClockController(
ctx,
layoutInflater,
resources,
settings,
hasStepClockAnimation,
)
} }
override fun getClockThumbnail(id: ClockId): Drawable? { override fun getClockThumbnail(id: ClockId): Drawable? {

View File

@@ -46,7 +46,6 @@ import com.android.keyguard.KeyguardClockSwitch.ClockSize;
import com.android.keyguard.logging.KeyguardLogger; import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.ClockController; import com.android.systemui.plugins.ClockController;
import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.PropertyAnimator;
@@ -363,7 +362,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
boolean customClockAnimation = clock != null boolean customClockAnimation = clock != null
&& clock.getLargeClock().getConfig().getHasCustomPositionUpdatedAnimation(); && clock.getLargeClock().getConfig().getHasCustomPositionUpdatedAnimation();
if (mFeatureFlags.isEnabled(Flags.STEP_CLOCK_ANIMATION) && customClockAnimation) { if (customClockAnimation) {
// Find the clock, so we can exclude it from this transition. // Find the clock, so we can exclude it from this transition.
FrameLayout clockContainerView = mView.findViewById(R.id.lockscreen_clock_view_large); FrameLayout clockContainerView = mView.findViewById(R.id.lockscreen_clock_view_large);
@@ -400,8 +399,10 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
@VisibleForTesting @VisibleForTesting
static class SplitShadeTransitionAdapter extends Transition { static class SplitShadeTransitionAdapter extends Transition {
private static final String PROP_BOUNDS_LEFT = "splitShadeTransitionAdapter:boundsLeft"; private static final String PROP_BOUNDS_LEFT = "splitShadeTransitionAdapter:boundsLeft";
private static final String PROP_BOUNDS_RIGHT = "splitShadeTransitionAdapter:boundsRight";
private static final String PROP_X_IN_WINDOW = "splitShadeTransitionAdapter:xInWindow"; private static final String PROP_X_IN_WINDOW = "splitShadeTransitionAdapter:xInWindow";
private static final String[] TRANSITION_PROPERTIES = { PROP_BOUNDS_LEFT, PROP_X_IN_WINDOW}; private static final String[] TRANSITION_PROPERTIES = {
PROP_BOUNDS_LEFT, PROP_BOUNDS_RIGHT, PROP_X_IN_WINDOW};
private final KeyguardClockSwitchController mController; private final KeyguardClockSwitchController mController;
@@ -412,6 +413,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
private void captureValues(TransitionValues transitionValues) { private void captureValues(TransitionValues transitionValues) {
transitionValues.values.put(PROP_BOUNDS_LEFT, transitionValues.view.getLeft()); transitionValues.values.put(PROP_BOUNDS_LEFT, transitionValues.view.getLeft());
transitionValues.values.put(PROP_BOUNDS_RIGHT, transitionValues.view.getRight());
int[] locationInWindowTmp = new int[2]; int[] locationInWindowTmp = new int[2];
transitionValues.view.getLocationInWindow(locationInWindowTmp); transitionValues.view.getLocationInWindow(locationInWindowTmp);
transitionValues.values.put(PROP_X_IN_WINDOW, locationInWindowTmp[0]); transitionValues.values.put(PROP_X_IN_WINDOW, locationInWindowTmp[0]);

View File

@@ -63,7 +63,11 @@ public abstract class ClockRegistryModule {
bgDispatcher, bgDispatcher,
featureFlags.isEnabled(Flags.LOCKSCREEN_CUSTOM_CLOCKS), featureFlags.isEnabled(Flags.LOCKSCREEN_CUSTOM_CLOCKS),
/* handleAllUsers= */ true, /* handleAllUsers= */ true,
new DefaultClockProvider(context, layoutInflater, resources), new DefaultClockProvider(
context,
layoutInflater,
resources,
featureFlags.isEnabled(Flags.STEP_CLOCK_ANIMATION)),
context.getString(R.string.lockscreen_clock_id_fallback), context.getString(R.string.lockscreen_clock_id_fallback),
logBuffer, logBuffer,
/* keepAllLoaded = */ false, /* keepAllLoaded = */ false,