android.text.Html.ImageGetter Java Examples

The following examples show how to use android.text.Html.ImageGetter. 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 File: PostItemView.java    From ChipHellClient with Apache License 2.0 6 votes vote down vote up
public void bindValue(Post post) {
    ImageLoader.getInstance().displayImage(post.getAvatarUrl(), imageViewAvatar, Constants.avatarDisplayOption, animateFirstListener);
    textViewAuthi.setText(Html.fromHtml(post.getAuthi()));
    String content = post.getContent();
    if (post.getImgList() != null) {
        content += post.getImgList();
    }
    textViewContent.setText(Html.fromHtml(content, new ImageGetter() {

        @Override
        public Drawable getDrawable(String source) {
            if (!source.startsWith("http:")) {
                source = Constants.BASE_URL + source;
            }
            LogMessage.i("PostItemView", source);
            return new UrlDrawable(source, textViewContent);
        }
    }, null));
}
 
Example #2
Source File: HtmlFormatter.java    From html-textview with Apache License 2.0 6 votes vote down vote up
public static Spanned formatHtml(@Nullable String html, ImageGetter imageGetter, ClickableTableSpan clickableTableSpan, DrawTableLinkSpan drawTableLinkSpan, OnClickATagListener onClickATagListener, float indent, boolean removeTrailingWhiteSpace) {
    final HtmlTagHandler htmlTagHandler = new HtmlTagHandler();
    htmlTagHandler.setClickableTableSpan(clickableTableSpan);
    htmlTagHandler.setDrawTableLinkSpan(drawTableLinkSpan);
    htmlTagHandler.setOnClickATagListener(onClickATagListener);
    htmlTagHandler.setListIndentPx(indent);

    html = htmlTagHandler.overrideTags(html);

    Spanned formattedHtml;
    if (removeTrailingWhiteSpace) {
        formattedHtml = removeHtmlBottomPadding(Html.fromHtml(html, imageGetter, new WrapperContentHandler(htmlTagHandler)));
    } else {
        formattedHtml = Html.fromHtml(html, imageGetter, new WrapperContentHandler(htmlTagHandler));
    }

    return formattedHtml;
}
 
Example #3
Source File: Utils.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
/**
 * bind HtmlTextView value
 * 
 * @param text
 * @param fieldValue
 * @param cImageGetter
 */
public static void bindHtmlTextView(TextView text, String fieldValue, ImageGetter cImageGetter) {
    if (!TextUtils.isEmpty(fieldValue)) {
        text.setText(Html.fromHtml(fieldValue, cImageGetter, null));
    } else {
        text.setVisibility(View.GONE);
    }
}
 
Example #4
Source File: HtmlFormatterBuilder.java    From html-textview with Apache License 2.0 4 votes vote down vote up
public ImageGetter getImageGetter() {
    return imageGetter;
}
 
Example #5
Source File: HtmlFormatterBuilder.java    From html-textview with Apache License 2.0 4 votes vote down vote up
public HtmlFormatterBuilder setImageGetter(@Nullable final ImageGetter imageGetter) {
    this.imageGetter = imageGetter;
    return this;
}