From c174824bfcf50f94e3e0c9a801e0aed4bc963226 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 6 May 2021 11:01:27 +0200 Subject: [PATCH] Always indent lists --- app/src/main/java/eu/faircode/email/BulletSpanEx.java | 4 ++-- app/src/main/java/eu/faircode/email/NumberSpan.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/BulletSpanEx.java b/app/src/main/java/eu/faircode/email/BulletSpanEx.java index 111bf96c1d..18b410f733 100644 --- a/app/src/main/java/eu/faircode/email/BulletSpanEx.java +++ b/app/src/main/java/eu/faircode/email/BulletSpanEx.java @@ -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); } } diff --git a/app/src/main/java/eu/faircode/email/NumberSpan.java b/app/src/main/java/eu/faircode/email/NumberSpan.java index 15f0338628..ae104abcb4 100644 --- a/app/src/main/java/eu/faircode/email/NumberSpan.java +++ b/app/src/main/java/eu/faircode/email/NumberSpan.java @@ -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); } }