Spannable removeSpan - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spannable removeSpan method.

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) {
8
CodeRank
This code example shows how to use the following methods:removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
7
CodeRank
This code example shows how to use the following methods:removeSelection, removeSpan
        return pressed;
    } 
 
    @Override 
    public void initialize(TextView widget, Spannable text) {
        Selection.removeSelection(text);
        text.removeSpan(FROM_BELOW);
    } 
 
    @Override 
    public void onTakeFocus(TextView view, Spannable text, int dir) {
        Selection.removeSelection(text);
 
        if ((dir & View.FOCUS_BACKWARD) != 0) {
            text.setSpan(FROM_BELOW, 0, 0, Spannable.SPAN_POINT_POINT);
        } else { 
            text.removeSpan(FROM_BELOW);
        } 
    } 
 
7
CodeRank
This code example shows how to use the following methods:removeSpan, setSpan, getSpanFlags
 
        return false; // no super to call through to 
    } 
 
    private void press(Editable content, Object what) {
        int state = content.getSpanFlags(what);
 
        if (state == PRESSED)
            ; // repeat before use 
        else if (state == RELEASED)
            content.setSpan(what, 0, 0, LOCKED);
        else if (state == USED)
            ; // repeat after use 
        else if (state == LOCKED)
            content.removeSpan(what);
        else 
            content.setSpan(what, 0, 0, PRESSED);
    } 
 
    /** 

7
CodeRank
This code example shows how to use the following methods:removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
 
 
			int line = getLayout().getLineForVertical(y);
			int off = getLayout().getOffsetForHorizontal(line, x);
 
			URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
 
			if (link.length != 0) {
				if (action == MotionEvent.ACTION_UP) {
					if (mClickedLink == link[0]) {
						link[0].onClick(widget);
					} 
					mClickedLink = null;
					buffer.removeSpan(mClickedColorStyle);
				} else if (action == MotionEvent.ACTION_DOWN) {
					mClickedLink = link[0];
					buffer.setSpan(mClickedColorStyle, buffer.getSpanStart(link[0]), buffer
							.getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
				} 
 

6
CodeRank
This code example shows how to use the following methods:removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
 
 
			int line = getLayout().getLineForVertical(y);
			int off = getLayout().getOffsetForHorizontal(line, x);
 
			URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
 
			if (link.length != 0) {
				if (action == MotionEvent.ACTION_UP) {
					if (mClickedLink == link[0]) {
						link[0].onClick(widget);
					} 
					mClickedLink = null;
					buffer.removeSpan(mClickedColorStyle);
				} else if (action == MotionEvent.ACTION_DOWN) {
					mClickedLink = link[0];
					buffer.setSpan(mClickedColorStyle, buffer.getSpanStart(link[0]), buffer
							.getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
				} 
 

6
CodeRank
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) {
6
CodeRank
This code example shows how to use the following methods:removeSpan, setSpan, getSpanEnd, getSpanStart, getSpans
 
      Layout layout = widget.getLayout();
      int line = layout.getLineForVertical(y);
      int off = layout.getOffsetForHorizontal(line, x);
 
      URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
 
      if (link.length != 0) {
        if (action == MotionEvent.ACTION_UP) {
          if (mCurrentLink == link[0]) {
            link[0].onClick(widget);
          } 
          mCurrentLink = null;
          buffer.removeSpan(mLinkFocusStyle);
        } else if (action == MotionEvent.ACTION_DOWN) {
          mCurrentLink = link[0];
          buffer.setSpan(mLinkFocusStyle, buffer.getSpanStart(link[0]), buffer
              .getSpanEnd(link[0]), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        } 
 

6
CodeRank
This code example shows how to use the following methods:replace, setSelection, removeSpan, setSpan, length
            } 
        } 
 
        // allText is at this point either "userText" (not null) or 
        // "suggested" if thats not null and starts with userText. 
        text.replace(0, text.length(), allText);
        Selection.setSelection(text, selStart, selEnd);
        mUserEntered.replace(0, mUserEntered.length(), userText);
        mSuggestedText = suggested;
        if (suggestedStart < text.length()) {
            text.setSpan(mSuggested, suggestedStart, text.length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        } else { 
            text.removeSpan(mSuggested);
        } 
        text.setSpan(mBufferSpanWatcher, 0, text.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
        mTextOwner.addTextChangedListener(mBufferTextWatcher);
        if (DBG) checkInvariant(text);
    } 
 
    private void assertNotIgnoringSelectionChanges() { 
5
CodeRank
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) {
5
CodeRank

Related Spannable removeSpan Questions & Answers:

removeSpan Method Overview
Remove the specified object from the range of text to which it was attached, if any.
See Code Examples for other Android Spannable Methods: