fixed missing search bar on library

very specific use case of " in landscape, go to a tab, come back to library tab, rotate to portrait"
This commit is contained in:
Jays2Kings 2022-04-27 16:37:54 -04:00
parent c99ea17249
commit 9cea16a34e
2 changed files with 5 additions and 3 deletions

View file

@ -283,7 +283,7 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
val smallHeight = -realHeight + shortH + tabHeight
val newY = when {
// for smaller devices, when search is active, we want to shrink the app bar and never
// extend it pass the compact state
// extend it pass the compact state
toolbarMode == ToolbarState.EXPANDED && compactSearchMode -> {
MathUtils.clamp(
translationY,

View file

@ -526,7 +526,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
val isAppBarVisible = binding.appBar.isVisible
val needsAnim = if (showSearchBar) !binding.cardFrame.isVisible || binding.cardFrame.alpha < 1f
else binding.cardFrame.isVisible || binding.cardFrame.alpha > 0f
if (needsAnim && binding.appBar.useLargeToolbar && !onSmallerController &&
if (this::router.isInitialized && needsAnim && binding.appBar.useLargeToolbar && !onSmallerController &&
(showSearchAnyway || isAppBarVisible)
) {
binding.appBar.background = null
@ -542,7 +542,9 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
tA.duration = (abs(binding.cardFrame.alpha - endValue) * 150).roundToLong()
searchBarAnimation = tA
tA.start()
} else if (!binding.appBar.useLargeToolbar || onSmallerController || !isAppBarVisible) {
} else if (this::router.isInitialized &&
(!binding.appBar.useLargeToolbar || onSmallerController || !isAppBarVisible)
) {
binding.cardFrame.alpha = 1f
binding.cardFrame.isVisible = showSearchBar
}