From 8c99f56f43f0eeb15b95a99b55ef616a1ede5caf Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 8 May 2022 14:14:06 +0200 Subject: [PATCH] Added Hearted and Pinned --- .../libretube/adapters/CommentsAdapter.kt | 12 ++++- app/src/main/res/drawable/ic_hearted.xml | 9 ++++ app/src/main/res/drawable/ic_pinned.xml | 11 ++++ app/src/main/res/drawable/ic_verified.xml | 10 ++++ app/src/main/res/layout/comments_row.xml | 52 +++++++++++++++---- 5 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable/ic_hearted.xml create mode 100644 app/src/main/res/drawable/ic_pinned.xml create mode 100644 app/src/main/res/drawable/ic_verified.xml diff --git a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt index aebd66a93..0dbb3ca28 100644 --- a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt @@ -6,6 +6,7 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import android.widget.Toast import androidx.recyclerview.widget.RecyclerView import com.github.libretube.R import com.github.libretube.obj.Comment @@ -19,11 +20,20 @@ class CommentsAdapter(private val comments: List): RecyclerView.Adapte } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - holder.v.findViewById(R.id.comment_author).text = comments[position].author.toString() + " • " + comments[position].commentedTime.toString() + holder.v.findViewById(R.id.comment_infos).text = comments[position].author.toString() + " • " + comments[position].commentedTime.toString() holder.v.findViewById(R.id.comment_text).text = comments[position].commentText.toString() val thumbnailImage = holder.v.findViewById(R.id.commentor_image) Picasso.get().load(comments[position].thumbnail).into(thumbnailImage) holder.v.findViewById(R.id.likes_textView).text = comments[position].likeCount.toString() + if (comments[position].verified == true) { + holder.v.findViewById(R.id.verified_imageView).visibility = View.VISIBLE + } + if (comments[position].pinned == true) { + holder.v.findViewById(R.id.pinned_imageView).visibility = View.VISIBLE + } + if (comments[position].hearted == true) { + holder.v.findViewById(R.id.hearted_imageView).visibility = View.VISIBLE + } } override fun getItemCount(): Int { diff --git a/app/src/main/res/drawable/ic_hearted.xml b/app/src/main/res/drawable/ic_hearted.xml new file mode 100644 index 000000000..f690e38fd --- /dev/null +++ b/app/src/main/res/drawable/ic_hearted.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_pinned.xml b/app/src/main/res/drawable/ic_pinned.xml new file mode 100644 index 000000000..f1e14a868 --- /dev/null +++ b/app/src/main/res/drawable/ic_pinned.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_verified.xml b/app/src/main/res/drawable/ic_verified.xml new file mode 100644 index 000000000..bbb482627 --- /dev/null +++ b/app/src/main/res/drawable/ic_verified.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/comments_row.xml b/app/src/main/res/layout/comments_row.xml index 4d4e7dbe1..878a2841e 100644 --- a/app/src/main/res/layout/comments_row.xml +++ b/app/src/main/res/layout/comments_row.xml @@ -26,15 +26,39 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + + + + + + + + + android:text="LikeCount" /> +