本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}