mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-09-11 15:13:25 +02:00
Fixes to autohide bottomnav
This commit is contained in:
parent
d96f0518f2
commit
e5d15894dc
@ -209,7 +209,6 @@ class LibraryController(
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
val recyclerCover = recycler_cover ?: return
|
||||
val bottomBar = activity?.bottom_nav
|
||||
if (!recyclerCover.isClickable && isAnimatingHopper != true) {
|
||||
category_hopper_frame.translationY += dy
|
||||
category_hopper_frame.translationY =
|
||||
@ -231,23 +230,7 @@ class LibraryController(
|
||||
showCategoryText(currentCategory.name)
|
||||
}
|
||||
}
|
||||
if (bottomBar != null) {
|
||||
if (filter_bottom_sheet.sheetBehavior.isHidden()) {
|
||||
val pad = bottomBar.translationY - bottomBar.height
|
||||
filter_bottom_sheet.translationY = pad
|
||||
} else {
|
||||
filter_bottom_sheet.translationY = 0f
|
||||
}
|
||||
val pad = bottomBar.translationY - bottomBar.height
|
||||
shadow2.translationY = pad
|
||||
filter_bottom_sheet.updatePaddingRelative(
|
||||
bottom = max(
|
||||
(-bottomBar.translationY + bottomBar.height).toInt(),
|
||||
view?.rootWindowInsets?.getBottomGestureInsets() ?: 0
|
||||
)
|
||||
)
|
||||
filter_bottom_sheet.sheetBehavior?.peekHeight = 60.dpToPx + filter_bottom_sheet.paddingBottom
|
||||
}
|
||||
updateFilterSheetY()
|
||||
val savedCurrentCategory = getHeader(true)?.category ?: return
|
||||
if (savedCurrentCategory.order != lastUsedCategory) {
|
||||
lastUsedCategory = savedCurrentCategory.order
|
||||
@ -269,6 +252,30 @@ class LibraryController(
|
||||
}
|
||||
}
|
||||
|
||||
fun updateFilterSheetY() {
|
||||
val bottomBar = activity?.bottom_nav
|
||||
if (bottomBar != null) {
|
||||
if (filter_bottom_sheet.sheetBehavior.isHidden()) {
|
||||
val pad = bottomBar.translationY - bottomBar.height
|
||||
filter_bottom_sheet.translationY = pad
|
||||
} else {
|
||||
filter_bottom_sheet.translationY = 0f
|
||||
}
|
||||
val pad = bottomBar.translationY - bottomBar.height
|
||||
shadow2.translationY = pad
|
||||
filter_bottom_sheet.updatePaddingRelative(
|
||||
bottom = max(
|
||||
(-bottomBar.translationY + bottomBar.height).toInt(),
|
||||
view?.rootWindowInsets?.getBottomGestureInsets() ?: 0
|
||||
)
|
||||
)
|
||||
filter_bottom_sheet.sheetBehavior?.peekHeight = 60.dpToPx + filter_bottom_sheet.paddingBottom
|
||||
fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = -pad.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateHopperPosition(show: Boolean = false) {
|
||||
val shortAnimationDuration = resources?.getInteger(
|
||||
android.R.integer.config_shortAnimTime
|
||||
@ -354,6 +361,9 @@ class LibraryController(
|
||||
|
||||
adapter = LibraryCategoryAdapter(this)
|
||||
setRecyclerLayout()
|
||||
recycler.post {
|
||||
updateFilterSheetY()
|
||||
}
|
||||
|
||||
recycler.manager.spanSizeLookup = (
|
||||
object : GridLayoutManager.SpanSizeLookup() {
|
||||
|
@ -43,11 +43,13 @@ import eu.kanade.tachiyomi.util.view.requestPermissionsSafe
|
||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.extensions_bottom_sheet.*
|
||||
import kotlinx.android.synthetic.main.extensions_bottom_sheet.sheet_layout
|
||||
import kotlinx.android.synthetic.main.extensions_bottom_sheet.view.*
|
||||
import kotlinx.android.synthetic.main.filter_bottom_sheet.*
|
||||
import kotlinx.android.synthetic.main.library_list_controller.*
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
@ -224,6 +226,9 @@ class SourceController :
|
||||
val pad = bottomBar.translationY - bottomBar.height
|
||||
shadow2.translationY = pad
|
||||
ext_bottom_sheet.sheetBehavior?.peekHeight = 48.spToPx + ext_bottom_sheet.paddingBottom
|
||||
ext_bottom_sheet.fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = -pad.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showSheet() {
|
||||
|
Loading…
Reference in New Issue
Block a user