Ensure separate line for quote expander

pull/212/head
M66B 2 years ago
parent d359ed2231
commit e9c567b897

@ -3132,9 +3132,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
for (QuoteSpan quoteSpan : lqs) { for (QuoteSpan quoteSpan : lqs) {
int s = ssb.getSpanStart(quoteSpan); int s = ssb.getSpanStart(quoteSpan);
int e = ssb.getSpanEnd(quoteSpan); int e = ssb.getSpanEnd(quoteSpan);
if (s == 0 || s == e)
continue;
if (show_quotes) { if (show_quotes) {
ssb.insert(s > 0 ? s - 1 : s, "0"); ssb.insert(s - 1, "\n0");
ssb.setSpan( ssb.setSpan(
new DynamicDrawableSpan() { new DynamicDrawableSpan() {
@Override @Override
@ -3142,12 +3144,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return d; return d;
} }
}, },
s > 0 ? s - 1 : s, s > 0 ? s : s + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE); s, s + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
} else { } else {
for (Object span : ssb.getSpans(s, e, Object.class)) for (Object span : ssb.getSpans(s, e, Object.class))
ssb.removeSpan(span); ssb.removeSpan(span);
ssb.delete(s, e); ssb.delete(s, e);
ssb.insert(s > 0 ? s - 1 : s, "1"); ssb.insert(s - 1, "\n1");
ssb.setSpan( ssb.setSpan(
new DynamicDrawableSpan() { new DynamicDrawableSpan() {
@Override @Override
@ -3155,7 +3157,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return d; return d;
} }
}, },
s > 0 ? s - 1 : s, s > 0 ? s : s + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE); s, s + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
} }
} }

Loading…
Cancel
Save