Skip to content

Commit e921572

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Revert "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)""
2 parents 63f5e09 + ad0b051 commit e921572

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

core/java/android/text/DynamicLayout.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public DynamicLayout(CharSequence base, CharSequence display,
7676
boolean includepad,
7777
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
7878
this(base, display, paint, width, align, TextDirectionHeuristics.FIRSTSTRONG_LTR,
79-
spacingmult, spacingadd, includepad, ellipsize, ellipsizedWidth, Integer.MAX_VALUE);
79+
spacingmult, spacingadd, includepad, ellipsize, ellipsizedWidth);
8080
}
8181

8282
/**
@@ -93,7 +93,7 @@ public DynamicLayout(CharSequence base, CharSequence display,
9393
int width, Alignment align, TextDirectionHeuristic textDir,
9494
float spacingmult, float spacingadd,
9595
boolean includepad,
96-
TextUtils.TruncateAt ellipsize, int ellipsizedWidth, int maxLines) {
96+
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
9797
super((ellipsize == null)
9898
? display
9999
: (display instanceof Spanned)
@@ -135,8 +135,6 @@ public DynamicLayout(CharSequence base, CharSequence display,
135135
mEllipsize = true;
136136
}
137137

138-
mMaxLines = maxLines;
139-
140138
// Initial state is a single line with 0 characters (0 to 0),
141139
// with top at 0 and bottom at whatever is natural, and
142140
// undefined ellipsis.
@@ -285,7 +283,7 @@ private void reflow(CharSequence s, int where, int before, int after) {
285283
reflowed.generate(text, where, where + after,
286284
getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(),
287285
getSpacingMultiplier(), getSpacingAdd(),
288-
false, true, mEllipsizedWidth, mEllipsizeAt, mMaxLines);
286+
false, true, mEllipsizedWidth, mEllipsizeAt);
289287
int n = reflowed.getLineCount();
290288

291289
// If the new layout has a blank line at the end, but it is not
@@ -490,8 +488,6 @@ public int getEllipsisCount(int line) {
490488

491489
private int mTopPadding, mBottomPadding;
492490

493-
private int mMaxLines;
494-
495491
private static StaticLayout sStaticLayout = new StaticLayout(null);
496492

497493
private static final Object[] sLock = new Object[0];

core/java/android/text/StaticLayout.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public StaticLayout(CharSequence source, int bufstart, int bufend,
139139

140140
generate(source, bufstart, bufend, paint, outerwidth, align, textDir,
141141
spacingmult, spacingadd, includepad, includepad,
142-
ellipsizedWidth, ellipsize, mMaximumVisibleLineCount);
142+
ellipsizedWidth, ellipsize);
143143

144144
mMeasured = MeasuredText.recycle(mMeasured);
145145
mFontMetricsInt = null;
@@ -160,7 +160,7 @@ public StaticLayout(CharSequence source, int bufstart, int bufend,
160160
Alignment align, TextDirectionHeuristic textDir,
161161
float spacingmult, float spacingadd,
162162
boolean includepad, boolean trackpad,
163-
float ellipsizedWidth, TextUtils.TruncateAt ellipsize, int maxLines) {
163+
float ellipsizedWidth, TextUtils.TruncateAt ellipsize) {
164164
mLineCount = 0;
165165

166166
int v = 0;
@@ -477,13 +477,13 @@ public StaticLayout(CharSequence source, int bufstart, int bufend,
477477
width = restWidth;
478478
}
479479
}
480-
if (mLineCount >= maxLines) {
480+
if (mLineCount >= mMaximumVisibleLineCount) {
481481
break;
482482
}
483483
}
484484
}
485485

486-
if (paraEnd != here && mLineCount < maxLines) {
486+
if (paraEnd != here && mLineCount < mMaximumVisibleLineCount) {
487487
if ((fitTop | fitBottom | fitDescent | fitAscent) == 0) {
488488
paint.getFontMetricsInt(fm);
489489

@@ -514,7 +514,7 @@ public StaticLayout(CharSequence source, int bufstart, int bufend,
514514
}
515515

516516
if ((bufEnd == bufStart || source.charAt(bufEnd - 1) == CHAR_NEW_LINE) &&
517-
mLineCount < maxLines) {
517+
mLineCount < mMaximumVisibleLineCount) {
518518
// Log.e("text", "output last " + bufEnd);
519519

520520
paint.getFontMetricsInt(fm);

core/java/android/widget/TextView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6262,7 +6262,7 @@ private Layout makeSingleLayout(int w, BoringLayout.Metrics boring, int ellipsis
62626262
result = new DynamicLayout(mText, mTransformed, mTextPaint, w,
62636263
alignment, mTextDir, mSpacingMult,
62646264
mSpacingAdd, mIncludePad, mInput == null ? effectiveEllipsize : null,
6265-
ellipsisWidth, mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
6265+
ellipsisWidth);
62666266
} else {
62676267
if (boring == UNKNOWN_BORING) {
62686268
boring = BoringLayout.isBoring(mTransformed, mTextPaint, mTextDir, mBoring);

0 commit comments

Comments
 (0)