Video duration in search

This commit is contained in:
Bnyro 2022-05-09 22:44:37 +02:00
parent af7de7b3c0
commit 195e5aaad6
2 changed files with 15 additions and 1 deletions

View File

@ -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<ImageView>(R.id.search_thumbnail)
Picasso.get().load(item.thumbnail).into(thumbnailImage)
val thumbnailDuration = v.findViewById<TextView>(R.id.search_thumbnail_duration)
thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!)
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
Picasso.get().load(item.uploaderAvatar).into(channelImage)
val title = v.findViewById<TextView>(R.id.search_description)

View File

@ -34,6 +34,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
<TextView
android:id="@+id/search_thumbnail_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="5dp"
android:layout_marginBottom="3dp"
android:textSize="11dp"
android:textColor="@color/duration_text_color"
android:background="@color/duration_background_color"
android:padding="0.5dp"/>
</com.google.android.material.card.MaterialCardView>
<TextView