mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
MangaController: Change the workaround for title alpha (#7277)
Now checks for the backstack for any dialog controller when a push exit occurs before restoring the title alpha.
This commit is contained in:
parent
3c3d787a2b
commit
ae88252cb1
1 changed files with 9 additions and 28 deletions
|
@ -26,7 +26,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
import com.bluelinelabs.conductor.Controller
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
|
@ -182,8 +181,6 @@ class MangaController :
|
|||
|
||||
private var trackSheet: TrackSheet? = null
|
||||
|
||||
private var dialog: DialogController? = null
|
||||
|
||||
/**
|
||||
* For [recyclerViewUpdatesToolbarTitleAlpha]
|
||||
*/
|
||||
|
@ -206,8 +203,10 @@ class MangaController :
|
|||
super.onChangeStarted(handler, type)
|
||||
// Hide toolbar title on enter
|
||||
// No need to update alpha for cover dialog
|
||||
if (dialog == null) {
|
||||
updateToolbarTitleAlpha(if (type.isEnter) 0F else 1F)
|
||||
if (!type.isEnter) {
|
||||
if (!type.isPush || router.backstack.lastOrNull()?.controller !is DialogController) {
|
||||
updateToolbarTitleAlpha(1f)
|
||||
}
|
||||
}
|
||||
recyclerViewUpdatesToolbarTitleAlpha(type.isEnter)
|
||||
}
|
||||
|
@ -623,17 +622,8 @@ class MangaController :
|
|||
}
|
||||
|
||||
private fun showChangeCategoryDialog(manga: Manga, categories: List<Category>, preselected: Array<Int>) {
|
||||
if (dialog != null) return
|
||||
dialog = ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected)
|
||||
dialog?.addLifecycleListener(
|
||||
object : LifecycleListener() {
|
||||
override fun postDestroy(controller: Controller) {
|
||||
super.postDestroy(controller)
|
||||
dialog = null
|
||||
}
|
||||
},
|
||||
)
|
||||
dialog?.showDialog(router)
|
||||
ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected)
|
||||
.showDialog(router)
|
||||
}
|
||||
|
||||
override fun updateCategoriesForMangas(mangas: List<Manga>, addCategories: List<Category>, removeCategories: List<Category>) {
|
||||
|
@ -731,18 +721,9 @@ class MangaController :
|
|||
}
|
||||
|
||||
fun showFullCoverDialog() {
|
||||
if (dialog != null) return
|
||||
val manga = manga ?: return
|
||||
dialog = MangaFullCoverDialog(this, manga)
|
||||
dialog?.addLifecycleListener(
|
||||
object : LifecycleListener() {
|
||||
override fun postDestroy(controller: Controller) {
|
||||
super.postDestroy(controller)
|
||||
dialog = null
|
||||
}
|
||||
},
|
||||
)
|
||||
dialog?.showDialog(router)
|
||||
MangaFullCoverDialog(this, manga)
|
||||
.showDialog(router)
|
||||
}
|
||||
|
||||
fun shareCover() {
|
||||
|
@ -838,7 +819,7 @@ class MangaController :
|
|||
|
||||
fun onSetCoverSuccess() {
|
||||
mangaInfoAdapter?.notifyItemChanged(0, this)
|
||||
(dialog as? MangaFullCoverDialog)?.setImage(manga)
|
||||
(router.backstack.lastOrNull()?.controller as? MangaFullCoverDialog)?.setImage(manga)
|
||||
activity?.toast(R.string.cover_updated)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue