summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt18
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt6
3 files changed, 20 insertions, 6 deletions
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt
index 2bfa7d9bbd7b..cea49e1b535e 100644
--- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt
+++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt
@@ -27,6 +27,7 @@ import android.text.TextUtils
import android.text.format.DateFormat
import android.util.AttributeSet
import android.util.MathUtils.constrainedMap
+import android.view.View
import android.widget.TextView
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
@@ -51,7 +52,7 @@ class AnimatableClockView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
- defStyleRes: Int = 0
+ defStyleRes: Int = 0,
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
// To protect us from issues from this being null while the TextView constructor is running, we
// implement the get method and ensure a value is returned before initialization is complete.
@@ -61,6 +62,9 @@ class AnimatableClockView @JvmOverloads constructor(
get() = logger.buffer
set(value) { logger = Logger(value, TAG) }
+ var hasCustomPositionUpdatedAnimation: Boolean = false
+ var migratedClocks: Boolean = false
+
private val time = Calendar.getInstance()
private val dozingWeightInternal: Int
@@ -193,9 +197,18 @@ class AnimatableClockView @JvmOverloads constructor(
} else {
animator.updateLayout(layout)
}
+ if (migratedClocks && hasCustomPositionUpdatedAnimation) {
+ // Expand width to avoid clock being clipped during stepping animation
+ setMeasuredDimension(measuredWidth +
+ MeasureSpec.getSize(widthMeasureSpec) / 2, measuredHeight)
+ }
}
override fun onDraw(canvas: Canvas) {
+ if (migratedClocks && hasCustomPositionUpdatedAnimation) {
+ canvas.save()
+ canvas.translate((parent as View).measuredWidth / 4F, 0F)
+ }
logger.d({ "onDraw($str1)"}) { str1 = text.toString() }
// Use textAnimator to render text if animation is enabled.
// Otherwise default to using standard draw functions.
@@ -205,6 +218,9 @@ class AnimatableClockView @JvmOverloads constructor(
} else {
super.onDraw(canvas)
}
+ if (migratedClocks && hasCustomPositionUpdatedAnimation) {
+ canvas.restore()
+ }
}
override fun invalidate() {
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 99d321695d04..001e3a5fc911 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
@@ -193,6 +193,8 @@ class DefaultClockController(
ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation)
init {
+ view.migratedClocks = migratedClocks
+ view.hasCustomPositionUpdatedAnimation = hasStepClockAnimation
animations = LargeClockAnimations(view, 0f, 0f)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt
index f33aed03856c..f2b28d964314 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt
@@ -29,8 +29,4 @@ class KeyguardRootView(
ConstraintLayout(
context,
attrs,
- ) {
- init {
- clipChildren = false
- }
-}
+ )