Search in sources :

Example 1 with MarkDownBulletSpan

use of com.zzhoujay.markdown.style.MarkDownBulletSpan in project RichText by zzhoujay.

the class HtmlTagHandler method reallyHandler.

private void reallyHandler(int start, int end, String tag, Editable out, XMLReader reader) {
    switch(tag.toLowerCase()) {
        case "code":
            CodeSpan cs = new CodeSpan(code_color);
            out.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            break;
        case "ol":
        case "ul":
            out.append('\n');
            if (!list.isEmpty())
                list.pop();
            break;
        case "li":
            boolean isUl = list.peek();
            int i;
            if (isUl) {
                index = 0;
                i = -1;
            } else {
                i = ++index;
            }
            out.append('\n');
            TextView textView = textViewSoftReference.get();
            if (textView == null) {
                return;
            }
            MarkDownBulletSpan bulletSpan = new MarkDownBulletSpan(list.size() - 1, h1_color, i, textView);
            out.setSpan(bulletSpan, start, out.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            break;
    }
}
Also used : MarkDownBulletSpan(com.zzhoujay.markdown.style.MarkDownBulletSpan) CodeSpan(com.zzhoujay.markdown.style.CodeSpan) TextView(android.widget.TextView)

Aggregations

TextView (android.widget.TextView)1 CodeSpan (com.zzhoujay.markdown.style.CodeSpan)1 MarkDownBulletSpan (com.zzhoujay.markdown.style.MarkDownBulletSpan)1