(EditText etBody, int start, int end, Integer color, boolean select)
| 761 | } |
| 762 | |
| 763 | static void setColor(EditText etBody, int start, int end, Integer color, boolean select) { |
| 764 | Log.breadcrumb("style", "action", "color"); |
| 765 | |
| 766 | Editable edit = etBody.getText(); |
| 767 | ForegroundColorSpan spans[] = edit.getSpans(start, end, ForegroundColorSpan.class); |
| 768 | for (ForegroundColorSpan span : spans) { |
| 769 | int s = edit.getSpanStart(span); |
| 770 | int e = edit.getSpanEnd(span); |
| 771 | int f = edit.getSpanFlags(span); |
| 772 | edit.removeSpan(span); |
| 773 | splitSpan(edit, start, end, s, e, f, false, |
| 774 | new ForegroundColorSpan(span.getForegroundColor()), |
| 775 | new ForegroundColorSpan(span.getForegroundColor())); |
| 776 | } |
| 777 | |
| 778 | if (color != null) |
| 779 | edit.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| 780 | |
| 781 | etBody.setText(edit); |
| 782 | etBody.setSelection(select ? start : end, end); |
| 783 | } |
| 784 | |
| 785 | static boolean selectFont(LifecycleOwner owner, View anchor, EditText etBody, int start, int end, boolean select) { |
| 786 | Log.breadcrumb("style", "action", "selectFont"); |
no test coverage detected