mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
indicate when replies are available
This commit is contained in:
parent
1018fd80fb
commit
5c4a23aa33
@ -1,5 +1,6 @@
|
||||
package com.github.libretube.ui.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -43,17 +44,16 @@ class CommentsAdapter(
|
||||
return CommentsViewHolder(binding)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: CommentsViewHolder, position: Int) {
|
||||
val comment = comments[position]
|
||||
holder.binding.apply {
|
||||
commentInfos.text =
|
||||
comment.author.toString() +
|
||||
" • " + comment.commentedTime.toString()
|
||||
commentText.text =
|
||||
comment.commentText.toString()
|
||||
commentInfos.text = comment.author.toString() + " • " + comment.commentedTime.toString()
|
||||
commentText.text = comment.commentText.toString()
|
||||
|
||||
ImageHelper.loadImage(comment.thumbnail, commentorImage)
|
||||
likesTextView.text =
|
||||
comment.likeCount?.toLong().formatShort()
|
||||
likesTextView.text = comment.likeCount?.toLong().formatShort()
|
||||
|
||||
if (comment.verified == true) {
|
||||
verifiedImageView.visibility = View.VISIBLE
|
||||
}
|
||||
@ -63,23 +63,29 @@ class CommentsAdapter(
|
||||
if (comment.hearted == true) {
|
||||
heartedImageView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (comment.repliesPage != null) {
|
||||
commentsAvailable.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
commentorImage.setOnClickListener {
|
||||
NavigationHelper.navigateChannel(root.context, comment.commentorUrl)
|
||||
}
|
||||
|
||||
repliesRecView.layoutManager = LinearLayoutManager(root.context)
|
||||
val repliesAdapter = RepliesAdapter(CommentsPage().comments)
|
||||
repliesRecView.adapter = repliesAdapter
|
||||
root.setOnClickListener {
|
||||
if (repliesAdapter.itemCount == 0) {
|
||||
if (comment.repliesPage != null) {
|
||||
when {
|
||||
repliesAdapter.itemCount.equals(0) && comment.repliesPage != null -> {
|
||||
nextpage = comment.repliesPage
|
||||
fetchReplies(nextpage, repliesAdapter)
|
||||
} else {
|
||||
}
|
||||
repliesAdapter.itemCount.equals(0) -> {
|
||||
Toast.makeText(root.context, R.string.no_replies, Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
} else {
|
||||
repliesAdapter.clear()
|
||||
else -> repliesAdapter.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
app/src/main/res/drawable/ic_comment.xml
Normal file
10
app/src/main/res/drawable/ic_comment.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12.4,27.5h24v-3h-24ZM12.4,21h24v-3h-24ZM12.4,14.5h24v-3h-24ZM44,44l-8,-8L7,36q-1.15,0 -2.075,-0.925Q4,34.15 4,33L4,7q0,-1.15 0.925,-2.075Q5.85,4 7,4h34q1.2,0 2.1,0.925Q44,5.85 44,7Z" />
|
||||
</vector>
|
@ -104,8 +104,20 @@
|
||||
android:layout_marginTop="3dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_hearted" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comments_available"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_comment" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
Loading…
x
Reference in New Issue
Block a user