当前位置: 首页>>代码示例>>Java>>正文


Java ThreadedCommentDrawable类代码示例

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


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

示例1: createCommentHolder

import io.plaidapp.ui.drawable.ThreadedCommentDrawable; //导入依赖的package包/类
@NonNull
private CommentHolder createCommentHolder(ViewGroup parent) {
    final CommentHolder holder = new CommentHolder(
            getLayoutInflater().inflate(R.layout.designer_news_comment, parent, false));
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final boolean collapsingSelf =
                    expandedCommentPosition == holder.getAdapterPosition();
            collapseExpandedComment();
            if (collapsingSelf) return;

            // show reply below this
            expandedCommentPosition = holder.getAdapterPosition();
            notifyItemInserted(expandedCommentPosition + 1);
            notifyItemChanged(expandedCommentPosition, CommentAnimator.EXPAND_COMMENT);
        }
    });
    holder.threadDepth.setImageDrawable(
            new ThreadedCommentDrawable(threadWidth, threadGap));

    return holder;
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:24,代码来源:DesignerNewsStory.java

示例2: createCommentHolder

import io.plaidapp.ui.drawable.ThreadedCommentDrawable; //导入依赖的package包/类
@NonNull
private CommentHolder createCommentHolder(ViewGroup parent) {
    final CommentHolder holder = new CommentHolder(
            getLayoutInflater().inflate(R.layout.designer_news_comment, parent, false));
    holder.itemView.setOnClickListener(v -> {
        final boolean collapsingSelf =
                expandedCommentPosition == holder.getAdapterPosition();
        collapseExpandedComment();
        if (collapsingSelf) return;

        // show reply below this
        expandedCommentPosition = holder.getAdapterPosition();
        notifyItemInserted(expandedCommentPosition + 1);
        notifyItemChanged(expandedCommentPosition, CommentAnimator.EXPAND_COMMENT);
    });
    holder.threadDepth.setImageDrawable(
            new ThreadedCommentDrawable(threadWidth, threadGap));

    return holder;
}
 
开发者ID:nickbutcher,项目名称:plaid,代码行数:21,代码来源:DesignerNewsStory.java

示例3: bindComment

import io.plaidapp.ui.drawable.ThreadedCommentDrawable; //导入依赖的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

示例4: bindComment

import io.plaidapp.ui.drawable.ThreadedCommentDrawable; //导入依赖的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

示例5: bindComment

import io.plaidapp.ui.drawable.ThreadedCommentDrawable; //导入依赖的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,
                (src, loadingSpan) -> GlideApp.with(DesignerNewsStory.this)
                        .asBitmap()
                        .load(src)
                        .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:nickbutcher,项目名称:plaid,代码行数:51,代码来源:DesignerNewsStory.java


注:本文中的io.plaidapp.ui.drawable.ThreadedCommentDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。