Always indent lists

pull/198/head
M66B 3 years ago
parent 9c4d7b0312
commit c174824bfc

@ -58,11 +58,11 @@ public class BulletSpanEx extends BulletSpan {
public int getLeadingMargin(boolean first) {
// https://issuetracker.google.com/issues/36956124
// This is called before drawLeadingMargin to justify the text
return indentWidth * level + super.getLeadingMargin(first);
return indentWidth * (level + 1) + super.getLeadingMargin(first);
}
@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) {
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);
}
}

@ -73,7 +73,7 @@ public class NumberSpan extends BulletSpan {
public int getLeadingMargin(boolean first) {
// https://issuetracker.google.com/issues/36956124
// This is called before drawLeadingMargin to justify the text
return indentWidth * level + margin;
return indentWidth * (level + 1) + margin;
}
@Override
@ -84,7 +84,7 @@ public class NumberSpan extends BulletSpan {
if (textSize > p.getTextSize())
tp.setTextSize(p.getTextSize());
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);
}
}

Loading…
Cancel
Save