diff options
| author | 2015-01-15 18:56:07 +0000 | |
|---|---|---|
| committer | 2015-01-15 18:56:08 +0000 | |
| commit | 9787039d91ad23805a1e73e1cd973b85295b85c2 (patch) | |
| tree | 642c35707c4d72c93cf6b2df3ba6828113b6ad59 | |
| parent | a9f9c4b90a8af25974bc74971efeafa521073df2 (diff) | |
| parent | 7c0e7db67efda303a9964746dfcc7db243fb5fb4 (diff) | |
Merge "Fudge getRightPaddingOffset in TextView to match clipRect." into lmp-mr1-dev
| -rw-r--r-- | core/java/android/widget/TextView.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 765d196509c5..cc5d45775c26 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -5017,9 +5017,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return (int) Math.max(0, mShadowDy + mShadowRadius); } + private int getFudgedPaddingRight() { + // Add sufficient space for cursor and tone marks + int cursorWidth = 2 + (int)mTextPaint.density; // adequate for Material cursors + return Math.max(0, getCompoundPaddingRight() - (cursorWidth - 1)); + } + @Override protected int getRightPaddingOffset() { - return -(getCompoundPaddingRight() - mPaddingRight) + + return -(getFudgedPaddingRight() - mPaddingRight) + (int) Math.max(0, mShadowDx + mShadowRadius); } @@ -5373,13 +5379,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop; final int maxScrollY = mLayout.getHeight() - vspace; - // Add sufficient space for cursor and tone marks - int cursorWidth = 2 + (int)mTextPaint.density; // adequate for Material cursors - int fudgedPaddingRight = Math.max(0, compoundPaddingRight - (cursorWidth - 1)); - float clipLeft = compoundPaddingLeft + scrollX; float clipTop = (scrollY == 0) ? 0 : extendedPaddingTop + scrollY; - float clipRight = right - left - fudgedPaddingRight + scrollX; + float clipRight = right - left - getFudgedPaddingRight() + scrollX; float clipBottom = bottom - top + scrollY - ((scrollY == maxScrollY) ? 0 : extendedPaddingBottom); |