Fix glitchy animation when first showing reader nav bar

This commit is contained in:
Jays2Kings 2021-04-05 21:55:24 -04:00
parent 6edc15683e
commit 2637bcffa5
2 changed files with 6 additions and 4 deletions

View File

@ -71,11 +71,13 @@ import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.hide import eu.kanade.tachiyomi.util.view.hide
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.isCollapsed import eu.kanade.tachiyomi.util.view.isCollapsed
import eu.kanade.tachiyomi.util.view.isExpanded import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.visInvisIf
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleAnimationListener
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
@ -234,9 +236,9 @@ class ReaderActivity :
lastShiftDoubleState = savedInstanceState.get(SHIFT_DOUBLE_PAGES) as? Boolean lastShiftDoubleState = savedInstanceState.get(SHIFT_DOUBLE_PAGES) as? Boolean
indexPageToShift = savedInstanceState.get(SHIFTED_PAGE_INDEX) as? Int indexPageToShift = savedInstanceState.get(SHIFTED_PAGE_INDEX) as? Int
indexChapterToShift = savedInstanceState.get(SHIFTED_CHAP_INDEX) as? Long indexChapterToShift = savedInstanceState.get(SHIFTED_CHAP_INDEX) as? Long
binding.readerNav.root.isVisible = menuVisible binding.readerNav.root.visInvisIf(menuVisible)
} else { } else {
binding.readerNav.root.gone() binding.readerNav.root.invisible()
} }
binding.chaptersSheet.chaptersBottomSheet.setup(this) binding.chaptersSheet.chaptersBottomSheet.setup(this)

View File

@ -109,14 +109,14 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
activity.binding.readerNav.root.visible() activity.binding.readerNav.root.visible()
} }
if (state == BottomSheetBehavior.STATE_EXPANDED) { if (state == BottomSheetBehavior.STATE_EXPANDED) {
activity.binding.readerNav.root.gone() activity.binding.readerNav.root.invisible()
activity.binding.readerNav.root.alpha = 0f activity.binding.readerNav.root.alpha = 0f
binding.chapterRecycler.alpha = 1f binding.chapterRecycler.alpha = 1f
if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary
} }
if (state == BottomSheetBehavior.STATE_HIDDEN) { if (state == BottomSheetBehavior.STATE_HIDDEN) {
activity.binding.readerNav.root.alpha = 0f activity.binding.readerNav.root.alpha = 0f
activity.binding.readerNav.root.gone() activity.binding.readerNav.root.invisible()
} }
binding.chapterRecycler.isClickable = state == BottomSheetBehavior.STATE_EXPANDED binding.chapterRecycler.isClickable = state == BottomSheetBehavior.STATE_EXPANDED
binding.chapterRecycler.isFocusable = state == BottomSheetBehavior.STATE_EXPANDED binding.chapterRecycler.isFocusable = state == BottomSheetBehavior.STATE_EXPANDED