Merge "Add transition animation for weather clock in split shade" into udc-dev

This commit is contained in:
Treehugger Robot
2023-05-26 21:05:10 +00:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 8 deletions

View File

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

View File

@@ -29,10 +29,11 @@ const val DEFAULT_CLOCK_NAME = "Default Clock"
const val DEFAULT_CLOCK_ID = "DEFAULT"
/** Provides the default system clock */
class DefaultClockProvider constructor(
class DefaultClockProvider(
val ctx: Context,
val layoutInflater: LayoutInflater,
val resources: Resources
val resources: Resources,
val hasStepClockAnimation: Boolean = false
) : ClockProvider {
override fun getClocks(): List<ClockMetadata> =
listOf(ClockMetadata(DEFAULT_CLOCK_ID, DEFAULT_CLOCK_NAME))
@@ -42,7 +43,13 @@ class DefaultClockProvider constructor(
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? {

View File

@@ -46,7 +46,6 @@ import com.android.keyguard.KeyguardClockSwitch.ClockSize;
import com.android.keyguard.logging.KeyguardLogger;
import com.android.systemui.R;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.ClockController;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.PropertyAnimator;
@@ -363,7 +362,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
boolean customClockAnimation = clock != null
&& 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.
FrameLayout clockContainerView = mView.findViewById(R.id.lockscreen_clock_view_large);
@@ -400,8 +399,10 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
@VisibleForTesting
static class SplitShadeTransitionAdapter extends Transition {
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[] 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;
@@ -412,6 +413,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
private void captureValues(TransitionValues transitionValues) {
transitionValues.values.put(PROP_BOUNDS_LEFT, transitionValues.view.getLeft());
transitionValues.values.put(PROP_BOUNDS_RIGHT, transitionValues.view.getRight());
int[] locationInWindowTmp = new int[2];
transitionValues.view.getLocationInWindow(locationInWindowTmp);
transitionValues.values.put(PROP_X_IN_WINDOW, locationInWindowTmp[0]);

View File

@@ -63,7 +63,11 @@ public abstract class ClockRegistryModule {
bgDispatcher,
featureFlags.isEnabled(Flags.LOCKSCREEN_CUSTOM_CLOCKS),
/* 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),
logBuffer,
/* keepAllLoaded = */ false,