Loading core/java/android/widget/TextView.java +4 −9 Original line number Original line Diff line number Diff line Loading @@ -6980,19 +6980,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; return false; } } private static int desired(Layout layout, int maxLines) { private static int desired(Layout layout) { int n = layout.getLineCount(); int n = layout.getLineCount(); CharSequence text = layout.getText(); CharSequence text = layout.getText(); float max = 0; float max = 0; // if maxLines is set, and the text length is greater that the length of the text in the // layout, it means that there is a cut-off and we cannot use it. if (maxLines != -1 && text.length() > layout.getLineEnd(n - 1)) { return -1; } // if any line was wrapped, we can't use it. // if any line was wrapped, we can't use it. // but it's ok for the last line not to have a newline // but it's ok for the last line not to have a newline for (int i = 0; i < n - 1; i++) { for (int i = 0; i < n - 1; i++) { if (text.charAt(layout.getLineEnd(i) - 1) != '\n') if (text.charAt(layout.getLineEnd(i) - 1) != '\n') return -1; return -1; Loading Loading @@ -7065,7 +7060,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener width = widthSize; width = widthSize; } else { } else { if (mLayout != null && mEllipsize == null) { if (mLayout != null && mEllipsize == null) { des = desired(mLayout, getMaxLines()); des = desired(mLayout); } } if (des < 0) { if (des < 0) { Loading Loading @@ -7097,7 +7092,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener int hintWidth; int hintWidth; if (mHintLayout != null && mEllipsize == null) { if (mHintLayout != null && mEllipsize == null) { hintDes = desired(mHintLayout, getMaxLines()); hintDes = desired(mHintLayout); } } if (hintDes < 0) { if (hintDes < 0) { Loading Loading
core/java/android/widget/TextView.java +4 −9 Original line number Original line Diff line number Diff line Loading @@ -6980,19 +6980,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; return false; } } private static int desired(Layout layout, int maxLines) { private static int desired(Layout layout) { int n = layout.getLineCount(); int n = layout.getLineCount(); CharSequence text = layout.getText(); CharSequence text = layout.getText(); float max = 0; float max = 0; // if maxLines is set, and the text length is greater that the length of the text in the // layout, it means that there is a cut-off and we cannot use it. if (maxLines != -1 && text.length() > layout.getLineEnd(n - 1)) { return -1; } // if any line was wrapped, we can't use it. // if any line was wrapped, we can't use it. // but it's ok for the last line not to have a newline // but it's ok for the last line not to have a newline for (int i = 0; i < n - 1; i++) { for (int i = 0; i < n - 1; i++) { if (text.charAt(layout.getLineEnd(i) - 1) != '\n') if (text.charAt(layout.getLineEnd(i) - 1) != '\n') return -1; return -1; Loading Loading @@ -7065,7 +7060,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener width = widthSize; width = widthSize; } else { } else { if (mLayout != null && mEllipsize == null) { if (mLayout != null && mEllipsize == null) { des = desired(mLayout, getMaxLines()); des = desired(mLayout); } } if (des < 0) { if (des < 0) { Loading Loading @@ -7097,7 +7092,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener int hintWidth; int hintWidth; if (mHintLayout != null && mEllipsize == null) { if (mHintLayout != null && mEllipsize == null) { hintDes = desired(mHintLayout, getMaxLines()); hintDes = desired(mHintLayout); } } if (hintDes < 0) { if (hintDes < 0) { Loading