Support for playlist descriptions

This commit is contained in:
Bnyro 2023-05-23 17:56:11 +02:00
parent 1bc446f592
commit 771a897492
3 changed files with 30 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class Playlist(
val name: String? = null,
var description: String? = null,
val thumbnailUrl: String? = null,
val bannerUrl: String? = null,
val nextpage: String? = null,

View File

@ -147,6 +147,13 @@ class PlaylistFragment : Fragment() {
}
binding.playlistInfo.text = getChannelAndVideoString(response, response.videos)
binding.playlistDescription.text = response.description
binding.playlistDescription.let { textView ->
textView.setOnClickListener {
textView.maxLines = if (textView.maxLines == Int.MAX_VALUE) 3 else Int.MAX_VALUE
}
}
showPlaylistVideos(response)

View File

@ -39,17 +39,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingHorizontal="15dp">
android:orientation="horizontal">
<TextView
android:id="@+id/playlist_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/rounded_ripple"
android:ellipsize="end"
android:maxLines="2"
android:paddingHorizontal="5dp"
android:paddingVertical="2dp"
android:textSize="20sp"
android:textStyle="bold" />
@ -59,15 +61,17 @@
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:background="?selectableItemBackgroundBorderless"
android:src="@drawable/ic_sort"
android:visibility="gone"/>
android:visibility="gone" />
<ImageView
android:id="@+id/optionsMenu"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:layout_marginEnd="20dp"
android:background="?selectableItemBackgroundBorderless"
android:src="@drawable/ic_three_dots" />
</LinearLayout>
@ -77,9 +81,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="15dp"
android:paddingVertical="8dp"
android:paddingBottom="5dp"
android:textStyle="bold" />
<TextView
android:id="@+id/playlistDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:autoLink="web"
android:background="@drawable/rounded_ripple"
android:ellipsize="end"
android:maxLines="3"
android:paddingHorizontal="10dp"
android:paddingTop="5dp"
android:paddingBottom="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"