[Android] AudioPlayer: snackbars are now shown on top of the time

Nicolas Pomepuy git at videolan.org
Mon Feb 14 07:17:16 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Feb 11 08:23:04 2022 +0100| [f6019a19bf0da515d1765153ca70f97ba2c2ce4a] | committer: Nicolas Pomepuy

AudioPlayer: snackbars are now shown on top of the time

Fixes #2383

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

 .../vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt      | 2 +-
 application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt    | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
index 5bdd10aec..4bf690743 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt
@@ -186,7 +186,7 @@ class PlaylistAdapter(private val player: IPlayer) : DiffUtilAdapter<MediaWrappe
         val media = getItem(position)
         val message = String.format(AppContextProvider.appResources.getString(R.string.remove_playlist_item), media.title)
         if (player is Fragment) {
-            UiTools.snackerWithCancel(player.requireActivity(), message, action = {}) {
+            UiTools.snackerWithCancel(player.requireActivity(), message, overAudioPlayer = true, action = {}) {
                  model?.run { insertMedia(position, media) }
             }
         } else if (player is Context) {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
index 0f2e3d172..8fea32592 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
@@ -229,6 +229,7 @@ object UiTools {
     fun snacker(activity: Activity, stringId: Int, overAudioPlayer: Boolean = false) {
         val view = getSnackAnchorView(activity, overAudioPlayer) ?: return
         val snack = Snackbar.make(view, stringId, Snackbar.LENGTH_SHORT)
+        if (overAudioPlayer) snack.setAnchorView(R.id.time)
         snack.show()
     }
 
@@ -252,6 +253,7 @@ object UiTools {
         val view = getSnackAnchorView(activity, overAudioPlayer) ?: return
         val snack = Snackbar.make(view, message, Snackbar.LENGTH_LONG)
                 .setAction(confirmMessage) { action.invoke() }
+        if (overAudioPlayer) snack.setAnchorView(R.id.time)
         if (AndroidUtil.isLolliPopOrLater)
             snack.view.elevation = view.resources.getDimensionPixelSize(R.dimen.audio_player_elevation).toFloat()
         snack.show()
@@ -281,6 +283,7 @@ object UiTools {
                 }
         if (AndroidUtil.isLolliPopOrLater)
             snack.view.elevation = view.resources.getDimensionPixelSize(R.dimen.audio_player_elevation).toFloat()
+        if (overAudioPlayer) snack.setAnchorView(R.id.time)
         snack.show()
         sHandler.postDelayed(action, DELETE_DURATION.toLong())
     }



More information about the Android mailing list