From d0d9debc29c0c51d5166ead792634a8f7cb52071 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sun, 5 Jan 2025 21:22:39 +0100 Subject: [PATCH] feat(Playlist): display views and upload date As the Piped API now provides the number of views/upload date for a playlist item, we can display them in the playlist view. Ref: https://github.com/libre-tube/LibreTube/issues/4401 --- .../com/github/libretube/ui/adapters/PlaylistAdapter.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt index 1a4d92a44..7581bbad8 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt @@ -80,12 +80,14 @@ class PlaylistAdapter( holder.binding.apply { videoTitle.text = streamItem.title - videoInfo.text = streamItem.uploaderName - channelImageContainer.isGone = true + videoInfo.text = TextUtils.formatViewsString(root.context, streamItem.views ?: -1, streamItem.uploaded, streamItem.uploaderName) + videoInfo.maxLines = 2 - thumbnailDuration.setFormattedDuration(streamItem.duration ?: -1, streamItem.isShort, streamItem.uploaded) + // piped does not load channel avatars for playlist views + channelContainer.isGone = true ImageHelper.loadImage(streamItem.thumbnail, thumbnail) + thumbnailDuration.setFormattedDuration(streamItem.duration ?: -1, streamItem.isShort, streamItem.uploaded) root.setOnClickListener { NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId)