mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #3905 from Bnyro/master
Hide upload date for live videos
This commit is contained in:
commit
7e5f20610b
@ -76,7 +76,7 @@ class SearchAdapter : ListAdapter<ContentItem, SearchViewHolder>(SearchCallback)
|
||||
// only display the additional info if not in a channel tab
|
||||
if (item.isShort != true || item.uploaderAvatar != null) {
|
||||
val viewsString = item.views.takeIf { it != -1L }?.formatShort().orEmpty()
|
||||
val uploadDate = item.uploaded?.let {
|
||||
val uploadDate = item.uploaded?.takeIf { it > 0 }?.let {
|
||||
" ${TextUtils.SEPARATOR} ${TextUtils.formatRelativeDate(root.context, it)}"
|
||||
}.orEmpty()
|
||||
videoInfo.text = root.context.getString(
|
||||
|
@ -77,6 +77,7 @@ class VideosAdapter(
|
||||
viewType == CAUGHT_UP_TYPE -> VideosViewHolder(
|
||||
AllCaughtUpRowBinding.inflate(layoutInflater, parent, false),
|
||||
)
|
||||
|
||||
forceMode in listOf(
|
||||
ForceMode.TRENDING,
|
||||
ForceMode.RELATED,
|
||||
@ -84,13 +85,16 @@ class VideosAdapter(
|
||||
) -> VideosViewHolder(
|
||||
TrendingRowBinding.inflate(layoutInflater, parent, false),
|
||||
)
|
||||
|
||||
forceMode == ForceMode.CHANNEL -> VideosViewHolder(
|
||||
VideoRowBinding.inflate(layoutInflater, parent, false),
|
||||
)
|
||||
|
||||
PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.ALTERNATIVE_VIDEOS_LAYOUT,
|
||||
false,
|
||||
) -> VideosViewHolder(VideoRowBinding.inflate(layoutInflater, parent, false))
|
||||
|
||||
else -> VideosViewHolder(TrendingRowBinding.inflate(layoutInflater, parent, false))
|
||||
}
|
||||
}
|
||||
@ -107,6 +111,12 @@ class VideosAdapter(
|
||||
.setWatchProgressLength(it, video.duration ?: 0L)
|
||||
}
|
||||
|
||||
val context = (holder.videoRowBinding ?: holder.trendingRowBinding
|
||||
?: holder.allCaughtUpBinding)!!.root.context
|
||||
val uploadDate =
|
||||
video.uploaded?.takeIf { it > 0 }?.let { TextUtils.formatRelativeDate(context, it) }
|
||||
?.toString().orEmpty()
|
||||
|
||||
// Trending layout
|
||||
holder.trendingRowBinding?.apply {
|
||||
// set a fixed width for better visuals
|
||||
@ -123,7 +133,7 @@ class VideosAdapter(
|
||||
R.string.trending_views,
|
||||
video.uploaderName,
|
||||
video.views.formatShort(),
|
||||
video.uploaded?.let { TextUtils.formatRelativeDate(root.context, it) },
|
||||
uploadDate,
|
||||
)
|
||||
video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort) }
|
||||
channelImage.setOnClickListener {
|
||||
@ -154,9 +164,7 @@ class VideosAdapter(
|
||||
videoInfo.text = root.context.getString(
|
||||
R.string.normal_views,
|
||||
video.views.formatShort(),
|
||||
video.uploaded?.let {
|
||||
TextUtils.SEPARATOR + TextUtils.formatRelativeDate(root.context, it)
|
||||
},
|
||||
uploadDate,
|
||||
)
|
||||
|
||||
thumbnailDuration.text = video.duration?.let { DateUtils.formatElapsedTime(it) }
|
||||
|
Loading…
Reference in New Issue
Block a user