Fixed mini player becoming visible while collapsing BottomSheet
This commit is contained in:
parent
4d6f75031a
commit
61074305ec
3 changed files with 18 additions and 7 deletions
|
@ -163,12 +163,10 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
||||||
|
|
||||||
fun collapsePanel() {
|
fun collapsePanel() {
|
||||||
bottomSheetBehavior.state = STATE_COLLAPSED
|
bottomSheetBehavior.state = STATE_COLLAPSED
|
||||||
setMiniPlayerAlphaProgress(0f)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expandPanel() {
|
fun expandPanel() {
|
||||||
bottomSheetBehavior.state = STATE_EXPANDED
|
bottomSheetBehavior.state = STATE_EXPANDED
|
||||||
setMiniPlayerAlphaProgress(1f)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setMiniPlayerAlphaProgress(progress: Float) {
|
private fun setMiniPlayerAlphaProgress(progress: Float) {
|
||||||
|
@ -315,6 +313,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
||||||
libraryViewModel.setFabMargin(heightOfBar - RetroUtil.getNavigationBarHeight())
|
libraryViewModel.setFabMargin(heightOfBar - RetroUtil.getNavigationBarHeight())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bottomSheetBehavior.setAllowDragging(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.core.view.ViewCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import androidx.transition.Fade
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
|
@ -90,6 +91,8 @@ class LyricsFragment : AbsMusicServiceFragment(R.layout.fragment_lyrics) {
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
enterTransition = Fade()
|
||||||
|
exitTransition = Fade()
|
||||||
lyricsSectionsAdapter = LyricsSectionsAdapter(requireActivity())
|
lyricsSectionsAdapter = LyricsSectionsAdapter(requireActivity())
|
||||||
_binding = FragmentLyricsBinding.bind(view)
|
_binding = FragmentLyricsBinding.bind(view)
|
||||||
ViewCompat.setTransitionName(binding.container, "lyrics")
|
ViewCompat.setTransitionName(binding.container, "lyrics")
|
||||||
|
|
|
@ -25,6 +25,7 @@ import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.*
|
import code.name.monkey.retromusic.activities.*
|
||||||
import code.name.monkey.retromusic.activities.bugreport.BugReportActivity
|
import code.name.monkey.retromusic.activities.bugreport.BugReportActivity
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.audioSessionId
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote.audioSessionId
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
|
|
||||||
object NavigationUtil {
|
object NavigationUtil {
|
||||||
fun bugReport(activity: Activity) {
|
fun bugReport(activity: Activity) {
|
||||||
|
@ -40,10 +41,18 @@ object NavigationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goToLyrics(activity: Activity) {
|
fun goToLyrics(activity: Activity) {
|
||||||
if (activity is MainActivity) {
|
if (activity !is MainActivity) return
|
||||||
activity.collapsePanel()
|
activity.apply {
|
||||||
|
//Hide Bottom Bar First, else Bottom Sheet doesn't collapse fully
|
||||||
|
setBottomBarVisibility(false)
|
||||||
|
if (getBottomSheetBehavior().state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
|
collapsePanel()
|
||||||
|
}
|
||||||
|
|
||||||
|
findNavController(R.id.fragment_container).navigate(
|
||||||
|
R.id.lyrics_fragment
|
||||||
|
)
|
||||||
}
|
}
|
||||||
activity.findNavController(R.id.fragment_container).navigate(R.id.lyrics_fragment)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goToProVersion(context: Context) {
|
fun goToProVersion(context: Context) {
|
||||||
|
@ -69,10 +78,10 @@ object NavigationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openEqualizer(activity: Activity) {
|
fun openEqualizer(activity: Activity) {
|
||||||
stockEqalizer(activity)
|
stockEqualizer(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stockEqalizer(activity: Activity) {
|
private fun stockEqualizer(activity: Activity) {
|
||||||
val sessionId = audioSessionId
|
val sessionId = audioSessionId
|
||||||
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
|
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
|
|
Loading…
Reference in a new issue