Merge pull request #4949 from Bnyro/master

fix: remove view count from continue watching section
This commit is contained in:
Bnyro 2023-10-11 09:10:11 +02:00 committed by GitHub
commit 2043077673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,14 +113,15 @@ class VideosAdapter(
} }
val context = ( val context = (
holder.videoRowBinding ?: holder.trendingRowBinding holder.videoRowBinding ?: holder.trendingRowBinding
?: holder.allCaughtUpBinding ?: holder.allCaughtUpBinding
)!!.root.context )!!.root.context
val activity = (context as BaseActivity) val activity = (context as BaseActivity)
val fragmentManager = activity.supportFragmentManager val fragmentManager = activity.supportFragmentManager
val uploadDate = val uploadDateStr = video.uploaded.takeIf { it > 0 }
video.uploaded.takeIf { it > 0 }?.let { TextUtils.formatRelativeDate(context, it) } ?.let { TextUtils.formatRelativeDate(context, it) }
?.toString()
// Trending layout // Trending layout
holder.trendingRowBinding?.apply { holder.trendingRowBinding?.apply {
@ -134,12 +135,16 @@ class VideosAdapter(
} }
textViewTitle.text = video.title textViewTitle.text = video.title
textViewChannel.text = root.context.getString( textViewChannel.text = if ((video.views ?: 0L) > 0L) {
R.string.trending_views, root.context.getString(
video.uploaderName, R.string.trending_views,
video.views.formatShort(), video.uploaderName,
uploadDate?.toString().orEmpty() video.views.formatShort(),
) uploadDateStr
)
} else {
"${video.uploaderName} ${TextUtils.SEPARATOR} $uploadDateStr"
}
video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort) } video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort) }
channelImage.setOnClickListener { channelImage.setOnClickListener {
NavigationHelper.navigateChannel(root.context, video.uploaderUrl) NavigationHelper.navigateChannel(root.context, video.uploaderUrl)
@ -171,7 +176,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(),
uploadDate?.let { " ${TextUtils.SEPARATOR} $it" } uploadDateStr?.let { " ${TextUtils.SEPARATOR} $it" }
) )
thumbnailDuration.text = video.duration?.let { DateUtils.formatElapsedTime(it) } thumbnailDuration.text = video.duration?.let { DateUtils.formatElapsedTime(it) }