Merge "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)"
This commit is contained in:
committed by
Android (Google) Code Review
commit
46c78b4de1
@@ -76,7 +76,7 @@ extends Layout
|
|||||||
boolean includepad,
|
boolean includepad,
|
||||||
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
|
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
|
||||||
this(base, display, paint, width, align, TextDirectionHeuristics.FIRSTSTRONG_LTR,
|
this(base, display, paint, width, align, TextDirectionHeuristics.FIRSTSTRONG_LTR,
|
||||||
spacingmult, spacingadd, includepad, ellipsize, ellipsizedWidth);
|
spacingmult, spacingadd, includepad, ellipsize, ellipsizedWidth, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +93,7 @@ extends Layout
|
|||||||
int width, Alignment align, TextDirectionHeuristic textDir,
|
int width, Alignment align, TextDirectionHeuristic textDir,
|
||||||
float spacingmult, float spacingadd,
|
float spacingmult, float spacingadd,
|
||||||
boolean includepad,
|
boolean includepad,
|
||||||
TextUtils.TruncateAt ellipsize, int ellipsizedWidth) {
|
TextUtils.TruncateAt ellipsize, int ellipsizedWidth, int maxLines) {
|
||||||
super((ellipsize == null)
|
super((ellipsize == null)
|
||||||
? display
|
? display
|
||||||
: (display instanceof Spanned)
|
: (display instanceof Spanned)
|
||||||
@@ -135,6 +135,8 @@ extends Layout
|
|||||||
mEllipsize = true;
|
mEllipsize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMaxLines = maxLines;
|
||||||
|
|
||||||
// Initial state is a single line with 0 characters (0 to 0),
|
// Initial state is a single line with 0 characters (0 to 0),
|
||||||
// with top at 0 and bottom at whatever is natural, and
|
// with top at 0 and bottom at whatever is natural, and
|
||||||
// undefined ellipsis.
|
// undefined ellipsis.
|
||||||
@@ -283,7 +285,7 @@ extends Layout
|
|||||||
reflowed.generate(text, where, where + after,
|
reflowed.generate(text, where, where + after,
|
||||||
getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(),
|
getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(),
|
||||||
getSpacingMultiplier(), getSpacingAdd(),
|
getSpacingMultiplier(), getSpacingAdd(),
|
||||||
false, true, mEllipsizedWidth, mEllipsizeAt);
|
false, true, mEllipsizedWidth, mEllipsizeAt, mMaxLines);
|
||||||
int n = reflowed.getLineCount();
|
int n = reflowed.getLineCount();
|
||||||
|
|
||||||
// If the new layout has a blank line at the end, but it is not
|
// If the new layout has a blank line at the end, but it is not
|
||||||
@@ -488,6 +490,8 @@ extends Layout
|
|||||||
|
|
||||||
private int mTopPadding, mBottomPadding;
|
private int mTopPadding, mBottomPadding;
|
||||||
|
|
||||||
|
private int mMaxLines;
|
||||||
|
|
||||||
private static StaticLayout sStaticLayout = new StaticLayout(null);
|
private static StaticLayout sStaticLayout = new StaticLayout(null);
|
||||||
|
|
||||||
private static final Object[] sLock = new Object[0];
|
private static final Object[] sLock = new Object[0];
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public class StaticLayout extends Layout {
|
|||||||
|
|
||||||
generate(source, bufstart, bufend, paint, outerwidth, align, textDir,
|
generate(source, bufstart, bufend, paint, outerwidth, align, textDir,
|
||||||
spacingmult, spacingadd, includepad, includepad,
|
spacingmult, spacingadd, includepad, includepad,
|
||||||
ellipsizedWidth, ellipsize);
|
ellipsizedWidth, ellipsize, mMaximumVisibleLineCount);
|
||||||
|
|
||||||
mMeasured = MeasuredText.recycle(mMeasured);
|
mMeasured = MeasuredText.recycle(mMeasured);
|
||||||
mFontMetricsInt = null;
|
mFontMetricsInt = null;
|
||||||
@@ -160,7 +160,7 @@ public class StaticLayout extends Layout {
|
|||||||
Alignment align, TextDirectionHeuristic textDir,
|
Alignment align, TextDirectionHeuristic textDir,
|
||||||
float spacingmult, float spacingadd,
|
float spacingmult, float spacingadd,
|
||||||
boolean includepad, boolean trackpad,
|
boolean includepad, boolean trackpad,
|
||||||
float ellipsizedWidth, TextUtils.TruncateAt ellipsize) {
|
float ellipsizedWidth, TextUtils.TruncateAt ellipsize, int maxLines) {
|
||||||
mLineCount = 0;
|
mLineCount = 0;
|
||||||
|
|
||||||
int v = 0;
|
int v = 0;
|
||||||
@@ -477,13 +477,13 @@ public class StaticLayout extends Layout {
|
|||||||
width = restWidth;
|
width = restWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mLineCount >= mMaximumVisibleLineCount) {
|
if (mLineCount >= maxLines) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paraEnd != here && mLineCount < mMaximumVisibleLineCount) {
|
if (paraEnd != here && mLineCount < maxLines) {
|
||||||
if ((fitTop | fitBottom | fitDescent | fitAscent) == 0) {
|
if ((fitTop | fitBottom | fitDescent | fitAscent) == 0) {
|
||||||
paint.getFontMetricsInt(fm);
|
paint.getFontMetricsInt(fm);
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ public class StaticLayout extends Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((bufEnd == bufStart || source.charAt(bufEnd - 1) == CHAR_NEW_LINE) &&
|
if ((bufEnd == bufStart || source.charAt(bufEnd - 1) == CHAR_NEW_LINE) &&
|
||||||
mLineCount < mMaximumVisibleLineCount) {
|
mLineCount < maxLines) {
|
||||||
// Log.e("text", "output last " + bufEnd);
|
// Log.e("text", "output last " + bufEnd);
|
||||||
|
|
||||||
paint.getFontMetricsInt(fm);
|
paint.getFontMetricsInt(fm);
|
||||||
|
|||||||
@@ -6253,7 +6253,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
result = new DynamicLayout(mText, mTransformed, mTextPaint, w,
|
result = new DynamicLayout(mText, mTransformed, mTextPaint, w,
|
||||||
alignment, mTextDir, mSpacingMult,
|
alignment, mTextDir, mSpacingMult,
|
||||||
mSpacingAdd, mIncludePad, mInput == null ? effectiveEllipsize : null,
|
mSpacingAdd, mIncludePad, mInput == null ? effectiveEllipsize : null,
|
||||||
ellipsisWidth);
|
ellipsisWidth, mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
|
||||||
} else {
|
} else {
|
||||||
if (boring == UNKNOWN_BORING) {
|
if (boring == UNKNOWN_BORING) {
|
||||||
boring = BoringLayout.isBoring(mTransformed, mTextPaint, mTextDir, mBoring);
|
boring = BoringLayout.isBoring(mTransformed, mTextPaint, mTextDir, mBoring);
|
||||||
|
|||||||
Reference in New Issue
Block a user