Skip to content

Commit 64ac862

Browse files
Gilles DebunneAndroid (Google) Code Review
authored andcommitted
Merge "Basic renaming refactoring in Layout" into jb-dev
2 parents a75fbc3 + eca5b73 commit 64ac862

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

core/java/android/text/Layout.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public abstract class Layout {
4545
private static final ParagraphStyle[] NO_PARA_SPANS =
4646
ArrayUtils.emptyArray(ParagraphStyle.class);
4747

48-
/* package */ static final EmojiFactory EMOJI_FACTORY =
49-
EmojiFactory.newAvailableInstance();
48+
/* package */ static final EmojiFactory EMOJI_FACTORY = EmojiFactory.newAvailableInstance();
5049
/* package */ static final int MIN_EMOJI, MAX_EMOJI;
5150

5251
static {
@@ -363,15 +362,15 @@ public void drawBackground(Canvas canvas, Path highlight, Paint highlightPaint,
363362
// direction of the layout or line. XXX: Should they?
364363
// They are evaluated at each line.
365364
if (mSpannedText) {
366-
if (lineBackgroundSpans == null) {
367-
lineBackgroundSpans = new SpanSet<LineBackgroundSpan>(LineBackgroundSpan.class);
365+
if (mLineBackgroundSpans == null) {
366+
mLineBackgroundSpans = new SpanSet<LineBackgroundSpan>(LineBackgroundSpan.class);
368367
}
369368

370369
Spanned buffer = (Spanned) mText;
371370
int textLength = buffer.length();
372-
lineBackgroundSpans.init(buffer, 0, textLength);
371+
mLineBackgroundSpans.init(buffer, 0, textLength);
373372

374-
if (lineBackgroundSpans.numberOfSpans > 0) {
373+
if (mLineBackgroundSpans.numberOfSpans > 0) {
375374
int previousLineBottom = getLineTop(firstLine);
376375
int previousLineEnd = getLineStart(firstLine);
377376
ParagraphStyle[] spans = NO_PARA_SPANS;
@@ -392,25 +391,26 @@ public void drawBackground(Canvas canvas, Path highlight, Paint highlightPaint,
392391
if (start >= spanEnd) {
393392
// These should be infrequent, so we'll use this so that
394393
// we don't have to check as often.
395-
spanEnd = lineBackgroundSpans.getNextTransition(start, textLength);
394+
spanEnd = mLineBackgroundSpans.getNextTransition(start, textLength);
396395
// All LineBackgroundSpans on a line contribute to its background.
397396
spansLength = 0;
398397
// Duplication of the logic of getParagraphSpans
399398
if (start != end || start == 0) {
400399
// Equivalent to a getSpans(start, end), but filling the 'spans' local
401400
// array instead to reduce memory allocation
402-
for (int j = 0; j < lineBackgroundSpans.numberOfSpans; j++) {
403-
// equal test is valid since both intervals are not empty by construction
404-
if (lineBackgroundSpans.spanStarts[j] >= end ||
405-
lineBackgroundSpans.spanEnds[j] <= start) continue;
401+
for (int j = 0; j < mLineBackgroundSpans.numberOfSpans; j++) {
402+
// equal test is valid since both intervals are not empty by
403+
// construction
404+
if (mLineBackgroundSpans.spanStarts[j] >= end ||
405+
mLineBackgroundSpans.spanEnds[j] <= start) continue;
406406
if (spansLength == spans.length) {
407407
// The spans array needs to be expanded
408408
int newSize = ArrayUtils.idealObjectArraySize(2 * spansLength);
409409
ParagraphStyle[] newSpans = new ParagraphStyle[newSize];
410410
System.arraycopy(spans, 0, newSpans, 0, spansLength);
411411
spans = newSpans;
412412
}
413-
spans[spansLength++] = lineBackgroundSpans.spans[j];
413+
spans[spansLength++] = mLineBackgroundSpans.spans[j];
414414
}
415415
}
416416
}
@@ -423,7 +423,7 @@ public void drawBackground(Canvas canvas, Path highlight, Paint highlightPaint,
423423
}
424424
}
425425
}
426-
lineBackgroundSpans.recycle();
426+
mLineBackgroundSpans.recycle();
427427
}
428428

429429
// There can be a highlight even without spans if we are drawing
@@ -1687,7 +1687,7 @@ protected final boolean isSpanned() {
16871687
* styles that are already applied to the buffer will apply to text that
16881688
* is inserted into it.
16891689
*/
1690-
/* package */ static <T> T[] getParagraphSpans(Spanned text, int start, int end, Class<T> type) {
1690+
/* package */static <T> T[] getParagraphSpans(Spanned text, int start, int end, Class<T> type) {
16911691
if (start == end && start > 0) {
16921692
return ArrayUtils.emptyArray(type);
16931693
}
@@ -1857,7 +1857,7 @@ public CharSequence subSequence(int start, int end) {
18571857
private static final Rect sTempRect = new Rect();
18581858
private boolean mSpannedText;
18591859
private TextDirectionHeuristic mTextDir;
1860-
private SpanSet<LineBackgroundSpan> lineBackgroundSpans;
1860+
private SpanSet<LineBackgroundSpan> mLineBackgroundSpans;
18611861

18621862
public static final int DIR_LEFT_TO_RIGHT = 1;
18631863
public static final int DIR_RIGHT_TO_LEFT = -1;

0 commit comments

Comments
 (0)