From 195e5aaad66a841eedaf7faf5e79aeac6da4afb1 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 9 May 2022 22:44:37 +0200 Subject: [PATCH] Video duration in search --- .../com/github/libretube/adapters/SearchAdapter.kt | 4 +++- app/src/main/res/layout/video_search_row.xml | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt index 92ed0826f..a501369c3 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -1,7 +1,7 @@ package com.github.libretube.adapters -import android.content.res.Resources import android.os.Bundle +import android.text.format.DateUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -53,6 +53,8 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){ private fun bindWatch(item: SearchItem) { val thumbnailImage = v.findViewById(R.id.search_thumbnail) Picasso.get().load(item.thumbnail).into(thumbnailImage) + val thumbnailDuration = v.findViewById(R.id.search_thumbnail_duration) + thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!) val channelImage = v.findViewById(R.id.search_channel_image) Picasso.get().load(item.uploaderAvatar).into(channelImage) val title = v.findViewById(R.id.search_description) diff --git a/app/src/main/res/layout/video_search_row.xml b/app/src/main/res/layout/video_search_row.xml index 42f11280f..444473b2e 100644 --- a/app/src/main/res/layout/video_search_row.xml +++ b/app/src/main/res/layout/video_search_row.xml @@ -34,6 +34,18 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:srcCompat="@tools:sample/backgrounds/scenic" /> + +