Java 类android.text.style.QuoteSpan 实例源码

项目:Slide-RSS    文件:SpoilerRobotoTextView.java   
/**
 * Replaces the blue line produced by <blockquote>s with something more visible
 *
 * @param spannable parsed comment text #fromHtml
 */
private void replaceQuoteSpans(Spannable spannable) {
    QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);

    for (QuoteSpan quoteSpan : quoteSpans) {
        final int start = spannable.getSpanStart(quoteSpan);
        final int end = spannable.getSpanEnd(quoteSpan);
        final int flags = spannable.getSpanFlags(quoteSpan);

        spannable.removeSpan(quoteSpan);

        //If the theme is Light or Sepia, use a darker blue; otherwise, use a lighter blue
        final int barColor =
                (SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5)
                        ? ContextCompat.getColor(getContext(), R.color.md_blue_600)
                        : ContextCompat.getColor(getContext(), R.color.md_blue_400);

        final int BAR_WIDTH = 4;
        final int GAP = 5;

        spannable.setSpan(new CustomQuoteSpan(Color.TRANSPARENT, //background color
                        barColor, //bar color
                        BAR_WIDTH, //bar width
                        GAP), //bar + text gap
                start, end, flags);
    }
}
项目:ScribaNotesApp    文件:Html.java   
private void handleEndTag(String tag) {
    if (tag.equalsIgnoreCase("br")) {
        handleBr(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("p")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("b")) {
        end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
    } else if (tag.equalsIgnoreCase("i")) {
        end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
    } 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("u")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } else if (mTagHandler != null) {
        mTagHandler.handleTag(false, tag, mSpannableStringBuilder, mReader);
    }
}
项目:wordpress_app_android    文件:HtmlUtils.java   
/**
 * an alternative to Html.fromHtml() supporting <ul>, <ol>, <blockquote> tags and replacing EmoticonsUtils with Emojis
 */
public static SpannableStringBuilder fromHtml(String source, WPImageGetter wpImageGetter) {
    SpannableStringBuilder html;
    try {
        html = (SpannableStringBuilder) Html.fromHtml(source, wpImageGetter, new WPHtmlTagHandler());
    } catch (RuntimeException runtimeException) {
        // In case our tag handler fails
        html = (SpannableStringBuilder) Html.fromHtml(source, wpImageGetter, null);
    }
    EmoticonsUtils.replaceEmoticonsWithEmoji(html);
    QuoteSpan spans[] = html.getSpans(0, html.length(), QuoteSpan.class);
    for (QuoteSpan span : spans) {
        html.setSpan(new WPQuoteSpan(), html.getSpanStart(span), html.getSpanEnd(span), html.getSpanFlags(span));
        html.setSpan(new ForegroundColorSpan(0xFF666666), html.getSpanStart(span), html.getSpanEnd(span),
                html.getSpanFlags(span));
        html.removeSpan(span);
    }
    return html;
}
项目:Overchan-Android    文件:HtmlParser.java   
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);
        }
    }
}
项目:Knife    文件:KnifeText.java   
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;
}
项目:text-decorator    文件:TextDecorator.java   
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;
}
项目:text-decorator    文件:TextDecorator.java   
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;
}
项目:text-decorator    文件:TextDecorator.java   
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;
}
项目:markdown-to-spanned    文件:SpanTests.java   
@Test
public void testBlockQuote() throws Exception {
    String content = "> blockquote\n" +
            "still blockquote";
    Spanned result = Markdown.fromMarkdown(content);
    printSpans(result);
    Object[] spans = result.getSpans(0, result.length(), Object.class);
    assertEquals(1, spans.length);
    assertEquals(QuoteSpan.class, spans[0].getClass());
}
项目:Markdown    文件:StyleBuilderImpl.java   
@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;
}
项目:wATLlib    文件:SpannedSerializator.java   
private void writeSingleParagraphStyle(ParagraphStyle style, DataOutputStream dos) throws IOException {
    Class clazz = style.getClass();
    dos.writeInt(mString.getSpanStart(style));
    dos.writeInt(mString.getSpanEnd(style));
    dos.writeInt(mString.getSpanFlags(style));
    if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
        int tag = mCharacterStylesTags.get(clazz.getSimpleName());
        if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
            dos.writeInt(tag);
        }
        switch (tag) {
            case 24: // AligmentSpan.Standard
                AlignmentSpan.Standard as2 = (AlignmentSpan.Standard)style;
                dos.writeInt(as2.getAlignment().ordinal());
                break;
            case 25: // BulletSpan
                BulletSpan bs = (BulletSpan)style;
                dos.writeInt(bs.getLeadingMargin(true));
                dos.writeInt(bs.getLeadingMargin(false));

                break;
            case 30: // LeadingMarginSpan.Sandard
                LeadingMarginSpan.Standard lms = (LeadingMarginSpan.Standard)style;
                dos.writeInt(lms.getLeadingMargin(true));
                dos.writeInt(lms.getLeadingMargin(false));
                break;
            case 34: // QuoteSpan
                QuoteSpan qs = (QuoteSpan)style;
                dos.writeInt(qs.getColor());
                break;
            case 36: // TabStopSpan.Standard
                TabStopSpan.Standard tss = (TabStopSpan.Standard)style;
                dos.writeInt(tss.getTabStop());
                break;
            default:
        }
    } else {
        write(style,dos);
    }
}
项目:wATLlib    文件:SpannedSerializator.java   
private SpanPlacementInfo readSingleParagraph(DataInputStream dis) throws IOException {
    SpanPlacementInfo spi = new SpanPlacementInfo();
    spi.start = dis.readInt();
    spi.end = dis.readInt();
    spi.mode = dis.readInt();
    int tag = dis.readInt(); // mCharacterStylesTags.get(clazz.getSimpleName());
    switch (tag) {
        case 24: // AligmentSpan.Standard
            spi.span = new AlignmentSpan.Standard(Alignment.values()[dis.readInt()]);
            break;
        case 25: // BulletSpan
            spi.span = new BulletSpan(dis.readInt());
            dis.readInt(); // skip gap width for other lines
            break;
        case 30: // LeadingMarginSpan.Sandard
            spi.span = new LeadingMarginSpan.Standard(dis.readInt(),dis.readInt());
            break;
        case 34: // QuoteSpan
            spi.span = new QuoteSpan(dis.readInt());
            break;
        case 36: // TabStopSpan.Standard
            spi.span = new TabStopSpan.Standard(dis.readInt());
            break;
        case 80: // RemoteDrawableSpan
            break;
        default:
            spi.span = read(tag,dis);
    }
    return spi;
}
项目:wordpress_app_android    文件:LegacyEditorFragment.java   
@Override
public void onSelectionChanged() {
    if (!mIsLocalDraft) {
        return;
    }

    final Spannable s = mContentEditText.getText();
    if (s == null)
        return;
    // set toggle buttons if cursor is inside of a matching span
    mStyleStart = mContentEditText.getSelectionStart();
    Object[] spans = s.getSpans(mContentEditText.getSelectionStart(), mContentEditText.getSelectionStart(), Object.class);

    mBoldToggleButton.setChecked(false);
    mEmToggleButton.setChecked(false);
    mBquoteToggleButton.setChecked(false);
    mUnderlineToggleButton.setChecked(false);
    mStrikeToggleButton.setChecked(false);
    for (Object span : spans) {
        if (span instanceof StyleSpan) {
            StyleSpan ss = (StyleSpan) span;
            if (ss.getStyle() == android.graphics.Typeface.BOLD) {
                mBoldToggleButton.setChecked(true);
            }
            if (ss.getStyle() == android.graphics.Typeface.ITALIC) {
                mEmToggleButton.setChecked(true);
            }
        }
        if (span instanceof QuoteSpan) {
            mBquoteToggleButton.setChecked(true);
        }
        if (span instanceof WPUnderlineSpan) {
            mUnderlineToggleButton.setChecked(true);
        }
        if (span instanceof StrikethroughSpan) {
            mStrikeToggleButton.setChecked(true);
        }
    }
}
项目:kaif-android    文件:KmarkProcessorTest.java   
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());
}
项目:Trestle    文件:Trestle.java   
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);
    }
}
项目:Knife    文件:KnifeText.java   
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);
            }
        }
    }
}
项目:Knife    文件:KnifeParser.java   
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);
        }
    }
}
项目:Poem    文件:PoemFormater.java   
@Nullable
    public static CharSequence formatComment(String comment, int color){
        if (TextUtils.isEmpty(comment)){
            return null;
        }
        SpannableString spannableString = new SpannableString(comment);
//        final int color = getActivity().getResources().getColor(R.color.primary);
        final QuoteSpan quoteSpan = new CommentQuoteSpan(color);
        spannableString.setSpan(quoteSpan, 0, comment.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
        return spannableString;
    }
项目:Slide    文件:SpoilerRobotoTextView.java   
/**
 * Replaces the blue line produced by <blockquote>s with something more visible
 *
 * @param spannable parsed comment text #fromHtml
 */
private void replaceQuoteSpans(Spannable spannable) {
    QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);

    for (QuoteSpan quoteSpan : quoteSpans) {
        final int start = spannable.getSpanStart(quoteSpan);
        final int end = spannable.getSpanEnd(quoteSpan);
        final int flags = spannable.getSpanFlags(quoteSpan);

        spannable.removeSpan(quoteSpan);

        //If the theme is Light or Sepia, use a darker blue; otherwise, use a lighter blue
        final int barColor =
                (SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5)
                        ? ContextCompat.getColor(getContext(), R.color.md_blue_600)
                        : ContextCompat.getColor(getContext(), R.color.md_blue_400);

        final int BAR_WIDTH = 4;
        final int GAP = 5;

        spannable.setSpan(new CustomQuoteSpan(Color.TRANSPARENT, //background color
                        barColor, //bar color
                        BAR_WIDTH, //bar width
                        GAP), //bar + text gap
                start, end, flags);
    }
}
项目:Android-Spans    文件:Span.java   
public static Node quote(Object... nodes) {
    return new SpanNode(new QuoteSpan(), nodes);
}
项目:Android-Spans    文件:Span.java   
public static Node quote(@ColorInt Integer color, Object... nodes) {
    return new SpanNode(new QuoteSpan(color), nodes);
}
项目:HtmlCompat    文件:HtmlToSpannedConverter.java   
private void endBlockquote(String tag, Editable text) {
    endBlockElement(tag, text);
    end(tag, text, Blockquote.class, new QuoteSpan());
}
项目:ForPDA    文件:Html.java   
private static void endBlockquote(Editable text) {
    endBlockElement(text);
    end(text, Blockquote.class, new QuoteSpan());
}
项目:text-decorator    文件:TextDecorator.java   
public TextDecorator quote(final int start, final int end) {
  checkIndexOutOfBoundsException(start, end);
  decoratedContent.setSpan(new QuoteSpan(), start, end, flags);

  return this;
}
项目:memoir    文件:ConverterHtmlToSpanned.java   
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;
    }
}
项目:memoir    文件:ConverterHtmlToSpanned.java   
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;
    }
}
项目:RichEditText    文件:HtmlToSpannedConverter.java   
private void handleEndTag(String tag)
{
    switch (tag.toLowerCase()) {
        case "br":
            handleBr(mSpannableStringBuilder);
            break;
        case "p":
        case "div":
            handleP(mSpannableStringBuilder);
            break;
        case "strong":
        case "b":
            end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD));
            break;
        case "em":
        case "cite":
        case "dfn":
        case "i":
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC));
            break;
        case "font":
            endFont(mSpannableStringBuilder);
            break;
        case "blockquote":
            handleP(mSpannableStringBuilder);
            end(mSpannableStringBuilder, Blockquote.class, new QuoteSpan());
            break;
        case "li":
            handleP(mSpannableStringBuilder);
            end(mSpannableStringBuilder, Li.class, new RichBulletSpan());
            break;
        case "a":
            endA(mSpannableStringBuilder);
            break;
        case "u":
            end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
            break;
        case "strike":
            end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan());
        default:
            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);
            }
    }

}
项目:AyoSunny    文件:HtmlTagHandler.java   
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("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, null);
    }
}
项目:AyoSunny    文件:HtmlHandler.java   
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("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, null);
    }
}
项目:Doctor    文件:ConverterHtmlToSpanned.java   
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;
    }
}
项目:Nimingban    文件:Html.java   
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);
        }
    }
}
项目:wordpress_app_android    文件:LegacyEditorFragment.java   
@Override
public void afterTextChanged(Editable s) {
    int position = Selection.getSelectionStart(mContentEditText.getText());
    if ((mIsBackspace && position != 1) || mLastPosition == position || !mIsLocalDraft)
        return;

    if (position < 0) {
        position = 0;
    }
    mLastPosition = position;
    if (position > 0) {
        if (mStyleStart > position) {
            mStyleStart = position - 1;
        }

        boolean shouldBold = mBoldToggleButton.isChecked();
        boolean shouldEm = mEmToggleButton.isChecked();
        boolean shouldUnderline = mUnderlineToggleButton.isChecked();
        boolean shouldStrike = mStrikeToggleButton.isChecked();
        boolean shouldQuote = mBquoteToggleButton.isChecked();

        Object[] allSpans = s.getSpans(mStyleStart, position, Object.class);
        for (Object span : allSpans) {
            if (span instanceof StyleSpan) {
                StyleSpan styleSpan = (StyleSpan) span;
                if (styleSpan.getStyle() == Typeface.BOLD)
                    shouldBold = false;
                else if (styleSpan.getStyle() == Typeface.ITALIC)
                    shouldEm = false;
            } else if (span instanceof WPUnderlineSpan) {
                shouldUnderline = false;
            } else if (span instanceof StrikethroughSpan) {
                shouldStrike = false;
            } else if (span instanceof QuoteSpan) {
                shouldQuote = false;
            }
        }

        if (shouldBold)
            s.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), mStyleStart, position, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        if (shouldEm)
            s.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), mStyleStart, position, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        if (shouldUnderline)
            s.setSpan(new WPUnderlineSpan(), mStyleStart, position, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        if (shouldStrike)
            s.setSpan(new StrikethroughSpan(), mStyleStart, position, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        if (shouldQuote)
            s.setSpan(new QuoteSpan(), mStyleStart, position, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
    }
}
项目:wordpress_app_android    文件:WPHtml.java   
private void handleEndTag(String tag) {
    if (post != null) {
        if (!post.isLocalDraft())
            return;
    }
    if (!mysteryTagFound) {
        if (tag.equalsIgnoreCase("br")) {
            handleBr(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("p")) {
            handleP(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("div")) {
            handleP(mSpannableStringBuilder);
        } else if (tag.equalsIgnoreCase("em")) {
            end(mSpannableStringBuilder, Italic.class, new StyleSpan(
                    Typeface.ITALIC));
        } else if (tag.equalsIgnoreCase("b")) {
            end(mSpannableStringBuilder, Bold.class, new StyleSpan(
                    Typeface.BOLD));
        } else if (tag.equalsIgnoreCase("strong")) {
            end(mSpannableStringBuilder, Bold.class, new StyleSpan(
                    Typeface.BOLD));
        } 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 WPUnderlineSpan());
        } 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.equalsIgnoreCase("strike")) {
            end(mSpannableStringBuilder, Strike.class,
                    new StrikethroughSpan());
        } 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 (tag.equalsIgnoreCase("html") || tag.equalsIgnoreCase("body")) {
            return;
        }

        if (mysteryTagName.equals(tag)) {
            mysteryTagFound = false;
            mSpannableStringBuilder.append(mysteryTagContent);
        }
        // mTagHandler.handleTag(false, tag, mSpannableStringBuilder,
        // mReader,
        // mysteryTagContent);
    }
}
项目:kaif-android    文件:DefaultDecorator.java   
@Override
public void closeBlockquote(SpannableStringBuilder out) {
  end(out, Blockquote.class, new QuoteSpan());
}
项目:android-customfonthtml    文件:CustomHtml.java   
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("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);
    }
}
项目:v2ex-android    文件:Html.java   
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, mImageGetter);
    } else if (tag.equalsIgnoreCase("u")) {
        end(mSpannableStringBuilder, Underline.class, new UnderlineSpan());
    } 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 (tag.equalsIgnoreCase("script")) {
        endScript(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("iframe")) {
        endIframe(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("button")) {
        endButton(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("code")) {
        end(mSpannableStringBuilder, Code.class, new BackgroundColorSpan(0xFFEEEEEE));
    } else if (tag.equalsIgnoreCase("pre")) {
        mInPreTag = false;
        end(mSpannableStringBuilder, Pre.class, new BackgroundColorSpan(0xFFEEEEEE));
    } else if (tag.equalsIgnoreCase("li")) {
        mSpannableStringBuilder.append('\n');
    }
}
项目:love    文件:Html.java   
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")) {
        endEm(mSpannableStringBuilder);
    } 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("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);
    }
}
项目:FanFictionReader    文件:HtmlParser.java   
/***
 * Handles the tailing tag of every element
 *
 * @param element
 */
