fix: crash when all caught up view appearing in subscriptions

This commit is contained in:
Bnyro 2025-01-10 18:26:21 +01:00
parent 235e08bf86
commit b5eb5e4bd2

View File

@ -93,12 +93,8 @@ class VideosAdapter(
val video = streamItems[position] val video = streamItems[position]
val videoId = video.url.orEmpty().toID() val videoId = video.url.orEmpty().toID()
(holder.trendingRowBinding?.watchProgress ?: holder.videoRowBinding!!.watchProgress)
.setWatchProgressLength(videoId, video.duration ?: 0L)
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
@ -111,6 +107,7 @@ class VideosAdapter(
width = 250f.dpToPx() width = 250f.dpToPx()
} }
} }
watchProgress.setWatchProgressLength(videoId, video.duration ?: 0L)
textViewTitle.text = video.title textViewTitle.text = video.title
textViewChannel.text = TextUtils.formatViewsString(root.context, video.views ?: -1, video.uploaded, video.uploaderName) textViewChannel.text = TextUtils.formatViewsString(root.context, video.views ?: -1, video.uploaded, video.uploaderName)
@ -145,6 +142,7 @@ class VideosAdapter(
videoInfo.text = TextUtils.formatViewsString(root.context, video.views ?: -1, video.uploaded) videoInfo.text = TextUtils.formatViewsString(root.context, video.views ?: -1, video.uploaded)
video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort, video.uploaded) } video.duration?.let { thumbnailDuration.setFormattedDuration(it, video.isShort, video.uploaded) }
watchProgress.setWatchProgressLength(videoId, video.duration ?: 0L)
ImageHelper.loadImage(video.thumbnail, thumbnail) ImageHelper.loadImage(video.thumbnail, thumbnail)
if (forceMode != LayoutMode.CHANNEL_ROW) { if (forceMode != LayoutMode.CHANNEL_ROW) {