[Android] MiniPlayer: fix medialib progress after stop player

Duncan McNamara git at videolan.org
Thu Feb 10 08:49:09 UTC 2022


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Feb  9 18:36:02 2022 +0100| [80c4ad2ce99032ebf0b6ac293b24da96a50a4093] | committer: Nicolas Pomepuy

MiniPlayer: fix medialib progress after stop player

Fixes #2371

> https://code.videolan.org/videolan/vlc-android/commit/80c4ad2ce99032ebf0b6ac293b24da96a50a4093
---

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt       | 7 ++++++-
 .../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt      | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
index a046f8892..d4aaf6796 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -201,6 +201,7 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener {
                 audioPlayer.onStateChanged(newState)
                 if (newState == STATE_COLLAPSED || newState == STATE_HIDDEN) removeTipViewIfDisplayed()
                 updateFragmentMargins(newState)
+                applyMarginToProgressBar(playerBehavior.peekHeight)
             }
         })
         showTipViewIfNeeded(R.id.audio_player_tips, PREF_AUDIOPLAYER_TIPS_SHOWN)
@@ -469,10 +470,14 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener {
         scanProgressText?.text = discovery
     }
 
+    fun closeMiniPlayer() {
+        hideAudioPlayerImpl()
+    }
+
     private fun applyMarginToProgressBar(marginValue: Int) {
         if (scanProgressLayout != null && scanProgressLayout?.visibility == View.VISIBLE) {
             val lp = scanProgressLayout!!.layoutParams as CoordinatorLayout.LayoutParams
-            lp.bottomMargin = marginValue
+            lp.bottomMargin = if (playerShown) marginValue else 0
             scanProgressLayout?.layoutParams = lp
         }
     }
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index f4e364774..394314416 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -509,6 +509,8 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
 
     fun onStopClick(view: View?): Boolean {
         playlistModel.stop()
+        if (activity is AudioPlayerContainerActivity)
+            (activity as AudioPlayerContainerActivity).closeMiniPlayer()
         return true
     }
 



More information about the Android mailing list