mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
feat(comments): highlight creator comments
This commit is contained in:
parent
8964032bdf
commit
eacd335c30
@ -19,5 +19,6 @@ data class Comment(
|
|||||||
val thumbnail: String,
|
val thumbnail: String,
|
||||||
val verified: Boolean,
|
val verified: Boolean,
|
||||||
val replyCount: Long,
|
val replyCount: Long,
|
||||||
val creatorReplied: Boolean = false
|
val creatorReplied: Boolean = false,
|
||||||
|
val channelOwner: Boolean = false
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
@ -72,7 +72,11 @@ class CommentsAdapter(
|
|||||||
override fun onBindViewHolder(holder: CommentsViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: CommentsViewHolder, position: Int) {
|
||||||
val comment = comments[position]
|
val comment = comments[position]
|
||||||
holder.binding.apply {
|
holder.binding.apply {
|
||||||
commentInfos.text = comment.author + TextUtils.SEPARATOR + comment.commentedTime
|
commentAuthor.text = comment.author
|
||||||
|
if (comment.channelOwner) {
|
||||||
|
commentAuthor.setBackgroundResource(R.drawable.comment_channel_owner_bg)
|
||||||
|
}
|
||||||
|
commentInfos.text = TextUtils.SEPARATOR + comment.commentedTime
|
||||||
|
|
||||||
commentText.movementMethod = LinkMovementMethodCompat.getInstance()
|
commentText.movementMethod = LinkMovementMethodCompat.getInstance()
|
||||||
commentText.text = comment.commentText?.replace("</a>", "</a> ")
|
commentText.text = comment.commentText?.replace("</a>", "</a> ")
|
||||||
|
@ -203,7 +203,12 @@ object PlayingQueue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateQueue(streamItem: StreamItem, playlistId: String?, channelId: String?, relatedStreams: List<StreamItem> = emptyList()) {
|
fun updateQueue(
|
||||||
|
streamItem: StreamItem,
|
||||||
|
playlistId: String?,
|
||||||
|
channelId: String?,
|
||||||
|
relatedStreams: List<StreamItem> = emptyList()
|
||||||
|
) {
|
||||||
if (playlistId != null) {
|
if (playlistId != null) {
|
||||||
insertPlaylist(playlistId, streamItem)
|
insertPlaylist(playlistId, streamItem)
|
||||||
} else if (channelId != null) {
|
} else if (channelId != null) {
|
||||||
|
10
app/src/main/res/drawable/comment_channel_owner_bg.xml
Normal file
10
app/src/main/res/drawable/comment_channel_owner_bg.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="?colorPrimaryContainer" />
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
<padding
|
||||||
|
android:bottom="2dp"
|
||||||
|
android:left="4dp"
|
||||||
|
android:right="4dp"
|
||||||
|
android:top="2dp" />
|
||||||
|
</shape>
|
@ -36,6 +36,17 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/comment_author"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="Octacat" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment_infos"
|
android:id="@+id/comment_infos"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -45,7 +56,7 @@
|
|||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="Octacat • 10h" />
|
tools:text="• 10h" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/verified_imageView"
|
android:id="@+id/verified_imageView"
|
||||||
|
Loading…
Reference in New Issue
Block a user