summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/DynamicLayout.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-01-14 12:12:04 -0800
committerGilles Debunne <debunne@google.com>2011-01-30 18:23:13 -0800
commit0a4db3c5270440eeb7e4e44a7029926e239ec3bd (patch)
tree93978bf40f919f8c833a7fefac5727109d212efb /core/java/android/text/DynamicLayout.java
parentcd73d1ed6d1149a2ae642e87ffe8d89100fbafec (diff)
downloadframeworks_base-0a4db3c5270440eeb7e4e44a7029926e239ec3bd.zip
frameworks_base-0a4db3c5270440eeb7e4e44a7029926e239ec3bd.tar.gz
frameworks_base-0a4db3c5270440eeb7e4e44a7029926e239ec3bd.tar.bz2
Pixel were missing on the last line of text when using MaxLines.
Bug 3295544 Only the last line of text includes the bottomPadding (extra line spacing below the characters' descent. When The text is clipped using maxLines, the desired height correctly added this value, but getLineTop and getLineDescent are also used when the layout is drawn. The fix is to make the layout aware of its clipping so that these values are correctly updated. Change-Id: I703656cf45022d34a90f55f0ed8fc5e4b30f80b1
Diffstat (limited to 'core/java/android/text/DynamicLayout.java')
-rw-r--r--core/java/android/text/DynamicLayout.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java
index 403f20e..f196b34 100644
--- a/core/java/android/text/DynamicLayout.java
+++ b/core/java/android/text/DynamicLayout.java
@@ -92,7 +92,7 @@ extends Layout
} else {
mInts = new PackedIntVector(COLUMNS_NORMAL);
mEllipsizedWidth = width;
- mEllipsizeAt = ellipsize;
+ mEllipsizeAt = null;
}
mObjects = new PackedObjectVector<Directions>(1);
@@ -259,10 +259,9 @@ extends Layout
reflowed = new StaticLayout(true);
reflowed.generate(text, where, where + after,
- getPaint(), getWidth(), getAlignment(),
- getSpacingMultiplier(), getSpacingAdd(),
- false, true, mEllipsize,
- mEllipsizedWidth, mEllipsizeAt);
+ getPaint(), getWidth(), getAlignment(),
+ getSpacingMultiplier(), getSpacingAdd(),
+ false, true, mEllipsizedWidth, mEllipsizeAt);
int n = reflowed.getLineCount();
// If the new layout has a blank line at the end, but it is not
@@ -391,9 +390,7 @@ extends Layout
return mEllipsizedWidth;
}
- private static class ChangeWatcher
- implements TextWatcher, SpanWatcher
- {
+ private static class ChangeWatcher implements TextWatcher, SpanWatcher {
public ChangeWatcher(DynamicLayout layout) {
mLayout = new WeakReference<DynamicLayout>(layout);
}
@@ -407,12 +404,10 @@ extends Layout
((Spannable) s).removeSpan(this);
}
- public void beforeTextChanged(CharSequence s,
- int where, int before, int after) {
+ public void beforeTextChanged(CharSequence s, int where, int before, int after) {
}
- public void onTextChanged(CharSequence s,
- int where, int before, int after) {
+ public void onTextChanged(CharSequence s, int where, int before, int after) {
reflow(s, where, before, after);
}
@@ -429,8 +424,7 @@ extends Layout
reflow(s, start, end - start, end - start);
}
- public void onSpanChanged(Spannable s, Object o, int start, int end,
- int nstart, int nend) {
+ public void onSpanChanged(Spannable s, Object o, int start, int end, int nstart, int nend) {
if (o instanceof UpdateLayout) {
reflow(s, start, end - start, end - start);
reflow(s, nstart, nend - nstart, nend - nstart);