[Bottom Navigation] Fixed bottom navigation visible in Playing Queue

This commit is contained in:
Prathamesh More 2021-12-06 14:10:05 +05:30
parent 9af80592b3
commit b0800504e4
2 changed files with 6 additions and 6 deletions

View file

@ -109,8 +109,7 @@ class MainActivity : AbsCastActivity(), OnSharedPreferenceChangeListener {
setBottomNavVisibility(visible = true, animate = true) setBottomNavVisibility(visible = true, animate = true)
} }
R.id.playing_queue_fragment -> { R.id.playing_queue_fragment -> {
setBottomNavVisibility(visible = false) setBottomNavVisibility(visible = false, hideBottomSheet = true)
hideBottomSheet(true)
} }
else -> setBottomNavVisibility( else -> setBottomNavVisibility(
visible = false, visible = false,

View file

@ -92,7 +92,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
when (newState) { when (newState) {
STATE_EXPANDED -> { STATE_EXPANDED -> {
onPanelExpanded() onPanelExpanded()
} }
STATE_COLLAPSED -> { STATE_COLLAPSED -> {
onPanelCollapsed() onPanelCollapsed()
@ -316,10 +315,11 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
}) })
} }
fun setBottomNavVisibility(visible: Boolean, animate: Boolean = false) { fun setBottomNavVisibility(visible: Boolean, animate: Boolean = false, hideBottomSheet: Boolean = MusicPlayerRemote.playingQueue.isEmpty()) {
val translationY = val translationY =
if (visible) 0F else dip(R.dimen.bottom_nav_height).toFloat() + windowInsets.safeGetBottomInsets() if (visible) 0F else dip(R.dimen.bottom_nav_height).toFloat() + windowInsets.safeGetBottomInsets()
if (animate) { val mAnimate = animate && bottomSheetBehavior.state == STATE_COLLAPSED
if (mAnimate) {
binding.bottomNavigationView.translateYAnimate(translationY).doOnEnd { binding.bottomNavigationView.translateYAnimate(translationY).doOnEnd {
if (visible && bottomSheetBehavior.state != STATE_EXPANDED) { if (visible && bottomSheetBehavior.state != STATE_EXPANDED) {
binding.bottomNavigationView.bringToFront() binding.bottomNavigationView.bringToFront()
@ -328,12 +328,13 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
} else { } else {
binding.bottomNavigationView.translationY = binding.bottomNavigationView.translationY =
translationY translationY
binding.bottomNavigationView.isVisible = false
if (visible && bottomSheetBehavior.state != STATE_EXPANDED) { if (visible && bottomSheetBehavior.state != STATE_EXPANDED) {
binding.bottomNavigationView.bringToFront() binding.bottomNavigationView.bringToFront()
} }
} }
hideBottomSheet( hideBottomSheet(
hide = MusicPlayerRemote.playingQueue.isEmpty(), hide = hideBottomSheet,
animate = animate, animate = animate,
isBottomNavVisible = visible isBottomNavVisible = visible
) )