From 48f7b06549a5f241c85bdce3c9e761ff5adef350 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 16 Apr 2020 17:21:58 -0400 Subject: [PATCH] Minor edits --- .../tachiyomi/ui/download/DownloadController.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt index 612692f59..fdddff800 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt @@ -285,18 +285,19 @@ class DownloadController : NucleusController(), items.add(0, item) else items.add(item) - adapter?.updateDataSet(items) - val downloads = items.mapNotNull { it.download } + + val adapter = adapter ?: return + adapter.updateDataSet(items) + val downloads = adapter.currentItems.mapNotNull { it?.download } presenter.reorder(downloads) } R.id.cancel_download -> { val download = adapter?.getItem(position)?.download ?: return presenter.cancelDownload(download) - adapter?.removeItem(position) val adapter = adapter ?: return - val downloads = - (0 until adapter.itemCount).mapNotNull { adapter.getItem(it)?.download } + adapter.removeItem(position) + val downloads = adapter.currentItems.mapNotNull { it?.download } presenter.reorder(downloads) } }