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