am 4bf4e4c8: Merge "Make Paint a required field of StaticLayout Builder" into mnc-dev

* commit '4bf4e4c80181cd7c4e1a9d26c443dd1d529455e7':
  Make Paint a required field of StaticLayout Builder
This commit is contained in:
Raph Levien
2015-05-02 00:46:34 +00:00
committed by Android Git Automerger
3 changed files with 7 additions and 8 deletions

View File

@@ -283,7 +283,7 @@ public class DynamicLayout extends Layout
if (reflowed == null) {
reflowed = new StaticLayout(null);
b = StaticLayout.Builder.obtain(text, where, where + after, getWidth());
b = StaticLayout.Builder.obtain(text, where, where + after, getPaint(), getWidth());
}
b.setText(text, where, where + after)

View File

@@ -57,7 +57,8 @@ public class StaticLayout extends Layout {
mNativePtr = nNewBuilder();
}
public static Builder obtain(CharSequence source, int start, int end, int width) {
public static Builder obtain(CharSequence source, int start, int end, TextPaint paint,
int width) {
Builder b = sPool.acquire();
if (b == null) {
b = new Builder();
@@ -67,6 +68,7 @@ public class StaticLayout extends Layout {
b.mText = source;
b.mStart = start;
b.mEnd = end;
b.mPaint = paint;
b.mWidth = width;
b.mAlignment = Alignment.ALIGN_NORMAL;
b.mTextDir = TextDirectionHeuristics.FIRSTSTRONG_LTR;
@@ -327,8 +329,7 @@ public class StaticLayout extends Layout {
: new Ellipsizer(source),
paint, outerwidth, align, textDir, spacingmult, spacingadd);
Builder b = Builder.obtain(source, bufstart, bufend, outerwidth)
.setPaint(paint)
Builder b = Builder.obtain(source, bufstart, bufend, paint, outerwidth)
.setAlignment(align)
.setTextDir(textDir)
.setSpacingMult(spacingmult)

View File

@@ -6630,8 +6630,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// TODO: code duplication with makeSingleLayout()
if (mHintLayout == null) {
StaticLayout.Builder builder = StaticLayout.Builder.obtain(mHint, 0,
mHint.length(), hintWidth)
.setPaint(mTextPaint)
mHint.length(), mTextPaint, hintWidth)
.setAlignment(alignment)
.setTextDir(mTextDir)
.setSpacingMult(mSpacingMult)
@@ -6721,8 +6720,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
if (result == null) {
StaticLayout.Builder builder = StaticLayout.Builder.obtain(mTransformed,
0, mTransformed.length(), wantWidth)
.setPaint(mTextPaint)
0, mTransformed.length(), mTextPaint, wantWidth)
.setAlignment(alignment)
.setTextDir(mTextDir)
.setSpacingMult(mSpacingMult)