|
@@ -3,12 +3,11 @@ package eu.kanade.tachiyomi.ui.library
|
|
|
import android.app.Dialog
|
|
|
import android.os.Bundle
|
|
|
import com.afollestad.materialdialogs.MaterialDialog
|
|
|
-import com.afollestad.materialdialogs.customview.customView
|
|
|
+import com.afollestad.materialdialogs.list.listItemsMultiChoice
|
|
|
import com.bluelinelabs.conductor.Controller
|
|
|
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.widget.DialogCheckboxView
|
|
|
|
|
|
class DeleteLibraryMangasDialog<T>(bundle: Bundle? = null) :
|
|
|
DialogController(bundle) where T : Controller, T : DeleteLibraryMangasDialog.Listener {
|
|
@@ -21,25 +20,21 @@ class DeleteLibraryMangasDialog<T>(bundle: Bundle? = null) :
|
|
|
}
|
|
|
|
|
|
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
|
|
- val view = DialogCheckboxView(activity!!).apply {
|
|
|
- setDescription(R.string.confirm_delete_manga)
|
|
|
- setOptionDescription(R.string.also_delete_chapters)
|
|
|
- }
|
|
|
-
|
|
|
return MaterialDialog(activity!!)
|
|
|
.title(R.string.action_remove)
|
|
|
- .customView(
|
|
|
- view = view,
|
|
|
- horizontalPadding = true
|
|
|
- )
|
|
|
- .positiveButton(android.R.string.ok) {
|
|
|
- val deleteChapters = view.isChecked()
|
|
|
- (targetController as? Listener)?.deleteMangasFromLibrary(mangas, deleteChapters)
|
|
|
+ .listItemsMultiChoice(
|
|
|
+ R.array.delete_selected_mangas,
|
|
|
+ initialSelection = intArrayOf(0)
|
|
|
+ ) { _, selections, _ ->
|
|
|
+ val deleteFromLibrary = 0 in selections
|
|
|
+ val deleteChapters = 1 in selections
|
|
|
+ (targetController as? Listener)?.deleteMangas(mangas, deleteFromLibrary, deleteChapters)
|
|
|
}
|
|
|
+ .positiveButton(android.R.string.ok)
|
|
|
.negativeButton(android.R.string.cancel)
|
|
|
}
|
|
|
|
|
|
interface Listener {
|
|
|
- fun deleteMangasFromLibrary(mangas: List<Manga>, deleteChapters: Boolean)
|
|
|
+ fun deleteMangas(mangas: List<Manga>, deleteFromLibrary: Boolean, deleteChapters: Boolean)
|
|
|
}
|
|
|
}
|