diff options
| -rw-r--r-- | packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt | 10 |
1 files changed, 9 insertions, 1 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 e086cda2f793..003c572a3100 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 @@ -190,12 +190,20 @@ class AnimatableClockView @JvmOverloads constructor( refreshFormat() } + override fun setTextSize(type: Int, size: Float) { + super.setTextSize(type, size) + if (type == TypedValue.COMPLEX_UNIT_PX) { + lastUnconstrainedTextSize = size + } + } + @SuppressLint("DrawAllocation") override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { logger.d("onMeasure") if (migratedClocks && !isSingleLineInternal && MeasureSpec.getMode(heightMeasureSpec) == EXACTLY) { - setTextSize(TypedValue.COMPLEX_UNIT_PX, + // Call straight into TextView.setTextSize to avoid setting lastUnconstrainedTextSize + super.setTextSize(TypedValue.COMPLEX_UNIT_PX, min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F)) } super.onMeasure(widthMeasureSpec, heightMeasureSpec) |