private void handleEndTag(Element element) {
    final Attributes attributes = element.attributes();
    if (attributes.hasKey("style"))
        handleCssEnd(attributes.get("style"));

    final String tag = element.tagName();
    switch (tag.toLowerCase()) {
        case "p":
        case "div":
            handleP();
            break;
        case "b":
        case "strong":
            endSpan(new StyleSpan(Typeface.BOLD));
            break;
        case "em":
        case "cite":
        case "dfn":
        case "i":
            endSpan(new StyleSpan(Typeface.ITALIC));
            break;
        case "big":
            endSpan(new RelativeSizeSpan(1.25f));
            break;
        case "small":
            endSpan(new RelativeSizeSpan(0.8f));
            break;
        case "blockquote":
            endSpan(new QuoteSpan());
            handleP();
            break;
        case "tt":
            endSpan(new TypefaceSpan("monospace"));
            break;
        case "u":
            endSpan(new UnderlineSpan());
            break;
        case "sub":
            endSpan(new SubscriptSpan());
            break;
        case "sup":
            endSpan(new SuperscriptSpan());
            break;
        case "a":
            handleLink(element.absUrl("href"));
    }
}
项目:AndroidSpan    文件:SpanOptions.java   
public SpanOptions addQuoteSpan(int color) {
    QuoteSpan span = new QuoteSpan(color);
    listSpan.add(span);
    return this;
}
项目:trezor-android    文件:Html.java   
protected void handleEndTag(String tag) {
    if (mTagHandler != null && mTagHandler.handleEndTag(tag, mSpannableStringBuilder, mReader)) {
        // 
    }
    else if (tag.equalsIgnoreCase("br")) {
        handleBr(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("p")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("div")) {
        handleP(mSpannableStringBuilder);
    } else if (tag.equalsIgnoreCase("em")) {
        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("strong")) {
        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("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);
    } 
}