Example usage for android.text Spanned charAt

List of usage examples for android.text Spanned charAt

Introduction

In this page you can find the example usage for android.text Spanned charAt.

Prototype

char charAt(int index);

Source Link

Document

Returns the char value at the specified index.

Usage

From source file:org.miaowo.miaowo.util.Html.java

private static void withinBlockquoteConsecutive(StringBuilder out, Spanned text, int start, int end,
        Context context) {/* w  w  w .  j  av a  2  s  . co m*/
    out.append("<p").append(getTextDirection(text, start, end)).append(">");

    int next;
    for (int i = start; i < end; i = next) {
        next = TextUtils.indexOf(text, '\n', i, end);
        if (next < 0) {
            next = end;
        }

        int nl = 0;

        while (next < end && text.charAt(next) == '\n') {
            nl++;
            next++;
        }

        withinParagraph(out, text, i, next - nl, context);

        if (nl == 1) {
            out.append("<br>\n");
        } else {
            for (int j = 2; j < nl; j++) {
                out.append("<br>");
            }
            if (next != end) {
                /* Paragraph should be closed and reopened */
                out.append("</p>\n");
                out.append("<p").append(getTextDirection(text, start, end)).append(">");
            }
        }
    }

    out.append("</p>\n");
}