From 435bbfb97271a0d24a52e94b2d67cfb3482198d2 Mon Sep 17 00:00:00 2001 From: Sherry Zhou Date: Wed, 19 Apr 2023 22:10:48 +0000 Subject: [PATCH] Fix default clock moving up in picker preview Test: Manually Bug: 277929406 Change-Id: I9befc75fb42527058709217bebf972aa21ab2aa4 --- .../systemui/shared/clocks/DefaultClockController.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt index 6ca7f12e842bf..3fda83d7b6f4d 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt @@ -263,6 +263,13 @@ class DefaultClockController( view.animateDoze(dozeState.isActive, !hasJumped) } } + + override fun onPickerCarouselSwiping(swipingFraction: Float, previewRatio: Float) { + // TODO(b/278936436): refactor this part when we change recomputePadding + // when on the side, swipingFraction = 0, translationY should offset + // the top margin change in recomputePadding to make clock be centered + view.translationY = 0.5f * view.bottom * (1 - swipingFraction) + } } inner class LargeClockAnimations(