use of com.odysee.app.adapter.CommentItemDecoration in project odysee-android by OdyseeTeam.
the class FileViewFragment method ensureCommentListAdapterCreated.
private void ensureCommentListAdapterCreated(final List<Comment> comments) {
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (commentListAdapter == null) {
final Context androidContext = getContext();
final View root = getView();
commentListAdapter = new CommentListAdapter(comments, getContext(), actualClaim, new CommentListAdapter.CommentListListener() {
@Override
public void onListChanged() {
checkNoComments();
}
@Override
public void onCommentReactClicked(Comment c, boolean liked) {
react(c, liked);
}
@Override
public void onReplyClicked(Comment comment) {
setReplyToComment(comment);
}
});
commentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim, int position) {
if (!Helper.isNullOrEmpty(claim.getName()) && claim.getName().startsWith("@") && androidContext instanceof MainActivity) {
removeNotificationAsSource();
((MainActivity) androidContext).openChannelClaim(claim);
}
}
});
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
// Indent reply-type items
int marginInPx = Math.round(40 * ((float) androidContext.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT));
commentsList.addItemDecoration(new CommentItemDecoration(marginInPx));
commentsList.setAdapter(commentListAdapter);
commentListAdapter.notifyItemRangeInserted(0, comments.size());
scrollToCommentHash();
checkNoComments();
resolveCommentPosters();
}
}
use of com.odysee.app.adapter.CommentItemDecoration in project odysee-android by OdyseeTeam.
the class ChannelCommentsFragment method ensureCommentListAdapterCreated.
private void ensureCommentListAdapterCreated(final List<Comment> comments) {
if (commentListAdapter == null) {
Context ctx = getContext();
View root = getView();
commentListAdapter = new CommentListAdapter(comments, ctx, claim, new CommentListAdapter.CommentListListener() {
@Override
public void onListChanged() {
checkNoComments();
}
@Override
public void onCommentReactClicked(Comment c, boolean liked) {
// Not used for now.
}
@Override
public void onReplyClicked(Comment comment) {
setReplyToComment(comment);
}
});
commentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim, int position) {
if (!Helper.isNullOrEmpty(claim.getName()) && claim.getName().startsWith("@") && ctx instanceof MainActivity) {
((MainActivity) ctx).openChannelClaim(claim);
}
}
});
RecyclerView commentList = root.findViewById(R.id.channel_comments_list);
int marginInPx = Math.round(40 * ((float) ctx.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT));
commentList.addItemDecoration(new CommentItemDecoration(marginInPx));
commentList.setAdapter(commentListAdapter);
commentListAdapter.notifyItemRangeInserted(0, comments.size());
commentListAdapter.setCollapsed(false);
checkNoComments();
resolveCommentPosters();
scrollToCommentHash();
}
}
Aggregations