mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Added strikethrough
This commit is contained in:
@@ -15,6 +15,7 @@ import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.QuoteSpan;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.text.style.StrikethroughSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.TypefaceSpan;
|
||||
import android.text.style.URLSpan;
|
||||
@@ -122,6 +123,8 @@ public class StyleHelper {
|
||||
return setFont(item);
|
||||
case R.id.group_style_blockquote:
|
||||
return setBlockquote(item);
|
||||
case R.id.group_style_strikethrough:
|
||||
return setStrikethrough(item);
|
||||
case R.id.group_style_clear:
|
||||
return clear(item);
|
||||
default:
|
||||
@@ -321,6 +324,22 @@ public class StyleHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setStrikethrough(MenuItem item) {
|
||||
boolean has = false;
|
||||
for (StrikethroughSpan span : t.getSpans(s, e, StrikethroughSpan.class)) {
|
||||
has = true;
|
||||
t.removeSpan(span);
|
||||
}
|
||||
|
||||
if (!has)
|
||||
t.setSpan(new StrikethroughSpan(), s, e, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
etBody.setText(t);
|
||||
etBody.setSelection(s, e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean clear(MenuItem item) {
|
||||
for (Object span : t.getSpans(s, e, Object.class))
|
||||
if (!(span instanceof ImageSpan))
|
||||
|
||||
Reference in New Issue
Block a user