From 5157942db6ca0ba2cb96898ecf9118a81da98528 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Wed, 8 Dec 2010 19:37:45 -0800 Subject: [PATCH] fix getText() for CacheableTextView --- src/com/android/launcher2/CacheableTextView.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/launcher2/CacheableTextView.java b/src/com/android/launcher2/CacheableTextView.java index 50da7cd34e..873cd4ed7c 100644 --- a/src/com/android/launcher2/CacheableTextView.java +++ b/src/com/android/launcher2/CacheableTextView.java @@ -46,6 +46,7 @@ public class CacheableTextView extends TextView { float mRectLeft, mRectTop; private float mPaddingH = 0; private float mPaddingV = 0; + private CharSequence mText; public CacheableTextView(Context context) { super(context); @@ -128,10 +129,15 @@ public class CacheableTextView extends TextView { // potential issues with text measurement, like line height, etc.) so that the text view // doesn't draw it anymore, since it's been cached. We have to manually rebuild // the cache whenever the text is changed (which is never in Launcher) + mText = getText(); setText(" "); } } + public CharSequence getText() { + return (mText == null) ? super.getText() : mText; + } + public void draw(Canvas canvas) { if (mWaitingToGenerateCache && !mIsBuildingCache) { buildAndEnableCache(true);