mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-29 05:17:56 +01:00
Combine chapter sort asc/desc and sorting mode menus
This commit is contained in:
@@ -227,6 +227,7 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
||||
else -> throw NotImplementedError("Unimplemented sorting method")
|
||||
}
|
||||
menu.findItem(sortingItem).isChecked = true
|
||||
menu.findItem(R.id.action_sort_descending).isChecked = presenter.manga.sortDescending()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
@@ -252,6 +253,10 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
||||
item.isChecked = true
|
||||
presenter.setSorting(Manga.SORTING_UPLOAD_DATE)
|
||||
}
|
||||
R.id.action_sort_descending -> {
|
||||
presenter.reverseSortOrder()
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
R.id.download_next, R.id.download_next_5, R.id.download_next_10,
|
||||
R.id.download_custom, R.id.download_unread, R.id.download_all
|
||||
@@ -281,7 +286,6 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
||||
presenter.removeFilters()
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
R.id.action_sort -> presenter.revertSortOrder()
|
||||
|
||||
R.id.action_migrate -> migrateManga()
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ class MangaInfoChaptersPresenter(
|
||||
/**
|
||||
* Reverses the sorting and requests an UI update.
|
||||
*/
|
||||
fun revertSortOrder() {
|
||||
fun reverseSortOrder() {
|
||||
manga.setChapterOrder(if (sortDescending()) Manga.SORT_ASC else Manga.SORT_DESC)
|
||||
db.updateFlags(manga).executeAsBlocking()
|
||||
refreshChapters()
|
||||
|
||||
Reference in New Issue
Block a user