summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-05-07 17:46:45 -0700
committerMathias Agopian <mathias@google.com>2009-05-07 17:46:45 -0700
commit6bebbcd57b7b3ffad3af046f4899d885b30c828e (patch)
tree5f3e8556aa0e0d4bb9b1928d6d1d9d6932aeb980 /core/java/android/widget/TextView.java
parent97b8056c3182a973c67d3c1b196150d4b9e30f3a (diff)
parente1a085801df8a015cc80f3eca6954fe2691a7fd4 (diff)
downloadframeworks_base-6bebbcd57b7b3ffad3af046f4899d885b30c828e.zip
frameworks_base-6bebbcd57b7b3ffad3af046f4899d885b30c828e.tar.gz
frameworks_base-6bebbcd57b7b3ffad3af046f4899d885b30c828e.tar.bz2
Merge commit 'goog/master' into merge_master
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index de0c982..c6b0187 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4837,10 +4837,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
private boolean compressText(float width) {
- if (width > 0.0f && mLayout != null && getLineCount() == 1 && !mUserSetTextScaleX) {
+ // Only compress the text if it hasn't been compressed by the previous pass
+ if (width > 0.0f && mLayout != null && getLineCount() == 1 && !mUserSetTextScaleX &&
+ mTextPaint.getTextScaleX() == 1.0f) {
final float textWidth = mLayout.getLineWidth(0);
- final float overflow = (textWidth - width) / width;
-
+ final float overflow = (textWidth + 1.0f - width) / width;
if (overflow > 0.0f && overflow <= Marquee.MARQUEE_DELTA_MAX) {
mTextPaint.setTextScaleX(1.0f - overflow - 0.005f);
post(new Runnable() {
@@ -5843,9 +5844,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
final int textWidth = textView.getWidth() - textView.getCompoundPaddingLeft() -
textView.getCompoundPaddingRight();
final float lineWidth = textView.mLayout.getLineWidth(0);
- mGhostStart = lineWidth - textWidth + textWidth / 3.0f;
+ final float gap = textWidth / 3.0f;
+ mGhostStart = lineWidth - textWidth + gap;
mMaxScroll = mGhostStart + textWidth;
- mGhostOffset = lineWidth + textWidth / 3.0f;
+ mGhostOffset = lineWidth + gap;
mFadeStop = lineWidth + textWidth / 6.0f;
mMaxFadeScroll = mGhostStart + lineWidth + lineWidth;