Minor edits

This commit is contained in:
arkon 2020-04-16 17:21:58 -04:00
parent 4e111cebbe
commit 48f7b06549

View File

@ -285,18 +285,19 @@ class DownloadController : NucleusController<DownloadPresenter>(),
items.add(0, item) items.add(0, item)
else else
items.add(item) 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) presenter.reorder(downloads)
} }
R.id.cancel_download -> { R.id.cancel_download -> {
val download = adapter?.getItem(position)?.download ?: return val download = adapter?.getItem(position)?.download ?: return
presenter.cancelDownload(download) presenter.cancelDownload(download)
adapter?.removeItem(position)
val adapter = adapter ?: return val adapter = adapter ?: return
val downloads = adapter.removeItem(position)
(0 until adapter.itemCount).mapNotNull { adapter.getItem(it)?.download } val downloads = adapter.currentItems.mapNotNull { it?.download }
presenter.reorder(downloads) presenter.reorder(downloads)
} }
} }