mirror of https://github.com/M66B/FairEmail.git
RTL list fixes
This commit is contained in:
parent
9278fa2eef
commit
9c4d7b0312
|
@ -63,6 +63,6 @@ public class BulletSpanEx extends BulletSpan {
|
|||
|
||||
@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, top, baseline, bottom, text, start, end, first, layout);
|
||||
super.drawLeadingMargin(canvas, paint, x + indentWidth * level * dir, dir, top, baseline, bottom, text, start, end, first, layout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,12 +28,13 @@ import android.text.TextPaint;
|
|||
import android.text.style.BulletSpan;
|
||||
|
||||
public class NumberSpan extends BulletSpan {
|
||||
int indentWidth;
|
||||
private int indentWidth;
|
||||
private int level;
|
||||
private int index;
|
||||
|
||||
private TextPaint tp;
|
||||
private String number;
|
||||
private int numberWidth;
|
||||
private int margin;
|
||||
|
||||
public NumberSpan(int indentWidth, int gapWidth, int color, float textSize, int level, int index) {
|
||||
|
@ -48,7 +49,8 @@ public class NumberSpan extends BulletSpan {
|
|||
this.index = index;
|
||||
|
||||
number = index + ".";
|
||||
margin = Math.round(tp.measureText(number)) + gapWidth;
|
||||
numberWidth = Math.round(tp.measureText(number));
|
||||
margin = numberWidth + gapWidth;
|
||||
}
|
||||
|
||||
float getTextSize() {
|
||||
|
@ -81,7 +83,8 @@ public class NumberSpan extends BulletSpan {
|
|||
float textSize = tp.getTextSize();
|
||||
if (textSize > p.getTextSize())
|
||||
tp.setTextSize(p.getTextSize());
|
||||
c.drawText(number, x + indentWidth * level, baseline, tp);
|
||||
int offset = (dir < 0 ? numberWidth : 0);
|
||||
c.drawText(number, x + indentWidth * level * dir - offset, baseline, tp);
|
||||
tp.setTextSize(textSize);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue