Add transition animation for weather clock in split shade
Test: manually on Tablet Bug: 279729045 Change-Id: I546538f3570b849c6738871713fa85563a74a573
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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? {
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user