diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/DeleteLibraryMangasDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/DeleteLibraryMangasDialog.kt index aa0d43770..b60dc8b7b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/DeleteLibraryMangasDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/DeleteLibraryMangasDialog.kt @@ -7,6 +7,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.ui.base.controller.DialogController +import eu.kanade.tachiyomi.util.isLocal class DeleteLibraryMangasDialog(bundle: Bundle? = null) : DialogController(bundle) where T : Controller, T : DeleteLibraryMangasDialog.Listener { @@ -19,7 +20,17 @@ class DeleteLibraryMangasDialog(bundle: Bundle? = null) : } override fun onCreateDialog(savedViewState: Bundle?): Dialog { - val items = resources!!.getStringArray(R.array.delete_selected_mangas) + val canDeleteChapters = mangas.any { !it.isLocal() } + val items = when (canDeleteChapters) { + true -> listOf( + R.string.manga_from_library, + R.string.downloaded_chapters, + ) + false -> listOf(R.string.manga_from_library) + } + .map { resources!!.getString(it) } + .toTypedArray() + val selected = items .mapIndexed { i, _ -> i == 0 } .toBooleanArray() @@ -30,7 +41,7 @@ class DeleteLibraryMangasDialog(bundle: Bundle? = null) : } .setPositiveButton(android.R.string.ok) { _, _ -> val deleteFromLibrary = selected[0] - val deleteChapters = selected[1] + val deleteChapters = canDeleteChapters && selected[1] (targetController as? Listener)?.deleteMangas(mangas, deleteFromLibrary, deleteChapters) } .setNegativeButton(android.R.string.cancel, null) diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index b7ba2e3db..33da89d44 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -84,11 +84,6 @@ @string/tapping_inverted_both - - @string/manga_from_library - @string/downloaded_chapters - - @string/label_default @string/l_nav