Merge pull request #3818 from Bnyro/master

Support for playlist descriptions
This commit is contained in:
Bnyro 2023-05-23 17:56:08 +02:00 committed by GitHub
commit b1cb25e69f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 5 deletions

View File

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

View File

@ -147,6 +147,13 @@ class PlaylistFragment : Fragment() {
} }
binding.playlistInfo.text = getChannelAndVideoString(response, response.videos) 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) showPlaylistVideos(response)

View File

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