mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fixes to search toolbar animation
This commit is contained in:
parent
931626d3b6
commit
828670d789
2 changed files with 5 additions and 25 deletions
|
@ -2,8 +2,6 @@ package eu.kanade.tachiyomi.ui.base
|
|||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewPropertyAnimator
|
||||
|
@ -357,7 +355,8 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
val realHeight = preLayoutHeightWhileSearching + paddingTop
|
||||
val closerToTop = abs(y) > realHeight - halfWay
|
||||
val atTop = !recyclerView.canScrollVertically(-1)
|
||||
val shortH = if (toolbarMode != ToolbarState.EXPANDED || compactSearchMode) 0f else compactAppBarHeight
|
||||
val shortH =
|
||||
if (toolbarMode != ToolbarState.EXPANDED || compactSearchMode) 0f else compactAppBarHeight
|
||||
val lastY = if (closerToTop && !atTop) {
|
||||
-height.toFloat()
|
||||
} else {
|
||||
|
@ -382,26 +381,6 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
}
|
||||
}
|
||||
|
||||
override fun setBackgroundColor(color: Int) {
|
||||
if (color != context.getResourceColor(R.attr.colorSurface)) {
|
||||
super.setBackgroundColor(color)
|
||||
}
|
||||
mainToolbar?.setBackgroundColor(color)
|
||||
bigView?.setBackgroundColor(color)
|
||||
cardFrame?.setBackgroundColor(color)
|
||||
tabsFrameLayout?.setBackgroundColor(color)
|
||||
}
|
||||
|
||||
override fun setBackground(background: Drawable?) {
|
||||
if (background == null || background is ColorDrawable) {
|
||||
super.setBackground(background)
|
||||
}
|
||||
mainToolbar?.background = background
|
||||
bigView?.background = background
|
||||
cardFrame?.background = background
|
||||
tabsFrameLayout?.background = background
|
||||
}
|
||||
|
||||
fun useSearchToolbarForMenu(showCardTB: Boolean) {
|
||||
val mainActivity = mainActivity ?: return
|
||||
if (lockYPos) return
|
||||
|
|
|
@ -525,7 +525,8 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
val showSearchBar = (show || showSearchAnyway) && onSearchController
|
||||
val needsAnim = if (showSearchBar) !binding.cardFrame.isVisible || binding.cardFrame.alpha < 1f
|
||||
else binding.cardFrame.isVisible || binding.cardFrame.alpha > 0f
|
||||
if (needsAnim && binding.appBar.useLargeToolbar) {
|
||||
if (needsAnim && binding.appBar.useLargeToolbar && !onSmallerController) {
|
||||
binding.appBar.background = null
|
||||
searchBarAnimation?.cancel()
|
||||
if (showSearchBar && !binding.cardFrame.isVisible) {
|
||||
binding.cardFrame.alpha = 0f
|
||||
|
@ -538,7 +539,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
tA.duration = (abs(binding.cardFrame.alpha - endValue) * 150).roundToLong()
|
||||
searchBarAnimation = tA
|
||||
tA.start()
|
||||
} else if (!binding.appBar.useLargeToolbar) {
|
||||
} else if (!binding.appBar.useLargeToolbar || onSmallerController) {
|
||||
binding.cardFrame.alpha = 1f
|
||||
binding.cardFrame.isVisible = showSearchBar
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue