From 0e8c3043ae8b6dec1137cab134664702a46059f9 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 17 Oct 2022 18:27:05 +0200 Subject: [PATCH] Show the comment reply count --- .../java/com/github/libretube/api/obj/Comment.kt | 5 +++-- .../github/libretube/ui/adapters/CommentsAdapter.kt | 5 +++-- app/src/main/res/layout/comments_row.xml | 13 ++++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/libretube/api/obj/Comment.kt b/app/src/main/java/com/github/libretube/api/obj/Comment.kt index 398689d8b..ef8f6f9c4 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Comment.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Comment.kt @@ -11,8 +11,9 @@ data class Comment( val commentorUrl: String? = null, val repliesPage: String? = null, val hearted: Boolean? = null, - val likeCount: Int? = null, + val likeCount: Long? = null, val pinned: Boolean? = null, val thumbnail: String? = null, - val verified: Boolean? = null + val verified: Boolean? = null, + val replyCount: Long? = null ) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt index 94aec72c5..5689005d6 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/CommentsAdapter.kt @@ -64,12 +64,13 @@ class CommentsAdapter( commentText.text = comment.commentText.toString() ImageHelper.loadImage(comment.thumbnail, commentorImage) - likesTextView.text = comment.likeCount?.toLong().formatShort() + likesTextView.text = comment.likeCount.formatShort() if (comment.verified == true) verifiedImageView.visibility = View.VISIBLE if (comment.pinned == true) pinnedImageView.visibility = View.VISIBLE if (comment.hearted == true) heartedImageView.visibility = View.VISIBLE - if (comment.repliesPage != null) commentsAvailable.visibility = View.VISIBLE + if (comment.repliesPage != null) repliesAvailable.visibility = View.VISIBLE + if ((comment.replyCount ?: -1L) > 0L) repliesCount.text = comment.replyCount?.formatShort() commentorImage.setOnClickListener { NavigationHelper.navigateChannel(root.context, comment.commentorUrl) diff --git a/app/src/main/res/layout/comments_row.xml b/app/src/main/res/layout/comments_row.xml index 700936571..15148e8a5 100644 --- a/app/src/main/res/layout/comments_row.xml +++ b/app/src/main/res/layout/comments_row.xml @@ -87,13 +87,13 @@ android:layout_width="16dp" android:layout_height="16dp" android:layout_marginTop="2dp" - android:layout_marginEnd="6dp" app:srcCompat="@drawable/ic_thumb_up" /> + + @@ -128,7 +135,6 @@ android:nestedScrollingEnabled="false" />