From 3aa4e6eb93d7d821bfee313198f9d22f22da5889 Mon Sep 17 00:00:00 2001 From: Franco Olivera Date: Sat, 26 Mar 2022 15:49:37 -0300 Subject: [PATCH] Add "Move all chapters from series to top" option to download context menu (#6794) * Added basic move to top series feature * Remove intermediate List * Change text string * Remove spanish manual translation * Changed algorithm to use "partition" --- .../eu/kanade/tachiyomi/ui/download/DownloadController.kt | 8 ++++++++ app/src/main/res/menu/download_single.xml | 4 ++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 13 insertions(+) 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 b19f93329..51db5949a 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 @@ -366,6 +366,14 @@ class DownloadController : } presenter.reorder(newDownloads) } + R.id.move_to_top_series -> { + val (selectedSeries, otherSeries) = adapter?.currentItems + ?.filterIsInstance() + ?.map(DownloadItem::download) + ?.partition { item.download.manga.id == it.manga.id } + ?: Pair(listOf(), listOf()) + presenter.reorder(selectedSeries + otherSeries) + } R.id.cancel_download -> { presenter.cancelDownload(item.download) } diff --git a/app/src/main/res/menu/download_single.xml b/app/src/main/res/menu/download_single.xml index 806a561b5..34ec33a4d 100644 --- a/app/src/main/res/menu/download_single.xml +++ b/app/src/main/res/menu/download_single.xml @@ -5,6 +5,10 @@ android:id="@+id/move_to_top" android:title="@string/action_move_to_top" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8af2f80d7..15885ce4a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -114,6 +114,7 @@ Ascending Descending Move to top + Move series to top Move to bottom Install Share