• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ImageLoadingSpan类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中in.uncod.android.bypass.style.ImageLoadingSpan的典型用法代码示例。如果您正苦于以下问题:Java ImageLoadingSpan类的具体用法?Java ImageLoadingSpan怎么用?Java ImageLoadingSpan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ImageLoadingSpan类属于in.uncod.android.bypass.style包,在下文中一共展示了ImageLoadingSpan类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: bindComment

点赞 2

import in.uncod.android.bypass.style.ImageLoadingSpan; //导入依赖的package包/类
private void bindComment(final CommentHolder holder, List<Object> partialChanges) {
    // Check if this is a partial update for expanding/collapsing a comment. If it is we
    // can do a partial bind as the bound data has not changed.
    if (partialChanges == null || partialChanges.isEmpty() ||
            !(partialChanges.contains(CommentAnimator.COLLAPSE_COMMENT)
                || partialChanges.contains(CommentAnimator.EXPAND_COMMENT))) {

        final Comment comment = getComment(holder.getAdapterPosition());
        HtmlUtils.parseMarkdownAndSetText(holder.comment, comment.body, markdown,
                new Bypass.LoadImageCallback() {
            @Override
            public void loadImage(String src, ImageLoadingSpan loadingSpan) {
                Glide.with(DesignerNewsStory.this)
                        .load(src)
                        .asBitmap()
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .into(new ImageSpanTarget(holder.comment, loadingSpan));
            }
        });
        holder.author.setText(comment.user_display_name.toLowerCase());
        holder.author.setOriginalPoster(isOP(comment.user_id));
        if (comment.created_at != null) {
            holder.timeAgo.setText(
                    DateUtils.getRelativeTimeSpanString(comment.created_at.getTime(),
                            System.currentTimeMillis(),
                            DateUtils.SECOND_IN_MILLIS)
                            .toString().toLowerCase());
        }
        // FIXME updating drawable doesn't seem to be working, just create a new one
        //((ThreadedCommentDrawable) holder.threadDepth.getDrawable())
        //     .setDepth(comment.depth);

        holder.threadDepth.setImageDrawable(
                new ThreadedCommentDrawable(threadWidth, threadGap, comment.depth));
    }

    // set/clear expanded comment state
    holder.itemView.setActivated(holder.getAdapterPosition() == expandedCommentPosition);
    if (holder.getAdapterPosition() == expandedCommentPosition) {
        final int threadDepthWidth = holder.threadDepth.getDrawable().getIntrinsicWidth();
        final float leftShift = -(threadDepthWidth + ((ViewGroup.MarginLayoutParams)
                holder.threadDepth.getLayoutParams()).getMarginEnd());
        holder.author.setTranslationX(leftShift);
        holder.comment.setTranslationX(leftShift);
        holder.threadDepth.setTranslationX(-(threadDepthWidth
                + ((ViewGroup.MarginLayoutParams)
                holder.threadDepth.getLayoutParams()).getMarginStart()));
    } else {
        holder.threadDepth.setTranslationX(0f);
        holder.author.setTranslationX(0f);
        holder.comment.setTranslationX(0f);
    }
}
 

开发者ID:liulinbo,
项目名称:Amumu,
代码行数:54,
代码来源:DesignerNewsStory.java

示例2: ImageSpanTarget

点赞 2

import in.uncod.android.bypass.style.ImageLoadingSpan; //导入依赖的package包/类
public ImageSpanTarget(TextView textView, ImageLoadingSpan loadingSpan) {
    this.textView = new WeakReference<>(textView);
    this.loadingSpan = loadingSpan;
}
 

开发者ID:liulinbo,
项目名称:Amumu,
代码行数:5,
代码来源:ImageSpanTarget.java

示例3: bindComment

点赞 2

import in.uncod.android.bypass.style.ImageLoadingSpan; //导入依赖的package包/类
private void bindComment(final CommentHolder holder, List<Object> partialChanges) {
    // Check if this is a partial update for expanding/collapsing a comment. If it is we
    // can do a partial bind as the bound data has not changed.
    if (partialChanges == null || partialChanges.isEmpty() ||
            !(partialChanges.contains(CommentAnimator.COLLAPSE_COMMENT)
                || partialChanges.contains(CommentAnimator.EXPAND_COMMENT))) {

        final Comment comment = getComment(holder.getAdapterPosition());
        HtmlUtils.parseMarkdownAndSetText(holder.comment, comment.body, markdown,
                new Bypass.LoadImageCallback() {
            @Override
            public void loadImage(String src, ImageLoadingSpan loadingSpan) {
                Glide.with(DesignerNewsStory.this)
                        .load(src)
                        .asBitmap()
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .into(new ImageSpanTarget(holder.comment, loadingSpan));
            }
        });
        if (comment.user_display_name != null) {
            holder.author.setText(comment.user_display_name.toLowerCase());
        }
        holder.author.setOriginalPoster(isOP(comment.user_id));
        if (comment.created_at != null) {
            holder.timeAgo.setText(
                    DateUtils.getRelativeTimeSpanString(comment.created_at.getTime(),
                            System.currentTimeMillis(),
                            DateUtils.SECOND_IN_MILLIS)
                            .toString().toLowerCase());
        }
        // FIXME updating drawable doesn't seem to be working, just create a new one
        //((ThreadedCommentDrawable) holder.threadDepth.getDrawable())
        //     .setDepth(comment.depth);

        holder.threadDepth.setImageDrawable(
                new ThreadedCommentDrawable(threadWidth, threadGap, comment.depth));
    }

    // set/clear expanded comment state
    holder.itemView.setActivated(holder.getAdapterPosition() == expandedCommentPosition);
    if (holder.getAdapterPosition() == expandedCommentPosition) {
        final int threadDepthWidth = holder.threadDepth.getDrawable().getIntrinsicWidth();
        final float leftShift = -(threadDepthWidth + ((ViewGroup.MarginLayoutParams)
                holder.threadDepth.getLayoutParams()).getMarginEnd());
        holder.author.setTranslationX(leftShift);
        holder.comment.setTranslationX(leftShift);
        holder.threadDepth.setTranslationX(-(threadDepthWidth
                + ((ViewGroup.MarginLayoutParams)
                holder.threadDepth.getLayoutParams()).getMarginStart()));
    } else {
        holder.threadDepth.setTranslationX(0f);
        holder.author.setTranslationX(0f);
        holder.comment.setTranslationX(0f);
    }
}
 

开发者ID:yongjhih,
项目名称:android-proguards,
代码行数:56,
代码来源:DesignerNewsStory.java

示例4: loadImage

点赞 1

import in.uncod.android.bypass.style.ImageLoadingSpan; //导入依赖的package包/类
/**
 * A callback to load an image found in a markdown document.
 *
 * @param src         The source (url) of the image.
 * @param loadingSpan A placeholder span making where the image should be inserted.
 */
void loadImage(String src, ImageLoadingSpan loadingSpan);
 

开发者ID:goodev,
项目名称:materialup,
代码行数:8,
代码来源:Bypass.java

示例5: loadImage

点赞 1

import in.uncod.android.bypass.style.ImageLoadingSpan; //导入依赖的package包/类
/**
 * A callback to load an image found in a markdown document.
 * @param src The source (url) of the image.
 * @param loadingSpan A placeholder span making where the image should be inserted.
 */
void loadImage(String src, ImageLoadingSpan loadingSpan);
 

开发者ID:liulinbo,
项目名称:Amumu,
代码行数:7,
代码来源:Bypass.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)