From 771a897492b496671725e6cba8677049534343e4 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 23 May 2023 17:56:11 +0200 Subject: [PATCH] Support for playlist descriptions --- .../com/github/libretube/api/obj/Playlist.kt | 1 + .../ui/fragments/PlaylistFragment.kt | 7 +++++ app/src/main/res/layout/fragment_playlist.xml | 27 +++++++++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/libretube/api/obj/Playlist.kt b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt index 38d7e0fd8c..940de1ce66 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Playlist.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Playlist.kt @@ -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, diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt index 70ec784d0d..ee7aa0dc14 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt @@ -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) diff --git a/app/src/main/res/layout/fragment_playlist.xml b/app/src/main/res/layout/fragment_playlist.xml index f5605157e3..1d8ae21c43 100644 --- a/app/src/main/res/layout/fragment_playlist.xml +++ b/app/src/main/res/layout/fragment_playlist.xml @@ -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"> @@ -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" /> @@ -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" /> + +