android.text.style.QuoteSpan Java Examples

The following examples show how to use android.text.style.QuoteSpan. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: Overchan-Android   Author: miku-nyan   File: HtmlParser.java    License: GNU General Public License v3.0 6 votes vote down vote up
private static void endBlockquote(SpannableStringBuilder text, ThemeColors colors) {
    int len = text.length();
    Object obj = getLast(text, Blockquote.class);
    int where = text.getSpanStart(obj);
    text.removeSpan(obj);
    
    if (where != len) {
        Blockquote b = (Blockquote) obj;
        if (b.mIsUnkfunc) {
            if (colors != null) {
                text.setSpan(new ForegroundColorSpan(colors.quoteForeground), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
        } else {
            text.setSpan(new QuoteSpan(), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
}
 
Example #2
Source Project: Knife   Author: mthli   File: KnifeText.java    License: Apache License 2.0 6 votes vote down vote up
protected boolean containQuote(int index) {
    String[] lines = TextUtils.split(getEditableText().toString(), "\n");
    if (index < 0 || index >= lines.length) {
        return false;
    }

    int start = 0;
    for (int i = 0; i < index; i++) {
        start = start + lines[i].length() + 1;
    }

    int end = start + lines[index].length();
    if (start >= end) {
        return false;
    }

    QuoteSpan[] spans = getEditableText().getSpans(start, end, QuoteSpan.class);
    return spans.length > 0;
}
 
Example #3
Source Project: text-decorator   Author: nntuyen   File: TextDecorator.java    License: Apache License 2.0 5 votes vote down vote up
public TextDecorator quote(final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new QuoteSpan(), index, index + text.length(), flags);
    }
  }

  return this;
}
 
Example #4
Source Project: text-decorator   Author: nntuyen   File: TextDecorator.java    License: Apache License 2.0 5 votes vote down vote up
public TextDecorator quote(@ColorRes final int colorResId, final int start, final int end) {
  checkIndexOutOfBoundsException(start, end);
  decoratedContent.setSpan(new QuoteSpan(ContextCompat.getColor(textView.getContext(), colorResId)), start, end,
      flags);

  return this;
}
 
Example #5
Source Project: text-decorator   Author: nntuyen   File: TextDecorator.java    License: Apache License 2.0 5 votes vote down vote up
public TextDecorator quote(@ColorRes final int colorResId, final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new QuoteSpan(ContextCompat.getColor(textView.getContext(), colorResId)), index, index + text.length(), flags);
    }
  }

  return this;
}
 
