mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
live video indication
This commit is contained in:
parent
a1c0499188
commit
f7f16c9c17
@ -1,7 +1,10 @@
|
||||
package com.github.libretube.adapters
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.Color.rgb
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -70,7 +73,13 @@ class SearchViewHolder(
|
||||
val thumbnailImage = v.findViewById<ImageView>(R.id.search_thumbnail)
|
||||
Picasso.get().load(item.thumbnail).fit().centerCrop().into(thumbnailImage)
|
||||
val thumbnailDuration = v.findViewById<TextView>(R.id.search_thumbnail_duration)
|
||||
thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!)
|
||||
val itemDuration = DateUtils.formatElapsedTime(item.duration!!)
|
||||
if (itemDuration != "00:-1") {
|
||||
thumbnailDuration.text = itemDuration
|
||||
} else {
|
||||
thumbnailDuration.text = v.context.getString(R.string.live)
|
||||
thumbnailDuration.setBackgroundColor(R.attr.colorPrimaryDark)
|
||||
}
|
||||
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
|
||||
Picasso.get().load(item.uploaderAvatar).fit().centerCrop().into(channelImage)
|
||||
val title = v.findViewById<TextView>(R.id.search_description)
|
||||
|
@ -53,8 +53,14 @@ class SubscriptionAdapter(
|
||||
trending.views.formatShort() + " • " +
|
||||
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
||||
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.thumbnail)
|
||||
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text =
|
||||
DateUtils.formatElapsedTime(trending.duration!!)
|
||||
val thumbnailDuration = holder.v.findViewById<TextView>(R.id.thumbnail_duration)
|
||||
val itemDuration = DateUtils.formatElapsedTime(trending.duration!!)
|
||||
if (itemDuration != "00:-1") {
|
||||
thumbnailDuration.text = itemDuration
|
||||
} else {
|
||||
thumbnailDuration.text = holder.v.context.getString(R.string.live)
|
||||
thumbnailDuration.setBackgroundColor(R.attr.colorPrimaryDark)
|
||||
}
|
||||
val channelImage = holder.v.findViewById<ImageView>(R.id.channel_image)
|
||||
channelImage.setOnClickListener {
|
||||
val activity = holder.v.context as MainActivity
|
||||
|
@ -42,8 +42,14 @@ class TrendingAdapter(
|
||||
trending.views.formatShort() + " • " +
|
||||
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
||||
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.thumbnail)
|
||||
holder.v.findViewById<TextView>(R.id.thumbnail_duration).text =
|
||||
DateUtils.formatElapsedTime(trending.duration!!)
|
||||
val thumbnailDuration = holder.v.findViewById<TextView>(R.id.thumbnail_duration)
|
||||
val itemDuration = DateUtils.formatElapsedTime(trending.duration!!)
|
||||
if (itemDuration != "00:-1") {
|
||||
thumbnailDuration.text = itemDuration
|
||||
} else {
|
||||
thumbnailDuration.text = holder.v.context.getString(R.string.live)
|
||||
thumbnailDuration.setBackgroundColor(R.attr.colorPrimaryDark)
|
||||
}
|
||||
val channelImage = holder.v.findViewById<ImageView>(R.id.channel_image)
|
||||
channelImage.setOnClickListener {
|
||||
val activity = holder.v.context as MainActivity
|
||||
|
@ -140,4 +140,5 @@
|
||||
<string name="player">Player</string>
|
||||
<string name="appearance_summary">Make the app look how you want to.</string>
|
||||
<string name="advanced_summary">Player, Downloads, History</string>
|
||||
<string name="live">Live</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user