From 442241afa58b893020347d9137d5606aba6f14bf Mon Sep 17 00:00:00 2001 From: Floens Date: Sat, 21 Nov 2015 17:20:22 +0100 Subject: [PATCH] Fix a rounding issue that caused text to overflow on 4.3 & 4.4 Also reduce the size of the cache by 4, I believe there were memory problems --- .../src/main/java/org/floens/chan/ui/text/FastTextView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/ui/text/FastTextView.java b/Clover/app/src/main/java/org/floens/chan/ui/text/FastTextView.java index c2690df6..1d9e865a 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/text/FastTextView.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/text/FastTextView.java @@ -42,7 +42,7 @@ import static org.floens.chan.utils.AndroidUtils.sp; */ public class FastTextView extends View { private static final String TAG = "FastTextView"; - private static LruCache textCache = new LruCache<>(1000); + private static LruCache textCache = new LruCache<>(250); private TextPaint paint; private boolean singleLine; @@ -164,7 +164,7 @@ public class FastTextView extends View { if (widthMode == MeasureSpec.EXACTLY) { width = widthSize; } else if ((widthMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.UNSPECIFIED) && !TextUtils.isEmpty(text)) { - width = (int) Layout.getDesiredWidth(text, paint) + getPaddingLeft() + getPaddingRight(); + width = Math.round(Layout.getDesiredWidth(text, paint) + getPaddingLeft() + getPaddingRight()); if (widthMode == MeasureSpec.AT_MOST) { width = Math.min(width, widthSize); }