Example #6
Source Project: Markdown   Author: zzhoujay   File: StyleBuilderImpl.java    License: MIT License 5 votes vote down vote up
@Override
public SpannableStringBuilder quota(CharSequence charSequence) {
    SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(charSequence);
    QuoteSpan span = new MarkDownQuoteSpan(quota_color);
    spannableStringBuilder.setSpan(span, 0, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    spannableStringBuilder.setSpan(new ForegroundColorSpan(quota_text_color), 0, spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannableStringBuilder;
}
 
Example #7
Source Project: kaif-android   Author: kaif-open   File: KmarkProcessorTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testNestSpan_order_as_begin() {
  SpannableStringBuilder result = (SpannableStringBuilder) KmarkProcessor.process(getContext(),
      "> *Sample* text");
  Object[] spans = result.getSpans(0, result.length(), Object.class);
  assertEquals(QuoteSpan.class, spans[0].getClass());
  assertEquals(StyleSpan.class, spans[1].getClass());
}
 
Example #8
Source Project: Trestle   Author: lawloretienne   File: Trestle.java    License: Apache License 2.0 5 votes vote down vote up
private static void setUpQuoteSpan(Span span, SpannableString ss, int start, int end) {
    int quoteColor = span.getQuoteColor();
    if (quoteColor != 0) {
        ss.setSpan(
                new QuoteSpan(quoteColor),
                start,
                end,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}
 
Example #9
Source Project: Knife   Author: mthli   File: KnifeText.java    License: Apache License 2.0 5 votes vote down vote up
protected void quoteInvalid() {
    String[] lines = TextUtils.split(getEditableText().toString(), "\n");

    for (int i = 0; i < lines.length; i++) {
        if (!containQuote(i)) {
            continue;
        }

        int lineStart = 0;
        for (int j = 0; j < i; j++) {
            lineStart = lineStart + lines[j].length() + 1;
        }

        int lineEnd = lineStart + lines[i].length();
        if (lineStart >= lineEnd) {
            continue;
        }

        int quoteStart = 0;
        int quoteEnd = 0;
        if (lineStart <= getSelectionStart() && getSelectionEnd() <= lineEnd) {
            quoteStart = lineStart;
            quoteEnd = lineEnd;
        } else if (getSelectionStart() <= lineStart && lineEnd <= getSelectionEnd()) {
            quoteStart = lineStart;
            quoteEnd = lineEnd;
        }

        if (quoteStart < quoteEnd) {
            QuoteSpan[] spans = getEditableText().getSpans(quoteStart, quoteEnd, QuoteSpan.class);
            for (QuoteSpan span : spans) {
                getEditableText().removeSpan(span);
            }
        }
    }
}
 
Example #10
Source Project: Knife   Author: mthli   File: KnifeParser.java    License: Apache License 2.0 5 votes vote down vote up
private static void withinHtml(StringBuilder out, Spanned text) {
    int next;

    for (int i = 0; i < text.length(); i = next) {
        next = text.nextSpanTransition(i, text.length(), ParagraphStyle.class);

        ParagraphStyle[] styles = text.getSpans(i, next, ParagraphStyle.class);
        if (styles.length == 2) {
            if (styles[0] instanceof BulletSpan && styles[1] instanceof QuoteSpan) {
                // Let a <br> follow the BulletSpan or QuoteSpan end, so next++
                withinBulletThenQuote(out, text, i, next++);
            } else if (styles[0] instanceof QuoteSpan && styles[1] instanceof BulletSpan) {
                withinQuoteThenBullet(out, text, i, next++);
            } else {
                withinContent(out, text, i, next);
            }
        } else if (styles.length == 1) {
            if (styles[0] instanceof BulletSpan) {
                withinBullet(out, text, i, next++);
            } else if (styles[0] instanceof QuoteSpan) {
                withinQuote(out, text, i, next++);
            } else {
                withinContent(out, text, i, next);
            }
        } else {
            withinContent(out, text, i, next);
        }
    }
}
 
Example #11
Source Project: android_9.0.0_r45   Author: lulululbj   File: Html.java    License: Apache License 2.0 4 votes vote down vote up
private static void endBlockquote(Editable text) {
    endBlockElement(text);
    end(text, Blockquote.class, new QuoteSpan());
}
 
Example #12
Source Project: MHViewer   Author: axlecho   File: Html.java    License: Apache License 2.0 4 votes vote down vote up
private void handleEndTag(String tag) {
    if (tag.equalsIgnoreCase("br")) {
        handleBr(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("p")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("div")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("strong")) {
        end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
    } else if (tag.equalsIgnoreCase("b")) {
        end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
    } else if (tag.equalsIgnoreCase("em")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("cite")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("dfn")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("i")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("big")) {
        end(mSpannableStringBuilder, Big.class, new RelativeSizeSpan(1.25f));
    } else if (tag.equalsIgnoreCase("small")) {
        end(mSpannableStringBuilder, Small.class, new RelativeSizeSpan(0.8f));
    } else if (tag.equalsIgnoreCase("font")) {
        endFont(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("blockquote")) {
        handleP(mSpannableStringBuilder);
        end(mSpannableStringBuilder, Blockquote.class, new QuoteSpan());
    } else if (tag.equalsIgnoreCase("tt")) {
        end(mSpannableStringBuilder, Monospace.class,
                new TypefaceSpan("monospace"));
    } else if (tag.equalsIgnoreCase("a")) {
        endA(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("u")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("ins")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("strike")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("s")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("del")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("sup")) {
        end(mSpannableStringBuilder, Super.class, new SuperscriptSpan());
    } else if (tag.equalsIgnoreCase("sub")) {
        end(mSpannableStringBuilder, Sub.class, new SubscriptSpan());
    } else if (tag.length() == 2 &&
            Character.toLowerCase(tag.charAt(0)) == 'h' &&
            tag.charAt(1) >= '1' && tag.charAt(1) <= '6') {
        handleP(mSpannableStringBuilder);
        endHeader(mSpannableStringBuilder);
    } else if (mTagHandler != null) {
        mTagHandler.handleTag(false, tag, mSpannableStringBuilder, mReader);
    }
}
 
Example #13
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node quote(Object... nodes) {
    return new SpanNode(new QuoteSpan(), nodes);
}
 
Example #14
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node quote(@ColorInt Integer color, Object... nodes) {
    return new SpanNode(new QuoteSpan(color), nodes);
}
 
Example #15
Source Project: HtmlCompat   Author: Pixplicity   File: HtmlToSpannedConverter.java    License: Apache License 2.0 4 votes vote down vote up
private void endBlockquote(String tag, Editable text) {
    endBlockElement(tag, text);
    end(tag, text, Blockquote.class, new QuoteSpan());
}
 
Example #16
Source Project: ForPDA   Author: RadiationX   File: Html.java    License: GNU General Public License v3.0 4 votes vote down vote up
private static void endBlockquote(Editable text) {
    endBlockElement(text);
    end(text, Blockquote.class, new QuoteSpan());
}
 
Example #17
Source Project: text-decorator   Author: nntuyen   File: TextDecorator.java    License: Apache License 2.0 4 votes vote down vote up
public TextDecorator quote(final int start, final int end) {
  checkIndexOutOfBoundsException(start, end);
  decoratedContent.setSpan(new QuoteSpan(), start, end, flags);

  return this;
}
 
Example #18
Source Project: memoir   Author: ronak-manglani   File: ConverterHtmlToSpanned.java    License: Apache License 2.0 4 votes vote down vote up
private void handleEndTag(String tag) {
    if (tag.equalsIgnoreCase("br")) {
        handleBr();
    } else if (tag.equalsIgnoreCase("p")) {
        handleP();
    } else if (tag.equalsIgnoreCase("div")) {
        endDiv();
    } else if (tag.equalsIgnoreCase("ul")) {
        endList(false);
    } else if (tag.equalsIgnoreCase("ol")) {
        endList(true);
    } else if (tag.equalsIgnoreCase("li")) {
        endList();
    } else if (tag.equalsIgnoreCase("strong")) {
        end(Bold.class, new BoldSpan());
    } else if (tag.equalsIgnoreCase("b")) {
        end(Bold.class, new BoldSpan());
    } else if (tag.equalsIgnoreCase("em")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("cite")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("dfn")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("i")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("strike")) {
        end(Strikethrough.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("del")) {
        end(Strikethrough.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("big")) {
        end(Big.class, new RelativeSizeSpan(1.25f));
    } else if (tag.equalsIgnoreCase("small")) {
        end(Small.class, new RelativeSizeSpan(0.8f));
    } else if (tag.equalsIgnoreCase("font")) {
        endFont();
    } else if (tag.equalsIgnoreCase("blockquote")) {
        handleP();
        end(Blockquote.class, new QuoteSpan());
    } else if (tag.equalsIgnoreCase("a")) {
        endAHref();
    } else if (tag.equalsIgnoreCase("u")) {
        end(Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("sup")) {
        end(Super.class, new SuperscriptSpan());
    } else if (tag.equalsIgnoreCase("sub")) {
        end(Sub.class, new SubscriptSpan());
    } else if (tag.length() == 2 &&
            Character.toLowerCase(tag.charAt(0)) == 'h' &&
            tag.charAt(1) >= '1' && tag.charAt(1) <= '6') {
        handleP();
        endHeader();
    } else if (sIgnoreTags.contains(tag.toLowerCase(Locale.getDefault()))) {
        mIgnoreContent = false;
    }
}
 
Example #19
Source Project: memoir   Author: ronak-manglani   File: ConverterHtmlToSpanned.java    License: Apache License 2.0 4 votes vote down vote up
private void handleEndTag(String tag) {
    if (tag.equalsIgnoreCase("br")) {
        handleBr();
    } else if (tag.equalsIgnoreCase("p")) {
        handleP();
    } else if (tag.equalsIgnoreCase("div")) {
        endDiv();
    } else if (tag.equalsIgnoreCase("ul")) {
        endList(false);
    } else if (tag.equalsIgnoreCase("ol")) {
        endList(true);
    } else if (tag.equalsIgnoreCase("li")) {
        endList();
    } else if (tag.equalsIgnoreCase("strong")) {
        end(Bold.class, new BoldSpan());
    } else if (tag.equalsIgnoreCase("b")) {
        end(Bold.class, new BoldSpan());
    } else if (tag.equalsIgnoreCase("em")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("cite")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("dfn")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("i")) {
        end(Italic.class, new ItalicSpan());
    } else if (tag.equalsIgnoreCase("strike")) {
        end(Strikethrough.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("del")) {
        end(Strikethrough.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("big")) {
        end(Big.class, new RelativeSizeSpan(1.25f));
    } else if (tag.equalsIgnoreCase("small")) {
        end(Small.class, new RelativeSizeSpan(0.8f));
    } else if (tag.equalsIgnoreCase("font")) {
        endFont();
    } else if (tag.equalsIgnoreCase("blockquote")) {
        handleP();
        end(Blockquote.class, new QuoteSpan());
    } else if (tag.equalsIgnoreCase("a")) {
        endAHref();
    } else if (tag.equalsIgnoreCase("u")) {
        end(Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("sup")) {
        end(Super.class, new SuperscriptSpan());
    } else if (tag.equalsIgnoreCase("sub")) {
        end(Sub.class, new SubscriptSpan());
    } else if (tag.length() == 2 &&
            Character.toLowerCase(tag.charAt(0)) == 'h' &&
            tag.charAt(1) >= '1' && tag.charAt(1) <= '6') {
        handleP();
        endHeader();
    } else if (sIgnoreTags.contains(tag.toLowerCase(Locale.getDefault()))) {
        mIgnoreContent = false;
    }
}
 
Example #20
Source Project: Nimingban   Author: seven332   File: Html.java    License: Apache License 2.0 4 votes vote down vote up
private void handleEndTag(String tag) {
    if (mTagHandler == null || !mTagHandler.handleTag(false, tag,
            mSpannableStringBuilder, mReader, null)) {
        if (tag.equalsIgnoreCase("br")) {
            handleBr(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("p")) {
            handleP(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("div")) {
            handleP(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("strong")) {
            end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
        } else if (tag.equalsIgnoreCase("b")) {
            end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
        } else if (tag.equalsIgnoreCase("em")) {
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
        } else if (tag.equalsIgnoreCase("cite")) {
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
        } else if (tag.equalsIgnoreCase("dfn")) {
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
        } else if (tag.equalsIgnoreCase("i")) {
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
        } else if (tag.equalsIgnoreCase("big")) {
            end(mSpannableStringBuilder, Big.class, new RelativeSizeSpan(1.25f));
        } else if (tag.equalsIgnoreCase("small")) {
            end(mSpannableStringBuilder, Small.class, new RelativeSizeSpan(0.8f));
        } else if (tag.equalsIgnoreCase("font")) {
            endFont(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("blockquote")) {
            handleP(mSpannableStringBuilder);
            end(mSpannableStringBuilder, Blockquote.class, new QuoteSpan());
        } else if (tag.equalsIgnoreCase("tt")) {
            end(mSpannableStringBuilder, Monospace.class,
                    new TypefaceSpan("monospace"));
        } else if (tag.equalsIgnoreCase("a")) {
            endA(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("u")) {
            end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
        } else if (tag.equalsIgnoreCase("ins")) {
            end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
        } else if (tag.equalsIgnoreCase("strike")) {
            end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
        } else if (tag.equalsIgnoreCase("s")) {
            end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
        } else if (tag.equalsIgnoreCase("del")) {
            end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
        } else if (tag.equalsIgnoreCase("sup")) {
            end(mSpannableStringBuilder, Super.class, new SuperscriptSpan());
        } else if (tag.equalsIgnoreCase("sub")) {
            end(mSpannableStringBuilder, Sub.class, new SubscriptSpan());
        } else if (tag.length() == 2 &&
                Character.toLowerCase(tag.charAt(0)) == 'h' &&
                tag.charAt(1) >= '1' && tag.charAt(1) <= '6') {
            handleP(mSpannableStringBuilder);
            endHeader(mSpannableStringBuilder);
        }
    }
}
 
Example #21
Source Project: kaif-android   Author: kaif-open   File: DefaultDecorator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void closeBlockquote(SpannableStringBuilder out) {
  end(out, Blockquote.class, new QuoteSpan());
}
 
Example #22
Source Project: AndroidSpan   Author: xujinyang   File: SpanOptions.java    License: Apache License 2.0 4 votes vote down vote up
public SpanOptions addQuoteSpan(int color) {
    QuoteSpan span = new QuoteSpan(color);
    listSpan.add(span);
    return this;
}
 
Example #23
Source Project: EhViewer   Author: seven332   File: Html.java    License: Apache License 2.0 4 votes vote down vote up
private void handleEndTag(String tag) {
    if (tag.equalsIgnoreCase("br")) {
        handleBr(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("p")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("div")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("strong")) {
        end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
    } else if (tag.equalsIgnoreCase("b")) {
        end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
    } else if (tag.equalsIgnoreCase("em")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("cite")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("dfn")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("i")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } else if (tag.equalsIgnoreCase("big")) {
        end(mSpannableStringBuilder, Big.class, new RelativeSizeSpan(1.25f));
    } else if (tag.equalsIgnoreCase("small")) {
        end(mSpannableStringBuilder, Small.class, new RelativeSizeSpan(0.8f));
    } else if (tag.equalsIgnoreCase("font")) {
        endFont(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("blockquote")) {
        handleP(mSpannableStringBuilder);
        end(mSpannableStringBuilder, Blockquote.class, new QuoteSpan());
    } else if (tag.equalsIgnoreCase("tt")) {
        end(mSpannableStringBuilder, Monospace.class,
                new TypefaceSpan("monospace"));
    } else if (tag.equalsIgnoreCase("a")) {
        endA(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("u")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("ins")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } else if (tag.equalsIgnoreCase("strike")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("s")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("del")) {
        end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
    } else if (tag.equalsIgnoreCase("sup")) {
        end(mSpannableStringBuilder, Super.class, new SuperscriptSpan());
    } else if (tag.equalsIgnoreCase("sub")) {
        end(mSpannableStringBuilder, Sub.class, new SubscriptSpan());
    } else if (tag.length() == 2 &&
            Character.toLowerCase(tag.charAt(0)) == 'h' &&
            tag.charAt(1) >= '1' && tag.charAt(1) <= '6') {
        handleP(mSpannableStringBuilder);
        endHeader(mSpannableStringBuilder);
    } else if (mTagHandler != null) {
        mTagHandler.handleTag(false, tag, mSpannableStringBuilder, mReader);
    }
}
 
Example #24
Source Project: Mupdf   Author: archko   File: AKHtml.java    License: Apache License 2.0 4 votes vote down vote up
private static void endBlockquote(Editable text) {
    endBlockElement(text);
    end(text, Blockquote.class, new QuoteSpan());
}
 
Example #25
Source Project: AndroidSpan   Author: xujinyang   File: AndroidSpan.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 左侧添加一条表示引用的竖线
 *
 * @param text
 * @param color
 * @return
 */
public AndroidSpan drawQuoteSpan(String text, int color) {
    QuoteSpan span = new QuoteSpan(color);
    drawSpan(text, span);
    return this;
}