Merge "Update lastUnconstraintedTextSize from setTextSize" into main
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 e086cda..003c572 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 @@
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)