|
|
@ -550,15 +550,6 @@ public class StyleHelper {
|
|
|
|
if (paragraph == null)
|
|
|
|
if (paragraph == null)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (item.getItemId() == R.id.menu_style_indentation_decrease) {
|
|
|
|
|
|
|
|
IndentSpan[] indents = edit.getSpans(paragraph.first, paragraph.second, IndentSpan.class);
|
|
|
|
|
|
|
|
for (IndentSpan indent : indents) {
|
|
|
|
|
|
|
|
int s = edit.getSpanStart(indent);
|
|
|
|
|
|
|
|
int e = edit.getSpanEnd(indent);
|
|
|
|
|
|
|
|
if (s >= start && e <= end)
|
|
|
|
|
|
|
|
edit.removeSpan(indent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Context context = etBody.getContext();
|
|
|
|
Context context = etBody.getContext();
|
|
|
|
int intentSize = context.getResources().getDimensionPixelSize(R.dimen.indent_size);
|
|
|
|
int intentSize = context.getResources().getDimensionPixelSize(R.dimen.indent_size);
|
|
|
|
|
|
|
|
|
|
|
@ -566,8 +557,23 @@ public class StyleHelper {
|
|
|
|
for (QuoteSpan quote : quotes)
|
|
|
|
for (QuoteSpan quote : quotes)
|
|
|
|
edit.removeSpan(quote);
|
|
|
|
edit.removeSpan(quote);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int prev = paragraph.first;
|
|
|
|
|
|
|
|
int next = paragraph.first;
|
|
|
|
|
|
|
|
while (next < paragraph.second) {
|
|
|
|
|
|
|
|
while (next < paragraph.second && edit.charAt(next) != '\n')
|
|
|
|
|
|
|
|
next++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item.getItemId() == R.id.menu_style_indentation_decrease) {
|
|
|
|
|
|
|
|
IndentSpan[] indents = edit.getSpans(prev, prev, IndentSpan.class);
|
|
|
|
|
|
|
|
if (indents.length > 0)
|
|
|
|
|
|
|
|
edit.removeSpan(indents[0]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
IndentSpan is = new IndentSpan(intentSize);
|
|
|
|
IndentSpan is = new IndentSpan(intentSize);
|
|
|
|
edit.setSpan(is, paragraph.first, paragraph.second, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
edit.setSpan(is, prev, next + 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next++;
|
|
|
|
|
|
|
|
prev = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
etBody.setText(edit);
|
|
|
|
etBody.setText(edit);
|
|
|
|