mirror of https://github.com/M66B/FairEmail.git
parent
4d3fcf51ff
commit
043f55e94c
@ -0,0 +1,37 @@
|
||||
package eu.faircode.email;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.text.Layout;
|
||||
import android.text.style.QuoteSpan;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class StyledQuoteSpan extends QuoteSpan {
|
||||
StyledQuoteSpan(int color) {
|
||||
super(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLeadingMargin(boolean first) {
|
||||
return 6 /* stripeWidth */ + 12 /* gapWidth */;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLeadingMargin(
|
||||
@NonNull Canvas c, @NonNull Paint p,
|
||||
int x, int dir, int top, int baseline, int bottom,
|
||||
@NonNull CharSequence text, int start, int end, boolean first,
|
||||
@NonNull Layout layout) {
|
||||
Paint.Style style = p.getStyle();
|
||||
int color = p.getColor();
|
||||
|
||||
p.setStyle(Paint.Style.FILL);
|
||||
p.setColor(getColor());
|
||||
|
||||
c.drawRect(x, top, x + dir * 6 /* stripeWidth */, bottom, p);
|
||||
|
||||
p.setStyle(style);
|
||||
p.setColor(color);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue