[Android] Fix audio player bottom margin upon orientation change

Nicolas Pomepuy git at videolan.org
Fri May 6 09:38:22 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Apr 28 14:55:49 2022 +0200| [f3e8c6a9f3d65db9c903276e50c41f529f37b5b8] | committer: Duncan McNamara

Fix audio player bottom margin upon orientation change

Fixes #2501

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

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt            | 1 +
 application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt   | 2 +-
 2 files changed, 2 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 3262660d1..d6ab31b1c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -159,6 +159,7 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener {
                     bottomInset = insets.bottom
                     setContentBottomPadding()
                     insetListener.invoke(insets)
+                    if (::audioPlayer.isInitialized) audioPlayer.setBottomMargin()
                 }
             }
 
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 48b2f631f..6484d41f2 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
@@ -238,7 +238,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
     fun setBottomMargin() {
         (binding.playPause.layoutParams as? ConstraintLayout.LayoutParams)?.let {
             val audioPlayerContainerActivity = (requireActivity() as AudioPlayerContainerActivity)
-            if (audioPlayerContainerActivity is MainActivity && !audioPlayerContainerActivity.isTablet()) it.bottomMargin = it.bottomMargin + audioPlayerContainerActivity.bottomInset
+            if (audioPlayerContainerActivity is MainActivity && !audioPlayerContainerActivity.isTablet()) it.bottomMargin = 8.dp + audioPlayerContainerActivity.bottomInset
         }
     }
 



More information about the Android mailing list