Android Spanned - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Spanned class.

This code example shows how to use the following methods: removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: removeSpan, setSpan, getSpanStart, length
        int length = output.length();
        output.setSpan(span, length, length, SPAN_MARK_MARK);
    } 
 
    private static void endSpan(Class<?> type, Editable output) {
        int length = output.length();
        Object span = getLast(output, type);
        int start = output.getSpanStart(span);
        output.removeSpan(span);
        if (start != length)
            output.setSpan(span, start, length, SPAN_EXCLUSIVE_EXCLUSIVE);
    } 
 
    /** 
     * Encode HTML 
     * 
     * @param html 
     * @return html 
     */ 
    public static CharSequence encode(final String html) {
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: length, subSequence
                    dstart, dend);
            if (filtered == null) {
                filtered = source.subSequence(start, end);
            } 
 
            String result = String.valueOf(dest.subSequence(0, dstart))
                + filtered + dest.subSequence(dend, dest.length());
 
            if ("".equals(result)) {
                return result;
            } 
 
            if (getMaxDigits() > 0 && result.length() > getMaxDigits())
                return ""; 
 
            int val = getSelectedPos(result);
 
            /* 
             * Ensure the user can't type in a value greater than the max 
             * allowed. We have to allow less than min as the user might want to 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getSpans, charAt, length
		bypass.markdownToSpannable("");
	} 
 
	public void testHeaderString() { 
		Spannable spannable = (Spannable) bypass.markdownToSpannable("Header!!\n--------");
		StyleSpan[] spans = spannable.getSpans(0, spannable.length(), StyleSpan.class);
		assertEquals(1, spans.length);
		RelativeSizeSpan[] sizeSpan = spannable.getSpans(0, spannable.length(), RelativeSizeSpan.class);
		assertEquals(1, sizeSpan.length);
		assertEquals('\n', spannable.charAt(spannable.length() - 1));
	} 
	 
	public void testBoldString() { 
		Spannable spannable = (Spannable) bypass.markdownToSpannable("One **Two** Three");
		StyleSpan[] spans = spannable.getSpans(0, spannable.length(), StyleSpan.class);
		assertEquals(1, spans.length);
		assertEquals(Typeface.BOLD, spans[0].getStyle());
		assertEquals(4, spannable.getSpanStart(spans[0]));
		assertEquals(7, spannable.getSpanEnd(spans[0]));
	} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getSpans
        if (mTextView == null) {
            return super.commitText(text, newCursorPosition);
        } 
        if (text instanceof Spanned) {
            Spanned spanned = ((Spanned) text);
            SuggestionSpan[] spans = spanned.getSpans(0, text.length(), SuggestionSpan.class);
            mIMM.registerSuggestionSpansForNotification(spans);
        } 
 
        mTextView.resetErrorChangedFlag();
        boolean success = super.commitText(text, newCursorPosition);
        mTextView.hideErrorIfUnchanged();
 
        return success;
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Spanned Questions & Answers:

See Code Examples for Android Spanned Methods: