Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +15 −2 Original line number Diff line number Diff line Loading @@ -531,8 +531,10 @@ constructor( moveFraction: Float, ) { val isMovingToCenter = if (isLayoutRtl) clockMoveDirection < 0 else clockMoveDirection > 0 // The sign of moveAmountDeltaForDigit is already set here // we can interpret (left - clockStartLeft) as (destinationPosition - originPosition) // so we no longer need to multiply direct sign to moveAmountDeltaForDigit val currentMoveAmount = left - clockStartLeft val digitOffsetDirection = if (isLayoutRtl) -1 else 1 for (i in 0 until NUM_DIGITS) { val digitFraction = getDigitFraction( Loading @@ -542,7 +544,7 @@ constructor( ) val moveAmountForDigit = currentMoveAmount * digitFraction val moveAmountDeltaForDigit = moveAmountForDigit - currentMoveAmount glyphOffsets[i] = digitOffsetDirection * moveAmountDeltaForDigit glyphOffsets[i] = moveAmountDeltaForDigit } invalidate() } Loading Loading @@ -582,6 +584,17 @@ constructor( invalidate() } override fun onRtlPropertiesChanged(layoutDirection: Int) { if (migratedClocks) { if (layoutDirection == LAYOUT_DIRECTION_RTL) { textAlignment = TEXT_ALIGNMENT_TEXT_END } else { textAlignment = TEXT_ALIGNMENT_TEXT_START } } super.onRtlPropertiesChanged(layoutDirection) } private fun getDigitFraction(digit: Int, isMovingToCenter: Boolean, fraction: Float): Float { // The delay for the digit, in terms of fraction. // (i.e. the digit should not move during 0.0 - 0.1). Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +15 −2 Original line number Diff line number Diff line Loading @@ -531,8 +531,10 @@ constructor( moveFraction: Float, ) { val isMovingToCenter = if (isLayoutRtl) clockMoveDirection < 0 else clockMoveDirection > 0 // The sign of moveAmountDeltaForDigit is already set here // we can interpret (left - clockStartLeft) as (destinationPosition - originPosition) // so we no longer need to multiply direct sign to moveAmountDeltaForDigit val currentMoveAmount = left - clockStartLeft val digitOffsetDirection = if (isLayoutRtl) -1 else 1 for (i in 0 until NUM_DIGITS) { val digitFraction = getDigitFraction( Loading @@ -542,7 +544,7 @@ constructor( ) val moveAmountForDigit = currentMoveAmount * digitFraction val moveAmountDeltaForDigit = moveAmountForDigit - currentMoveAmount glyphOffsets[i] = digitOffsetDirection * moveAmountDeltaForDigit glyphOffsets[i] = moveAmountDeltaForDigit } invalidate() } Loading Loading @@ -582,6 +584,17 @@ constructor( invalidate() } override fun onRtlPropertiesChanged(layoutDirection: Int) { if (migratedClocks) { if (layoutDirection == LAYOUT_DIRECTION_RTL) { textAlignment = TEXT_ALIGNMENT_TEXT_END } else { textAlignment = TEXT_ALIGNMENT_TEXT_START } } super.onRtlPropertiesChanged(layoutDirection) } private fun getDigitFraction(digit: Int, isMovingToCenter: Boolean, fraction: Float): Float { // The delay for the digit, in terms of fraction. // (i.e. the digit should not move during 0.0 - 0.1). Loading