mirror of https://github.com/M66B/FairEmail.git
Use dp for block quotes
This commit is contained in:
parent
f5389600a9
commit
3c6678197e
|
@ -2591,7 +2591,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
QuoteSpan[] quoteSpans = builder.getSpans(0, builder.length(), QuoteSpan.class);
|
QuoteSpan[] quoteSpans = builder.getSpans(0, builder.length(), QuoteSpan.class);
|
||||||
for (QuoteSpan quoteSpan : quoteSpans) {
|
for (QuoteSpan quoteSpan : quoteSpans) {
|
||||||
builder.setSpan(
|
builder.setSpan(
|
||||||
new StyledQuoteSpan(colorPrimary),
|
new StyledQuoteSpan(context, colorPrimary),
|
||||||
builder.getSpanStart(quoteSpan),
|
builder.getSpanStart(quoteSpan),
|
||||||
builder.getSpanEnd(quoteSpan),
|
builder.getSpanEnd(quoteSpan),
|
||||||
builder.getSpanFlags(quoteSpan));
|
builder.getSpanFlags(quoteSpan));
|
||||||
|
|
|
@ -3096,7 +3096,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
QuoteSpan[] quoteSpans = builder.getSpans(0, builder.length(), QuoteSpan.class);
|
QuoteSpan[] quoteSpans = builder.getSpans(0, builder.length(), QuoteSpan.class);
|
||||||
for (QuoteSpan quoteSpan : quoteSpans) {
|
for (QuoteSpan quoteSpan : quoteSpans) {
|
||||||
builder.setSpan(
|
builder.setSpan(
|
||||||
new StyledQuoteSpan(colorPrimary),
|
new StyledQuoteSpan(context, colorPrimary),
|
||||||
builder.getSpanStart(quoteSpan),
|
builder.getSpanStart(quoteSpan),
|
||||||
builder.getSpanEnd(quoteSpan),
|
builder.getSpanEnd(quoteSpan),
|
||||||
builder.getSpanFlags(quoteSpan));
|
builder.getSpanFlags(quoteSpan));
|
||||||
|
|
|
@ -19,6 +19,7 @@ package eu.faircode.email;
|
||||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
|
@ -27,13 +28,18 @@ import android.text.style.QuoteSpan;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class StyledQuoteSpan extends QuoteSpan {
|
public class StyledQuoteSpan extends QuoteSpan {
|
||||||
StyledQuoteSpan(int color) {
|
private int stripeWidth;
|
||||||
|
private int gapWidth;
|
||||||
|
|
||||||
|
StyledQuoteSpan(Context context, int color) {
|
||||||
super(color);
|
super(color);
|
||||||
|
stripeWidth = Helper.dp2pixels(context, 3);
|
||||||
|
gapWidth = Helper.dp2pixels(context, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLeadingMargin(boolean first) {
|
public int getLeadingMargin(boolean first) {
|
||||||
return 6 /* stripeWidth */ + 12 /* gapWidth */;
|
return stripeWidth + gapWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +54,7 @@ public class StyledQuoteSpan extends QuoteSpan {
|
||||||
p.setStyle(Paint.Style.FILL);
|
p.setStyle(Paint.Style.FILL);
|
||||||
p.setColor(getColor());
|
p.setColor(getColor());
|
||||||
|
|
||||||
c.drawRect(x, top, x + dir * 6 /* stripeWidth */, bottom, p);
|
c.drawRect(x, top, x + dir * stripeWidth, bottom, p);
|
||||||
|
|
||||||
p.setStyle(style);
|
p.setStyle(style);
|
||||||
p.setColor(color);
|
p.setColor(color);
|
||||||
|
|
Loading…
Reference in New Issue