Search in sources :

Example 6 with QuoteSpan

use of android.text.style.QuoteSpan in project Knife by mthli.

the class KnifeText method switchToKnifeStyle.

protected void switchToKnifeStyle(Editable editable, int start, int end) {
    BulletSpan[] bulletSpans = editable.getSpans(start, end, BulletSpan.class);
    for (BulletSpan span : bulletSpans) {
        int spanStart = editable.getSpanStart(span);
        int spanEnd = editable.getSpanEnd(span);
        spanEnd = 0 < spanEnd && spanEnd < editable.length() && editable.charAt(spanEnd) == '\n' ? spanEnd - 1 : spanEnd;
        editable.removeSpan(span);
        editable.setSpan(new KnifeBulletSpan(bulletColor, bulletRadius, bulletGapWidth), spanStart, spanEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    QuoteSpan[] quoteSpans = editable.getSpans(start, end, QuoteSpan.class);
    for (QuoteSpan span : quoteSpans) {
        int spanStart = editable.getSpanStart(span);
        int spanEnd = editable.getSpanEnd(span);
        spanEnd = 0 < spanEnd && spanEnd < editable.length() && editable.charAt(spanEnd) == '\n' ? spanEnd - 1 : spanEnd;
        editable.removeSpan(span);
        editable.setSpan(new KnifeQuoteSpan(quoteColor, quoteStripeWidth, quoteGapWidth), spanStart, spanEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    URLSpan[] urlSpans = editable.getSpans(start, end, URLSpan.class);
    for (URLSpan span : urlSpans) {
        int spanStart = editable.getSpanStart(span);
        int spanEnd = editable.getSpanEnd(span);
        editable.removeSpan(span);
        editable.setSpan(new KnifeURLSpan(span.getURL(), linkColor, linkUnderline), spanStart, spanEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}
Also used : BulletSpan(android.text.style.BulletSpan) QuoteSpan(android.text.style.QuoteSpan) URLSpan(android.text.style.URLSpan)

Example 7 with QuoteSpan

use of android.text.style.QuoteSpan in project platform_frameworks_base by android.

the class HtmlToSpannedConverter method withinDiv.

private static void withinDiv(StringBuilder out, Spanned text, int start, int end, int option) {
    int next;
    for (int i = start; i < end; i = next) {
        next = text.nextSpanTransition(i, end, QuoteSpan.class);
        QuoteSpan[] quotes = text.getSpans(i, next, QuoteSpan.class);
        for (QuoteSpan quote : quotes) {
            out.append("<blockquote>");
        }
        withinBlockquote(out, text, i, next, option);
        for (QuoteSpan quote : quotes) {
            out.append("</blockquote>\n");
        }
    }
}
Also used : QuoteSpan(android.text.style.QuoteSpan)

Example 8 with QuoteSpan

use of android.text.style.QuoteSpan in project XobotOS by xamarin.

the class HtmlToSpannedConverter method withinDiv.

private static void withinDiv(StringBuilder out, Spanned text, int start, int end) {
    int next;
    for (int i = start; i < end; i = next) {
        next = text.nextSpanTransition(i, end, QuoteSpan.class);
        QuoteSpan[] quotes = text.getSpans(i, next, QuoteSpan.class);
        for (QuoteSpan quote : quotes) {
            out.append("<blockquote>");
        }
        withinBlockquote(out, text, i, next);
        for (QuoteSpan quote : quotes) {
            out.append("</blockquote>\n");
        }
    }
}
Also used : QuoteSpan(android.text.style.QuoteSpan)

Example 9 with QuoteSpan

use of android.text.style.QuoteSpan in project android_frameworks_base by DirtyUnicorns.

the class HtmlToSpannedConverter method withinDiv.

private static void withinDiv(StringBuilder out, Spanned text, int start, int end, int option) {
    int next;
    for (int i = start; i < end; i = next) {
        next = text.nextSpanTransition(i, end, QuoteSpan.class);
        QuoteSpan[] quotes = text.getSpans(i, next, QuoteSpan.class);
        for (QuoteSpan quote : quotes) {
            out.append("<blockquote>");
        }
        withinBlockquote(out, text, i, next, option);
        for (QuoteSpan quote : quotes) {
            out.append("</blockquote>\n");
        }
    }
}
Also used : QuoteSpan(android.text.style.QuoteSpan)

Example 10 with QuoteSpan

use of android.text.style.QuoteSpan in project android_frameworks_base by DirtyUnicorns.

the class HtmlToSpannedConverter method endBlockquote.

private static void endBlockquote(Editable text) {
    endBlockElement(text);
    end(text, Blockquote.class, new QuoteSpan());
}
Also used : QuoteSpan(android.text.style.QuoteSpan)

Aggregations

QuoteSpan (android.text.style.QuoteSpan)24 StyleSpan (android.text.style.StyleSpan)5 RelativeSizeSpan (android.text.style.RelativeSizeSpan)3 StrikethroughSpan (android.text.style.StrikethroughSpan)3 SubscriptSpan (android.text.style.SubscriptSpan)3 SuperscriptSpan (android.text.style.SuperscriptSpan)3 TypefaceSpan (android.text.style.TypefaceSpan)3 WPUnderlineSpan (org.wordpress.android.util.helpers.WPUnderlineSpan)3 UnderlineSpan (android.text.style.UnderlineSpan)2 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 Spannable (android.text.Spannable)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 BulletSpan (android.text.style.BulletSpan)1 ForegroundColorSpan (android.text.style.ForegroundColorSpan)1 URLSpan (android.text.style.URLSpan)1 WPHtmlTagHandler (org.wordpress.android.util.helpers.WPHtmlTagHandler)1 WPQuoteSpan (org.wordpress.android.util.helpers.WPQuoteSpan)1