summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorSiyamed Sinir <siyamed@google.com>2016-05-26 18:25:26 -0700
committerSiyamed Sinir <siyamed@google.com>2016-05-26 18:33:33 -0700
commit24aba4b9e92d2abb3963974b9506681fda08e313 (patch)
tree55fc8fba0827b6a4e41cbdbf0f5a3fb09f379c4a /core/java/android/widget/TextView.java
parent0f6363e8b3b091508181ea6cef5f5f87a4f75016 (diff)
Set StaticLayout.maxLines only when ellipsize is set
A partial revert for the CL I5dbc48a6c7f0f4ac4c693d5c95f0a99b989e07f4. The mentioned CL tried to always set the maxLines attribute of StaticLayout. However this caused regressions at certain points. Bug: 28885989 Bug: 28468120 Change-Id: Ic09cb194c8811a06b5d53de50bfb77938b91b88d
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index fc120eb0e65f..5cbd2841b57a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6857,11 +6857,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
.setLineSpacing(mSpacingAdd, mSpacingMult)
.setIncludePad(mIncludePad)
.setBreakStrategy(mBreakStrategy)
- .setHyphenationFrequency(mHyphenationFrequency)
- .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
+ .setHyphenationFrequency(mHyphenationFrequency);
if (shouldEllipsize) {
builder.setEllipsize(mEllipsize)
- .setEllipsizedWidth(ellipsisWidth);
+ .setEllipsizedWidth(ellipsisWidth)
+ .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
}
mHintLayout = builder.build();
}
@@ -6948,12 +6948,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
.setLineSpacing(mSpacingAdd, mSpacingMult)
.setIncludePad(mIncludePad)
.setBreakStrategy(mBreakStrategy)
- .setHyphenationFrequency(mHyphenationFrequency)
- .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
+ .setHyphenationFrequency(mHyphenationFrequency);
if (shouldEllipsize) {
builder.setEllipsize(effectiveEllipsize)
- .setEllipsizedWidth(ellipsisWidth);
-
+ .setEllipsizedWidth(ellipsisWidth)
+ .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
}
// TODO: explore always setting maxLines
result = builder.build();