Always indent lists

This commit is contained in:
M66B 2021-05-06 11:01:27 +02:00
parent 9c4d7b0312
commit c174824bfc
2 changed files with 4 additions and 4 deletions

View File

@ -58,11 +58,11 @@ public class BulletSpanEx extends BulletSpan {
public int getLeadingMargin(boolean first) { public int getLeadingMargin(boolean first) {
// https://issuetracker.google.com/issues/36956124 // https://issuetracker.google.com/issues/36956124
// This is called before drawLeadingMargin to justify the text // This is called before drawLeadingMargin to justify the text
return indentWidth * level + super.getLeadingMargin(first); return indentWidth * (level + 1) + super.getLeadingMargin(first);
} }
@Override @Override
public void drawLeadingMargin(@NonNull Canvas canvas, @NonNull Paint paint, int x, int dir, int top, int baseline, int bottom, @NonNull CharSequence text, int start, int end, boolean first, @Nullable Layout layout) { public void drawLeadingMargin(@NonNull Canvas canvas, @NonNull Paint paint, int x, int dir, int top, int baseline, int bottom, @NonNull CharSequence text, int start, int end, boolean first, @Nullable Layout layout) {
super.drawLeadingMargin(canvas, paint, x + indentWidth * level * dir, dir, top, baseline, bottom, text, start, end, first, layout); super.drawLeadingMargin(canvas, paint, x + indentWidth * (level + 1) * dir, dir, top, baseline, bottom, text, start, end, first, layout);
} }
} }

View File

@ -73,7 +73,7 @@ public class NumberSpan extends BulletSpan {
public int getLeadingMargin(boolean first) { public int getLeadingMargin(boolean first) {
// https://issuetracker.google.com/issues/36956124 // https://issuetracker.google.com/issues/36956124
// This is called before drawLeadingMargin to justify the text // This is called before drawLeadingMargin to justify the text
return indentWidth * level + margin; return indentWidth * (level + 1) + margin;
} }
@Override @Override
@ -84,7 +84,7 @@ public class NumberSpan extends BulletSpan {
if (textSize > p.getTextSize()) if (textSize > p.getTextSize())
tp.setTextSize(p.getTextSize()); tp.setTextSize(p.getTextSize());
int offset = (dir < 0 ? numberWidth : 0); int offset = (dir < 0 ? numberWidth : 0);
c.drawText(number, x + indentWidth * level * dir - offset, baseline, tp); c.drawText(number, x + indentWidth * (level + 1) * dir - offset, baseline, tp);
tp.setTextSize(textSize); tp.setTextSize(textSize);
} }
} }