From c739bb001a4f4857b39519789effe8bdd6d28682 Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Tue, 22 Aug 2017 17:25:33 -0700 Subject: Switch AutoResizeTextView to use new linespacing API This allows expanding linespacing based on actual fallback fonts used. Since TextView has the feature on for P and later, Dialer should assume it's on. Bug: 28963299 Test: none Change-Id: I2ce33ac7b5dff76f98bd48d1eef595b48b05106a --- .../android/incallui/autoresizetext/AutoResizeTextView.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'java') diff --git a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java index 5a22b93dc..8fd0b4868 100644 --- a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java +++ b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java @@ -226,13 +226,10 @@ public class AutoResizeTextView extends TextView { } else { // If multiline, lay the text out, then check the number of lines, the layout's height, // and each line's width. - StaticLayout layout = new StaticLayout(text, - textPaint, - maxWidth, - Alignment.ALIGN_NORMAL, - getLineSpacingMultiplier(), - getLineSpacingExtra(), - true); + StaticLayout layout = StaticLayout.Builder.obtain(text, 0, text.length(), textPaint, maxWidth) + .setLineSpacing(getLineSpacingExtra(), getLineSpacingMultiplier()) + .setUseLineSpacingFromFallbacks(true) + .build(); // Return false if we need more than maxLines. The text is obviously too big in this case. if (maxLines != NO_LINE_LIMIT && layout.getLineCount() > maxLines) { -- cgit v1.2.3