mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fix toolbar for tablets in compact mode
This commit is contained in:
parent
6a14859046
commit
cd59a1ffc0
1 changed files with 13 additions and 6 deletions
|
@ -107,7 +107,7 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
toolbarMode == ToolbarState.EXPANDED
|
||||
)
|
||||
|
||||
val preLayoutHeightWhileSearching: Int
|
||||
private val preLayoutHeightWhileSearching: Int
|
||||
get() = getEstimatedLayout(
|
||||
cardFrame?.isVisible == true && toolbarMode == ToolbarState.EXPANDED,
|
||||
useTabsInPreLayout,
|
||||
|
@ -115,6 +115,8 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
true
|
||||
)
|
||||
|
||||
private var dontFullyHideToolbar = false
|
||||
|
||||
/** Small toolbar height + top system insets, same size as a collapsed appbar */
|
||||
private val compactAppBarHeight: Float
|
||||
get() {
|
||||
|
@ -198,11 +200,15 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
override fun setTranslationY(translationY: Float) {
|
||||
if (lockYPos) return
|
||||
val realHeight = (preLayoutHeightWhileSearching + paddingTop).toFloat()
|
||||
val newY = MathUtils.clamp(
|
||||
val newY = if (dontFullyHideToolbar && !useLargeToolbar) {
|
||||
0f
|
||||
} else {
|
||||
MathUtils.clamp(
|
||||
translationY,
|
||||
-realHeight + (if (context.isTablet()) minTabletHeight else 0),
|
||||
if (compactSearchMode && toolbarMode == ToolbarState.EXPANDED) -realHeight + top + minTabletHeight else 0f
|
||||
)
|
||||
}
|
||||
super.setTranslationY(newY)
|
||||
}
|
||||
|
||||
|
@ -225,6 +231,7 @@ class ExpandedAppBarLayout@JvmOverloads constructor(context: Context, attrs: Att
|
|||
|
||||
private fun shrinkAppBarIfNeeded(config: Configuration?) {
|
||||
config ?: return
|
||||
dontFullyHideToolbar = config.smallestScreenWidthDp > 600
|
||||
isExtraSmall = false
|
||||
if (config.screenHeightDp < 600) {
|
||||
val bigTitleView = bigTitleView ?: return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue