mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-01 22:58:57 +01:00
Fix #329. Add confirmation before removing favorite manga on multiple selection. Add new proguard rules
This commit is contained in:
@@ -134,7 +134,7 @@ class DownloadFragment : BaseRxFragment<DownloadPresenter>() {
|
||||
|
||||
// Set clear button visibility.
|
||||
clearButton = menu.findItem(R.id.clear_queue).apply {
|
||||
if (adapter.itemCount > 0) {
|
||||
if (!presenter.downloadQueue.isEmpty()) {
|
||||
isVisible = true
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,6 @@ class DownloadFragment : BaseRxFragment<DownloadPresenter>() {
|
||||
R.id.clear_queue -> {
|
||||
DownloadService.stop(activity)
|
||||
presenter.clearQueue()
|
||||
clearButton?.isVisible = false
|
||||
}
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
@@ -223,7 +222,7 @@ class DownloadFragment : BaseRxFragment<DownloadPresenter>() {
|
||||
isRunning = running
|
||||
startButton?.isVisible = !running && !presenter.downloadQueue.isEmpty()
|
||||
pauseButton?.isVisible = running
|
||||
clearButton?.isVisible = running
|
||||
clearButton?.isVisible = !presenter.downloadQueue.isEmpty()
|
||||
|
||||
// Check if download queue is empty and update information accordingly.
|
||||
setInformationView()
|
||||
|
||||
@@ -313,13 +313,8 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
||||
changeSelectedCover(presenter.selectedMangas)
|
||||
destroyActionModeIfNeeded()
|
||||
}
|
||||
R.id.action_move_to_category -> {
|
||||
moveMangasToCategories(presenter.selectedMangas)
|
||||
}
|
||||
R.id.action_delete -> {
|
||||
presenter.deleteMangas()
|
||||
destroyActionModeIfNeeded()
|
||||
}
|
||||
R.id.action_move_to_category -> moveMangasToCategories(presenter.selectedMangas)
|
||||
R.id.action_delete -> showDeleteMangaDialog()
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
@@ -409,6 +404,18 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun showDeleteMangaDialog() {
|
||||
MaterialDialog.Builder(activity)
|
||||
.content(R.string.confirm_delete_manga)
|
||||
.positiveText(android.R.string.yes)
|
||||
.negativeText(android.R.string.no)
|
||||
.onPositive { dialog, action ->
|
||||
presenter.removeMangaFromLibrary()
|
||||
destroyActionModeIfNeeded()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the action mode if it's not created already.
|
||||
*/
|
||||
|
||||
@@ -236,7 +236,7 @@ class LibraryPresenter : BasePresenter<LibraryFragment>() {
|
||||
/**
|
||||
* Remove the selected manga from the library.
|
||||
*/
|
||||
fun deleteMangas() {
|
||||
fun removeMangaFromLibrary() {
|
||||
// Create a set of the list
|
||||
val mangaToDelete = selectedMangas.toSet()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user