File tree Expand file tree Collapse file tree
app/src/main/java/com/github/libretube/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,8 +41,6 @@ class DownloadsAdapter(
4141 private val downloadTab : DownloadTab ,
4242 private val toggleDownload : (DownloadWithItems ) -> Boolean
4343) : ListAdapter<DownloadWithItems, DownloadsViewHolder>(DiffUtilItemCallback ()) {
44- val items get() = (0 until itemCount).map { getItem(it) }
45-
4644 override fun onCreateViewHolder (parent : ViewGroup , viewType : Int ): DownloadsViewHolder {
4745 val binding = VideoRowBinding .inflate(
4846 LayoutInflater .from(parent.context),
@@ -183,7 +181,7 @@ class DownloadsAdapter(
183181 }
184182
185183 fun deleteAllDownloads (onlyDeleteWatched : Boolean ) {
186- val (toDelete, toKeep) = items .partition {
184+ val (toDelete, toKeep) = currentList .partition {
187185 ! onlyDeleteWatched || runBlocking(Dispatchers .IO ) {
188186 DatabaseHelper .isVideoWatched(it.download.videoId, it.download.duration ? : 0 )
189187 }
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import androidx.core.content.ContextCompat
1414import androidx.core.os.bundleOf
1515import androidx.core.view.isGone
1616import androidx.core.view.isVisible
17- import androidx.core.view.marginBottom
1817import androidx.core.view.updateLayoutParams
1918import androidx.fragment.app.Fragment
2019import androidx.fragment.app.activityViewModels
@@ -47,7 +46,6 @@ import com.github.libretube.ui.adapters.DownloadsAdapter
4746import com.github.libretube.ui.base.DynamicLayoutManagerFragment
4847import com.github.libretube.ui.extensions.setupFragmentAnimation
4948import com.github.libretube.ui.models.CommonPlayerViewModel
50- import com.github.libretube.ui.models.PlayerViewModel
5149import com.github.libretube.ui.sheets.BaseBottomSheet
5250import com.github.libretube.ui.viewholders.DownloadsViewHolder
5351import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -312,7 +310,7 @@ class DownloadsFragmentPage : DynamicLayoutManagerFragment(R.layout.fragment_dow
312310 }
313311
314312 fun updateProgress (id : Int , status : DownloadStatus ) {
315- val index = adapter.items .indexOfFirst {
313+ val index = adapter.currentList .indexOfFirst {
316314 it.downloadItems.any { item -> item.id == id }
317315 }
318316 val view =
You can’t perform that action at this time.
0 commit comments