mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Hold to edit manga categories instead of popup (#1305)
(cherry picked from commit f93b9bc3968f70e4c3f3eaad8f629832b2acbc63)
This commit is contained in:
parent
a79a3fb777
commit
62fa8c3435
2 changed files with 14 additions and 10 deletions
|
@ -1443,14 +1443,10 @@ class MangaDetailsController :
|
|||
|
||||
override fun favoriteManga(longPress: Boolean) {
|
||||
if (needsToBeUnlocked()) return
|
||||
val manga = presenter.manga
|
||||
val categories = presenter.getCategories()
|
||||
if (!manga.favorite) {
|
||||
toggleMangaFavorite()
|
||||
if (longPress) {
|
||||
showCategoriesSheet()
|
||||
} else {
|
||||
val favButton = getHeader()?.binding?.favoriteButton ?: return
|
||||
val popup = makeFavPopup(favButton, categories)
|
||||
popup?.show()
|
||||
toggleMangaFavorite()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1478,9 +1474,7 @@ class MangaDetailsController :
|
|||
// Set a listener so we are notified if a menu item is clicked
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
if (menuItem.itemId == 0) {
|
||||
presenter.manga.moveCategories(presenter.db, activity!!) {
|
||||
updateHeader()
|
||||
}
|
||||
showCategoriesSheet()
|
||||
} else {
|
||||
toggleMangaFavorite()
|
||||
}
|
||||
|
@ -1489,6 +1483,12 @@ class MangaDetailsController :
|
|||
return popup
|
||||
}
|
||||
|
||||
private fun showCategoriesSheet() {
|
||||
presenter.manga.moveCategories(presenter.db, activity!!) {
|
||||
updateHeader()
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleMangaFavorite() {
|
||||
val view = view ?: return
|
||||
val activity = activity ?: return
|
||||
|
|
|
@ -128,6 +128,10 @@ class MangaHeaderHolder(
|
|||
favoriteButton.setOnClickListener {
|
||||
adapter.delegate.favoriteManga(false)
|
||||
}
|
||||
favoriteButton.setOnLongClickListener {
|
||||
adapter.delegate.favoriteManga(true)
|
||||
true
|
||||
}
|
||||
title.setOnClickListener { view ->
|
||||
title.text?.toString()?.toNormalized()?.let {
|
||||
adapter.delegate.showFloatingActionMode(view as TextView, it)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue