diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml
index 35a2195accabf..7a9e7c7e73f65 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml
@@ -76,7 +76,6 @@
android:textSize="100dp"
android:includeFontPadding="false"
android:fontFamily="@font/clock"
- android:lineSpacingMultiplier=".7"
android:typeface="monospace"
android:elegantTextHeight="false"
dozeWeight="200"
@@ -97,7 +96,6 @@
android:gravity="center_horizontal"
android:textSize="@dimen/large_clock_text_size"
android:includeFontPadding="false"
- android:lineSpacingMultiplier=".7"
android:fontFamily="@font/clock"
android:typeface="monospace"
android:elegantTextHeight="false"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 5bb46a83f2590..a4ff18fedbf30 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -688,6 +688,11 @@
10dp
+
+ - .7
+
+ - 1
+
- 0.62
diff --git a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java
index 59e81cf96bb23..0a117c17a3540 100644
--- a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java
@@ -16,37 +16,72 @@
package com.android.keyguard;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.Paint;
+import android.icu.text.NumberFormat;
import android.util.MathUtils;
import com.android.settingslib.Utils;
+import com.android.systemui.R;
+import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.util.ViewController;
+import java.util.Locale;
+import java.util.Objects;
import java.util.TimeZone;
/**
- * Controls the color of a GradientTextClock.
+ * Controller for an AnimatableClockView.
*/
public class AnimatableClockController extends ViewController {
+ private static final int FORMAT_NUMBER = 1234567890;
private final StatusBarStateController mStatusBarStateController;
- private final int[] mDozingColors = new int[] {Color.WHITE, Color.WHITE};
- private int[] mLockScreenColors = new int[2];
+ private final BroadcastDispatcher mBroadcastDispatcher;
+ private final int mDozingColor = Color.WHITE;
+ private int mLockScreenColor;
private boolean mIsDozing;
+ private Locale mLocale;
+
+ private final NumberFormat mBurmeseNf = NumberFormat.getInstance(Locale.forLanguageTag("my"));
+ private final String mBurmeseNumerals;
+ private final float mBurmeseLineSpacing;
+ private final float mDefaultLineSpacing;
public AnimatableClockController(
AnimatableClockView view,
- StatusBarStateController statusBarStateController) {
+ StatusBarStateController statusBarStateController,
+ BroadcastDispatcher broadcastDispatcher) {
super(view);
mStatusBarStateController = statusBarStateController;
mIsDozing = mStatusBarStateController.isDozing();
+ mBroadcastDispatcher = broadcastDispatcher;
+
+ mBurmeseNumerals = mBurmeseNf.format(FORMAT_NUMBER);
+ mBurmeseLineSpacing = getContext().getResources().getFloat(
+ R.dimen.keyguard_clock_line_spacing_scale_burmese);
+ mDefaultLineSpacing = getContext().getResources().getFloat(
+ R.dimen.keyguard_clock_line_spacing_scale);
}
+ private BroadcastReceiver mLocaleBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ updateLocale();
+ }
+ };
+
@Override
protected void onViewAttached() {
+ updateLocale();
+ mBroadcastDispatcher.registerReceiver(mLocaleBroadcastReceiver,
+ new IntentFilter(Intent.ACTION_LOCALE_CHANGED));
mStatusBarStateController.addCallback(mStatusBarStateListener);
mIsDozing = mStatusBarStateController.isDozing();
refreshTime();
@@ -55,6 +90,7 @@ public class AnimatableClockController extends ViewController {
invalidate();
return Unit.INSTANCE;
- },
- 2 /* number of lines (each can have a unique Paint) */);
+ });
if (mOnTextAnimatorInitialized != null) {
mOnTextAnimatorInitialized.run();
mOnTextAnimatorInitialized = null;
@@ -127,15 +127,20 @@ public class AnimatableClockView extends TextView {
mTextAnimator.draw(canvas);
}
- void setColors(int[] dozingColors, int[] lockScreenColors) {
- mDozingColors = dozingColors;
- mLockScreenColors = lockScreenColors;
+ void setLineSpacingScale(float scale) {
+ mLineSpacingScale = scale;
+ setLineSpacing(0, mLineSpacingScale);
+ }
+
+ void setColors(int dozingColor, int lockScreenColor) {
+ mDozingColor = dozingColor;
+ mLockScreenColor = lockScreenColor;
}
void animateDoze(boolean isDozing, boolean animate) {
setTextStyle(isDozing ? mDozingWeight : mLockScreenWeight /* weight */,
-1,
- isDozing ? mDozingColors : mLockScreenColors,
+ isDozing ? mDozingColor : mLockScreenColor,
animate);
}
@@ -152,15 +157,15 @@ public class AnimatableClockView extends TextView {
private void setTextStyle(
@IntRange(from = 0, to = 1000) int weight,
@FloatRange(from = 0) float textSize,
- int[] colors,
+ int color,
boolean animate) {
if (mTextAnimator != null) {
- mTextAnimator.setTextStyle(weight, textSize, colors, animate, ANIM_DURATION, null);
+ mTextAnimator.setTextStyle(weight, textSize, color, animate, ANIM_DURATION, null);
} else {
// when the text animator is set, update its start values
mOnTextAnimatorInitialized =
() -> mTextAnimator.setTextStyle(
- weight, textSize, colors, false, ANIM_DURATION, null);
+ weight, textSize, color, false, ANIM_DURATION, null);
}
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
index e0de180e657cb..e375877ed6cfc 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
@@ -28,6 +28,7 @@ import android.widget.FrameLayout;
import com.android.internal.colorextraction.ColorExtractor;
import com.android.keyguard.clock.ClockManager;
import com.android.systemui.R;
+import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ClockPlugin;
@@ -56,6 +57,7 @@ public class KeyguardClockSwitchController extends ViewController Unit,
- private val numLines: Int = 1
+ private val invalidateCallback: () -> Unit
) {
// Following two members are for mutable for testing purposes.
- internal var textInterpolator: TextInterpolator = TextInterpolator(layout, numLines)
+ internal var textInterpolator: TextInterpolator = TextInterpolator(layout)
internal var animator: ValueAnimator = ValueAnimator.ofFloat(1f).apply {
duration = DEFAULT_ANIMATION_DURATION
addUpdateListener {
@@ -99,7 +98,7 @@ class TextAnimator(
fun setTextStyle(
weight: Int = -1,
textSize: Float = -1f,
- colors: IntArray? = null,
+ color: Int? = null,
animate: Boolean = true,
duration: Long = -1L,
interpolator: TimeInterpolator? = null
@@ -110,21 +109,13 @@ class TextAnimator(
}
if (textSize >= 0) {
- for (targetPaint in textInterpolator.targetPaint)
- targetPaint.textSize = textSize
+ textInterpolator.targetPaint.textSize = textSize
}
if (weight >= 0) {
- for (targetPaint in textInterpolator.targetPaint)
- targetPaint.fontVariationSettings = "'$TAG_WGHT' $weight"
+ textInterpolator.targetPaint.fontVariationSettings = "'$TAG_WGHT' $weight"
}
- if (colors != null) {
- require(colors.size == textInterpolator.targetPaint.size) {
- "colors size (${colors.size}) must be the same size as" +
- " targetPaints size (${textInterpolator.targetPaint.size})," +
- " which was initialized as numLines ($numLines)"
- }
- for ((index, targetPaint) in textInterpolator.targetPaint.withIndex())
- targetPaint.color = colors[index]
+ if (color != null) {
+ textInterpolator.targetPaint.color = color
}
textInterpolator.onTargetPaintModified()
diff --git a/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt b/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt
index 0d41a2f566186..5d5797cbbb3d3 100644
--- a/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt
+++ b/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt
@@ -30,8 +30,7 @@ import java.lang.Math.max
* Provide text style linear interpolation for plain text.
*/
class TextInterpolator(
- layout: Layout,
- lines: Int = 1
+ layout: Layout
) {
/**
@@ -40,11 +39,9 @@ class TextInterpolator(
* Once you modified the style parameters, you have to call reshapeText to recalculate base text
* layout.
*
- * @return an array list of paint objects representing one paint per line of text. If this
- * list has a smaller size than the number of lines, all extra lines will use the Paint an
- * index 0.
+ * @return a paint object
*/
- val basePaint = createDefaultPaint(layout.paint, lines)
+ val basePaint = TextPaint(layout.paint)
/**
* Returns target paint used for interpolation.
@@ -52,18 +49,9 @@ class TextInterpolator(
* Once you modified the style parameters, you have to call reshapeText to recalculate target
* text layout.
*
- * @return an array list of paint objects representing one paint per line of text. If this
- * list has a smaller size than the number of lines, all extra lines will use the Paint an
- * index 0.
+ * @return a paint object
*/
- val targetPaint = createDefaultPaint(layout.paint, lines)
-
- private fun createDefaultPaint(paint: TextPaint, lines: Int): ArrayList {
- val paintList = ArrayList()
- for (i in 0 until lines)
- paintList.add(TextPaint(paint))
- return paintList
- }
+ val targetPaint = TextPaint(layout.paint)
/**
* A class represents a single font run.
@@ -102,7 +90,7 @@ class TextInterpolator(
private val fontInterpolator = FontInterpolator()
// Recycling object for glyph drawing. Will be extended for the longest font run if needed.
- private val tmpDrawPaints = ArrayList()
+ private val tmpDrawPaint = TextPaint()
private var tmpPositionArray = FloatArray(20)
/**
@@ -216,10 +204,10 @@ class TextInterpolator(
if (progress == 0f) {
return
} else if (progress == 1f) {
- updatePaint(basePaint, targetPaint)
+ basePaint.set(targetPaint)
} else {
- lerp(basePaint, targetPaint, progress, tmpDrawPaints)
- updatePaint(basePaint, tmpDrawPaints)
+ lerp(basePaint, targetPaint, progress, tmpDrawPaint)
+ basePaint.set(tmpDrawPaint)
}
lines.forEach { line ->
@@ -237,21 +225,13 @@ class TextInterpolator(
progress = 0f
}
- companion object {
- fun updatePaint(toUpdate: ArrayList, newValues: ArrayList) {
- toUpdate.clear()
- for (paint in newValues)
- toUpdate.add(TextPaint(paint))
- }
- }
-
/**
* Draws interpolated text at the given progress.
*
* @param canvas a canvas.
*/
fun draw(canvas: Canvas) {
- lerp(basePaint, targetPaint, progress, tmpDrawPaints)
+ lerp(basePaint, targetPaint, progress, tmpDrawPaint)
lines.forEachIndexed { lineNo, line ->
line.runs.forEach { run ->
canvas.save()
@@ -261,10 +241,7 @@ class TextInterpolator(
canvas.translate(origin, layout.getLineBaseline(lineNo).toFloat())
run.fontRuns.forEach { fontRun ->
- if (lineNo >= tmpDrawPaints.size)
- drawFontRun(canvas, run, fontRun, tmpDrawPaints[0])
- else
- drawFontRun(canvas, run, fontRun, tmpDrawPaints[lineNo])
+ drawFontRun(canvas, run, fontRun, tmpDrawPaint)
}
} finally {
canvas.restore()
@@ -430,27 +407,19 @@ class TextInterpolator(
}
// Linear interpolate the paint.
- private fun lerp(
- from: ArrayList,
- to: ArrayList,
- progress: Float,
- out: ArrayList
- ) {
- out.clear()
+ private fun lerp(from: Paint, to: Paint, progress: Float, out: Paint) {
+ out.set(from)
+
// Currently only font size & colors are interpolated.
// TODO(172943390): Add other interpolation or support custom interpolator.
- for (index in from.indices) {
- val paint = TextPaint(from[index])
- paint.textSize = MathUtils.lerp(from[index].textSize, to[index].textSize, progress)
- paint.color = ColorUtils.blendARGB(from[index].color, to[index].color, progress)
- out.add(paint)
- }
+ out.textSize = MathUtils.lerp(from.textSize, to.textSize, progress)
+ out.color = ColorUtils.blendARGB(from.color, to.color, progress)
}
// Shape the text and stores the result to out argument.
private fun shapeText(
layout: Layout,
- paints: ArrayList
+ paint: TextPaint
): List> {
val out = mutableListOf>()
for (lineNo in 0 until layout.lineCount) { // Shape all lines.
@@ -458,7 +427,7 @@ class TextInterpolator(
val count = layout.getLineEnd(lineNo) - lineStart
val runs = mutableListOf()
TextShaper.shapeText(layout.text, lineStart, count, layout.textDirectionHeuristic,
- paints[lineNo]) { _, _, glyphs, _ ->
+ paint) { _, _, glyphs, _ ->
runs.add(glyphs)
}
out.add(runs)
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java
index d0070d8d9ae9e..8c04143abc548 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java
@@ -289,7 +289,8 @@ public class KeyguardIndicationRotateTextViewController extends
if (hasIndications()) {
pw.println(" All messages:");
for (int type : mIndicationMessages.keySet()) {
- pw.println(" type=" + type + " message=" + mIndicationMessages.get(type));
+ pw.println(" type=" + type
+ + " message=" + mIndicationMessages.get(type).getMessage());
}
}
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
index a2eaea1a37c51..70a7b7a5acbcf 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
@@ -34,6 +34,7 @@ import android.widget.FrameLayout;
import com.android.internal.colorextraction.ColorExtractor;
import com.android.keyguard.clock.ClockManager;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.plugins.ClockPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -75,6 +76,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
NotificationIconAreaController mNotificationIconAreaController;
@Mock
ContentResolver mContentResolver;
+ @Mock
+ BroadcastDispatcher mBroadcastDispatcher;
private KeyguardClockSwitchController mController;
@@ -94,7 +97,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
mClockManager,
mKeyguardSliceViewController,
mNotificationIconAreaController,
- mContentResolver);
+ mContentResolver,
+ mBroadcastDispatcher);
when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE);
when(mColorExtractor.getColors(anyInt())).thenReturn(mGradientColors);
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt
index 53d84dba6fb2c..7b4f14dd35954 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt
@@ -34,9 +34,9 @@ import org.mockito.Mockito.verify
import kotlin.math.ceil
-private val PAINT = arrayListOf(TextPaint().apply {
+private val PAINT = TextPaint().apply {
textSize = 32f
-})
+}
@RunWith(AndroidTestingRunner::class)
@SmallTest
@@ -49,10 +49,10 @@ class TextAnimatorTest : SysuiTestCase() {
@Test
fun testAnimationStarted() {
- val layout = makeLayout("Hello, World", PAINT[0])
+ val layout = makeLayout("Hello, World", PAINT)
val valueAnimator = mock(ValueAnimator::class.java)
val textInterpolator = mock(TextInterpolator::class.java)
- val paint = arrayListOf(mock(TextPaint::class.java))
+ val paint = mock(TextPaint::class.java)
`when`(textInterpolator.targetPaint).thenReturn(paint)
val textAnimator = TextAnimator(layout, {}).apply {
@@ -81,10 +81,10 @@ class TextAnimatorTest : SysuiTestCase() {
@Test
fun testAnimationNotStarted() {
- val layout = makeLayout("Hello, World", PAINT[0])
+ val layout = makeLayout("Hello, World", PAINT)
val valueAnimator = mock(ValueAnimator::class.java)
val textInterpolator = mock(TextInterpolator::class.java)
- val paint = arrayListOf(mock(TextPaint::class.java))
+ val paint = mock(TextPaint::class.java)
`when`(textInterpolator.targetPaint).thenReturn(paint)
val textAnimator = TextAnimator(layout, {}).apply {
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt
index 1206dab7b56da..149e179de5a61 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt
@@ -21,9 +21,9 @@ import android.graphics.Canvas
import android.testing.AndroidTestingRunner
import android.text.Layout
import android.text.StaticLayout
-import android.text.TextPaint
import android.text.TextDirectionHeuristic
import android.text.TextDirectionHeuristics
+import android.text.TextPaint
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.google.common.truth.Truth.assertThat
@@ -40,13 +40,13 @@ private val PAINT = TextPaint().apply {
textSize = 32f
}
-private val START_PAINT = arrayListOf(TextPaint(PAINT).apply {
+private val START_PAINT = TextPaint(PAINT).apply {
fontVariationSettings = "'wght' 400"
-})
+}
-private val END_PAINT = arrayListOf(TextPaint(PAINT).apply {
+private val END_PAINT = TextPaint(PAINT).apply {
fontVariationSettings = "'wght' 700"
-})
+}
@RunWith(AndroidTestingRunner::class)
@SmallTest
@@ -67,16 +67,16 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(TEXT, PAINT)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
// Just after created TextInterpolator, it should have 0 progress.
assertThat(interp.progress).isEqualTo(0f)
val actual = interp.toBitmap(BMP_WIDTH, BMP_HEIGHT)
- val expected = makeLayout(TEXT, START_PAINT[0]).toBitmap(BMP_WIDTH, BMP_HEIGHT)
+ val expected = makeLayout(TEXT, START_PAINT).toBitmap(BMP_WIDTH, BMP_HEIGHT)
assertThat(expected.sameAs(actual)).isTrue()
}
@@ -86,15 +86,15 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(TEXT, PAINT)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
interp.progress = 1f
val actual = interp.toBitmap(BMP_WIDTH, BMP_HEIGHT)
- val expected = makeLayout(TEXT, END_PAINT[0]).toBitmap(BMP_WIDTH, BMP_HEIGHT)
+ val expected = makeLayout(TEXT, END_PAINT).toBitmap(BMP_WIDTH, BMP_HEIGHT)
assertThat(expected.sameAs(actual)).isTrue()
}
@@ -104,10 +104,10 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(TEXT, PAINT)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
// We cannot expect exact text layout of the middle position since we don't use text shaping
@@ -115,9 +115,9 @@ class TextInterpolatorTest : SysuiTestCase() {
// end state.
interp.progress = 0.5f
val actual = interp.toBitmap(BMP_WIDTH, BMP_HEIGHT)
- assertThat(actual.sameAs(makeLayout(TEXT, START_PAINT[0])
+ assertThat(actual.sameAs(makeLayout(TEXT, START_PAINT)
.toBitmap(BMP_WIDTH, BMP_HEIGHT))).isFalse()
- assertThat(actual.sameAs(makeLayout(TEXT, END_PAINT[0])
+ assertThat(actual.sameAs(makeLayout(TEXT, END_PAINT)
.toBitmap(BMP_WIDTH, BMP_HEIGHT))).isFalse()
}
@@ -126,10 +126,10 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(TEXT, PAINT)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
interp.progress = 0.5f
@@ -148,16 +148,16 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(BIDI_TEXT, PAINT, TextDirectionHeuristics.LTR)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
// Just after created TextInterpolator, it should have 0 progress.
assertThat(interp.progress).isEqualTo(0f)
val actual = interp.toBitmap(BMP_WIDTH, BMP_HEIGHT)
- val expected = makeLayout(BIDI_TEXT, START_PAINT[0], TextDirectionHeuristics.LTR)
+ val expected = makeLayout(BIDI_TEXT, START_PAINT, TextDirectionHeuristics.LTR)
.toBitmap(BMP_WIDTH, BMP_HEIGHT)
assertThat(expected.sameAs(actual)).isTrue()
@@ -168,16 +168,16 @@ class TextInterpolatorTest : SysuiTestCase() {
val layout = makeLayout(BIDI_TEXT, PAINT, TextDirectionHeuristics.RTL)
val interp = TextInterpolator(layout)
- TextInterpolator.updatePaint(interp.basePaint, START_PAINT)
+ interp.basePaint.set(START_PAINT)
interp.onBasePaintModified()
- TextInterpolator.updatePaint(interp.targetPaint, END_PAINT)
+ interp.targetPaint.set(END_PAINT)
interp.onTargetPaintModified()
// Just after created TextInterpolator, it should have 0 progress.
assertThat(interp.progress).isEqualTo(0f)
val actual = interp.toBitmap(BMP_WIDTH, BMP_HEIGHT)
- val expected = makeLayout(BIDI_TEXT, START_PAINT[0], TextDirectionHeuristics.RTL)
+ val expected = makeLayout(BIDI_TEXT, START_PAINT, TextDirectionHeuristics.RTL)
.toBitmap(BMP_WIDTH, BMP_HEIGHT)
assertThat(expected.sameAs(actual)).isTrue()