Loading core/java/android/text/DynamicLayout.java +3 −3 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ public class DynamicLayout extends Layout private final Paint.FontMetricsInt mFontMetricsInt = new Paint.FontMetricsInt(); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<Builder>(3); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<>(3); } /** Loading Loading @@ -440,7 +440,7 @@ public class DynamicLayout extends Layout mEllipsizeAt = null; } mObjects = new PackedObjectVector<Directions>(1); mObjects = new PackedObjectVector<>(1); // Initial state is a single line with 0 characters (0 to 0), with top at 0 and bottom at // whatever is natural, and undefined ellipsis. Loading Loading @@ -1050,7 +1050,7 @@ public class DynamicLayout extends Layout private static class ChangeWatcher implements TextWatcher, SpanWatcher { public ChangeWatcher(DynamicLayout layout) { mLayout = new WeakReference<DynamicLayout>(layout); mLayout = new WeakReference<>(layout); } private void reflow(CharSequence s, int where, int before, int after) { Loading core/java/android/text/Layout.java +2 −12 Original line number Diff line number Diff line Loading @@ -319,8 +319,6 @@ public abstract class Layout { private float getJustifyWidth(int lineNum) { Alignment paraAlign = mAlignment; TabStops tabStops = null; boolean tabStopsIsInitialized = false; int left = 0; int right = mWidth; Loading Loading @@ -371,10 +369,6 @@ public abstract class Layout { } } if (getLineContainsTab(lineNum)) { tabStops = new TabStops(TAB_INCREMENT, spans); } final Alignment align; if (paraAlign == Alignment.ALIGN_LEFT) { align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_NORMAL : Alignment.ALIGN_OPPOSITE; Loading Loading @@ -1423,7 +1417,6 @@ public abstract class Layout { float dist = Math.abs(getHorizontal(max, primary) - horiz); if (dist <= bestdist) { bestdist = dist; best = max; } Loading Loading @@ -1570,7 +1563,7 @@ public abstract class Layout { // XXX: we don't care about tabs tl.set(mPaint, mText, lineStart, lineEnd, lineDir, directions, false, null); caret = lineStart + tl.getOffsetToLeftRightOf(caret - lineStart, toLeft); tl = TextLine.recycle(tl); TextLine.recycle(tl); return caret; } Loading Loading @@ -1894,10 +1887,7 @@ public abstract class Layout { int margin = 0; boolean isFirstParaLine = lineStart == 0 || spanned.charAt(lineStart - 1) == '\n'; boolean useFirstLineMargin = isFirstParaLine; boolean useFirstLineMargin = lineStart == 0 || spanned.charAt(lineStart - 1) == '\n'; for (int i = 0; i < spans.length; i++) { if (spans[i] instanceof LeadingMarginSpan2) { int spStart = spanned.getSpanStart(spans[i]); Loading core/java/android/text/StaticLayout.java +5 −7 Original line number Diff line number Diff line Loading @@ -440,8 +440,6 @@ public class StaticLayout extends Layout { private Pair<String, long[]> getLocaleAndHyphenatorIfChanged(TextPaint paint) { final LocaleList locales = paint.getTextLocales(); final String languageTags; long[] hyphenators; if (!locales.equals(mLocales)) { mLocales = locales; return new Pair(locales.toLanguageTags(), getHyphenators(locales)); Loading Loading @@ -520,7 +518,7 @@ public class StaticLayout extends Layout { private LocaleList mLocales; private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<Builder>(3); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<>(3); } public StaticLayout(CharSequence source, TextPaint paint, Loading Loading @@ -945,10 +943,10 @@ public class StaticLayout extends Layout { boolean moreChars = (endPos < bufEnd); final int ascent = fallbackLineSpacing ? Math.min(fmAscent, (int) Math.round(ascents[breakIndex])) ? Math.min(fmAscent, Math.round(ascents[breakIndex])) : fmAscent; final int descent = fallbackLineSpacing ? Math.max(fmDescent, (int) Math.round(descents[breakIndex])) ? Math.max(fmDescent, Math.round(descents[breakIndex])) : fmDescent; v = out(source, here, endPos, ascent, descent, fmTop, fmBottom, Loading Loading @@ -1175,7 +1173,7 @@ public class StaticLayout extends Layout { mWorkPaint.set(paint); do { final float ellipsizedWidth = guessEllipsis(text, lineStart, lineEnd, widths, widthStart, tempAvail, where, line, textWidth, mWorkPaint, forceEllipsis, dir); widthStart, tempAvail, where, line, mWorkPaint, forceEllipsis, dir); if (ellipsizedWidth <= avail) { lineFits = true; } else { Loading Loading @@ -1205,7 +1203,7 @@ public class StaticLayout extends Layout { // This method temporarily modifies the TextPaint passed to it, so the TextPaint passed to it // should not be accessed while the method is running. private float guessEllipsis(CharSequence text, int lineStart, int lineEnd, float[] widths, int widthStart, float avail, TextUtils.TruncateAt where, int line, float textWidth, int widthStart, float avail, TextUtils.TruncateAt where, int line, TextPaint paint, boolean forceEllipsis, int dir) { final int savedHyphenEdit = paint.getHyphenEdit(); paint.setHyphenEdit(0); Loading core/java/android/text/TextLine.java +5 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class TextLine { new SpanSet<ReplacementSpan>(ReplacementSpan.class); private final DecorationInfo mDecorationInfo = new DecorationInfo(); private final ArrayList<DecorationInfo> mDecorations = new ArrayList(); private final ArrayList<DecorationInfo> mDecorations = new ArrayList<>(); private static final TextLine[] sCached = new TextLine[3]; Loading Loading @@ -340,14 +340,14 @@ class TextLine { boolean advance = (mDir == Layout.DIR_RIGHT_TO_LEFT) == runIsRtl; if (inSegment && advance) { return h += measureRun(segstart, offset, j, runIsRtl, fmi); return h + measureRun(segstart, offset, j, runIsRtl, fmi); } float w = measureRun(segstart, j, j, runIsRtl, fmi); h += advance ? w : -w; if (inSegment) { return h += measureRun(segstart, offset, j, runIsRtl, null); return h + measureRun(segstart, offset, j, runIsRtl, null); } if (codept == '\t') { Loading Loading @@ -828,14 +828,14 @@ class TextLine { } if (info.isUnderlineText) { final float thickness = Math.max(((Paint) wp).getUnderlineThickness(), 1.0f); Math.max(wp.getUnderlineThickness(), 1.0f); drawStroke(wp, c, wp.getColor(), wp.getUnderlinePosition(), thickness, decorationXLeft, decorationXRight, y); } if (info.isStrikeThruText) { final float thickness = Math.max(((Paint) wp).getStrikeThruThickness(), 1.0f); Math.max(wp.getStrikeThruThickness(), 1.0f); drawStroke(wp, c, wp.getColor(), wp.getStrikeThruPosition(), thickness, decorationXLeft, decorationXRight, y); } Loading Loading
core/java/android/text/DynamicLayout.java +3 −3 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ public class DynamicLayout extends Layout private final Paint.FontMetricsInt mFontMetricsInt = new Paint.FontMetricsInt(); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<Builder>(3); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<>(3); } /** Loading Loading @@ -440,7 +440,7 @@ public class DynamicLayout extends Layout mEllipsizeAt = null; } mObjects = new PackedObjectVector<Directions>(1); mObjects = new PackedObjectVector<>(1); // Initial state is a single line with 0 characters (0 to 0), with top at 0 and bottom at // whatever is natural, and undefined ellipsis. Loading Loading @@ -1050,7 +1050,7 @@ public class DynamicLayout extends Layout private static class ChangeWatcher implements TextWatcher, SpanWatcher { public ChangeWatcher(DynamicLayout layout) { mLayout = new WeakReference<DynamicLayout>(layout); mLayout = new WeakReference<>(layout); } private void reflow(CharSequence s, int where, int before, int after) { Loading
core/java/android/text/Layout.java +2 −12 Original line number Diff line number Diff line Loading @@ -319,8 +319,6 @@ public abstract class Layout { private float getJustifyWidth(int lineNum) { Alignment paraAlign = mAlignment; TabStops tabStops = null; boolean tabStopsIsInitialized = false; int left = 0; int right = mWidth; Loading Loading @@ -371,10 +369,6 @@ public abstract class Layout { } } if (getLineContainsTab(lineNum)) { tabStops = new TabStops(TAB_INCREMENT, spans); } final Alignment align; if (paraAlign == Alignment.ALIGN_LEFT) { align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_NORMAL : Alignment.ALIGN_OPPOSITE; Loading Loading @@ -1423,7 +1417,6 @@ public abstract class Layout { float dist = Math.abs(getHorizontal(max, primary) - horiz); if (dist <= bestdist) { bestdist = dist; best = max; } Loading Loading @@ -1570,7 +1563,7 @@ public abstract class Layout { // XXX: we don't care about tabs tl.set(mPaint, mText, lineStart, lineEnd, lineDir, directions, false, null); caret = lineStart + tl.getOffsetToLeftRightOf(caret - lineStart, toLeft); tl = TextLine.recycle(tl); TextLine.recycle(tl); return caret; } Loading Loading @@ -1894,10 +1887,7 @@ public abstract class Layout { int margin = 0; boolean isFirstParaLine = lineStart == 0 || spanned.charAt(lineStart - 1) == '\n'; boolean useFirstLineMargin = isFirstParaLine; boolean useFirstLineMargin = lineStart == 0 || spanned.charAt(lineStart - 1) == '\n'; for (int i = 0; i < spans.length; i++) { if (spans[i] instanceof LeadingMarginSpan2) { int spStart = spanned.getSpanStart(spans[i]); Loading
core/java/android/text/StaticLayout.java +5 −7 Original line number Diff line number Diff line Loading @@ -440,8 +440,6 @@ public class StaticLayout extends Layout { private Pair<String, long[]> getLocaleAndHyphenatorIfChanged(TextPaint paint) { final LocaleList locales = paint.getTextLocales(); final String languageTags; long[] hyphenators; if (!locales.equals(mLocales)) { mLocales = locales; return new Pair(locales.toLanguageTags(), getHyphenators(locales)); Loading Loading @@ -520,7 +518,7 @@ public class StaticLayout extends Layout { private LocaleList mLocales; private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<Builder>(3); private static final SynchronizedPool<Builder> sPool = new SynchronizedPool<>(3); } public StaticLayout(CharSequence source, TextPaint paint, Loading Loading @@ -945,10 +943,10 @@ public class StaticLayout extends Layout { boolean moreChars = (endPos < bufEnd); final int ascent = fallbackLineSpacing ? Math.min(fmAscent, (int) Math.round(ascents[breakIndex])) ? Math.min(fmAscent, Math.round(ascents[breakIndex])) : fmAscent; final int descent = fallbackLineSpacing ? Math.max(fmDescent, (int) Math.round(descents[breakIndex])) ? Math.max(fmDescent, Math.round(descents[breakIndex])) : fmDescent; v = out(source, here, endPos, ascent, descent, fmTop, fmBottom, Loading Loading @@ -1175,7 +1173,7 @@ public class StaticLayout extends Layout { mWorkPaint.set(paint); do { final float ellipsizedWidth = guessEllipsis(text, lineStart, lineEnd, widths, widthStart, tempAvail, where, line, textWidth, mWorkPaint, forceEllipsis, dir); widthStart, tempAvail, where, line, mWorkPaint, forceEllipsis, dir); if (ellipsizedWidth <= avail) { lineFits = true; } else { Loading Loading @@ -1205,7 +1203,7 @@ public class StaticLayout extends Layout { // This method temporarily modifies the TextPaint passed to it, so the TextPaint passed to it // should not be accessed while the method is running. private float guessEllipsis(CharSequence text, int lineStart, int lineEnd, float[] widths, int widthStart, float avail, TextUtils.TruncateAt where, int line, float textWidth, int widthStart, float avail, TextUtils.TruncateAt where, int line, TextPaint paint, boolean forceEllipsis, int dir) { final int savedHyphenEdit = paint.getHyphenEdit(); paint.setHyphenEdit(0); Loading
core/java/android/text/TextLine.java +5 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class TextLine { new SpanSet<ReplacementSpan>(ReplacementSpan.class); private final DecorationInfo mDecorationInfo = new DecorationInfo(); private final ArrayList<DecorationInfo> mDecorations = new ArrayList(); private final ArrayList<DecorationInfo> mDecorations = new ArrayList<>(); private static final TextLine[] sCached = new TextLine[3]; Loading Loading @@ -340,14 +340,14 @@ class TextLine { boolean advance = (mDir == Layout.DIR_RIGHT_TO_LEFT) == runIsRtl; if (inSegment && advance) { return h += measureRun(segstart, offset, j, runIsRtl, fmi); return h + measureRun(segstart, offset, j, runIsRtl, fmi); } float w = measureRun(segstart, j, j, runIsRtl, fmi); h += advance ? w : -w; if (inSegment) { return h += measureRun(segstart, offset, j, runIsRtl, null); return h + measureRun(segstart, offset, j, runIsRtl, null); } if (codept == '\t') { Loading Loading @@ -828,14 +828,14 @@ class TextLine { } if (info.isUnderlineText) { final float thickness = Math.max(((Paint) wp).getUnderlineThickness(), 1.0f); Math.max(wp.getUnderlineThickness(), 1.0f); drawStroke(wp, c, wp.getColor(), wp.getUnderlinePosition(), thickness, decorationXLeft, decorationXRight, y); } if (info.isStrikeThruText) { final float thickness = Math.max(((Paint) wp).getStrikeThruThickness(), 1.0f); Math.max(wp.getStrikeThruThickness(), 1.0f); drawStroke(wp, c, wp.getColor(), wp.getStrikeThruPosition(), thickness, decorationXLeft, decorationXRight, y); } Loading