This commit is contained in:
Jay 2020-05-04 15:50:39 -04:00
parent 10d6a04051
commit b16ffe020e
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
import com.google.android.material.appbar.MaterialToolbar
import eu.kanade.tachiyomi.util.view.gone
import kotlinx.android.synthetic.main.main_activity.view.*
class CenteredToolbar@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@ -13,6 +14,7 @@ class CenteredToolbar@JvmOverloads constructor(context: Context, attrs: Attribut
if (navigationIcon is DrawerArrowDrawable) {
super.setTitle(resId)
toolbar_title.text = null
dropdown?.gone()
} else {
toolbar_title.text = context.getString(resId)
super.setTitle(null)
@ -23,6 +25,7 @@ class CenteredToolbar@JvmOverloads constructor(context: Context, attrs: Attribut
if (navigationIcon is DrawerArrowDrawable) {
super.setTitle(title)
toolbar_title.text = ""
dropdown?.gone()
} else {
toolbar_title.text = title
super.setTitle(null)

View File

@ -518,6 +518,13 @@ class LibraryController(
}
}
override fun onChangeEnded(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeEnded(handler, type)
if (!type.isEnter) {
activity?.dropdown?.gone()
}
}
override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity)
if (view == null) return