Fix global search scrolling up one section after coming from manga details

This commit is contained in:
Jays2Kings 2021-05-10 17:32:27 -04:00
parent c020d4d45d
commit 0099dd5523
3 changed files with 17 additions and 2 deletions

View File

@ -472,10 +472,10 @@ class MangaDetailsController :
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) { override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type) super.onChangeStarted(handler, type)
if (type == ControllerChangeType.PUSH_ENTER || type == ControllerChangeType.POP_ENTER) { if (type.isEnter) {
setActionBar(true) setActionBar(true)
setStatusBarAndToolbar() setStatusBarAndToolbar()
} else if (type == ControllerChangeType.PUSH_EXIT || type == ControllerChangeType.POP_EXIT) { } else {
if (router.backstack.lastOrNull()?.controller is DialogController) { if (router.backstack.lastOrNull()?.controller is DialogController) {
return return
} }
@ -485,6 +485,7 @@ class MangaDetailsController :
} }
colorAnimator?.cancel() colorAnimator?.cancel()
getHeader()?.unbind()
val colorSecondary = activity?.getResourceColor( val colorSecondary = activity?.getResourceColor(
R.attr.colorSecondary R.attr.colorSecondary
) ?: Color.BLACK ) ?: Color.BLACK

View File

@ -312,6 +312,11 @@ class MangaHeaderHolder(
updateCover(manga) updateCover(manga)
} }
fun unbind() {
binding?.mangaSummary?.setTextIsSelectable(false)
binding?.mangaSummary?.clearFocus()
}
private fun MaterialButton.checked(checked: Boolean) { private fun MaterialButton.checked(checked: Boolean) {
if (checked) { if (checked) {
backgroundTintList = ColorStateList.valueOf( backgroundTintList = ColorStateList.valueOf(

View File

@ -41,6 +41,15 @@ class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) :
else holder.bind(this, manga) else holder.bind(this, manga)
} }
override fun unbindViewHolder(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>?,
holder: MangaHeaderHolder?,
position: Int
) {
holder?.unbind()
super.unbindViewHolder(adapter, holder, position)
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
return (this === other) return (this === other)
} }