[Android] Fix snackbar position for audio player play queue
Nicolas Pomepuy
git at videolan.org
Thu Nov 5 11:45:33 CET 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Nov 5 09:55:07 2020 +0100| [b50471ebab0e3afa843a3e675e0add88d7428741] | committer: Nicolas Pomepuy
Fix snackbar position for audio player play queue
> https://code.videolan.org/videolan/vlc-android/commit/b50471ebab0e3afa843a3e675e0add88d7428741
---
application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 3 ++-
.../vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.kt | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
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 82594aa89..be01e3466 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
@@ -21,6 +21,7 @@
package org.videolan.vlc.gui.audio
import android.Manifest
+import android.app.Activity
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
@@ -203,7 +204,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
val mw = playlistAdapter.getItem(position)
val cancelAction = Runnable { playlistModel.insertMedia(position, mw) }
val message = String.format(getString(R.string.remove_playlist_item), mw.title)
- UiTools.snackerWithCancel(it, message, null, cancelAction)
+ UiTools.snackerWithCancel((it.context as Activity).findViewById(android.R.id.content), message, null, cancelAction)
playlistModel.remove(position)
}
CTX_STOP_AFTER_THIS -> playlistModel.stopAfter(position)
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 179ee2b5c..362195f61 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
@@ -177,9 +177,8 @@ 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) {
- val v = (player as Fragment).view
val cancelAction = Runnable { model?.run { insertMedia(position, media) } }
- UiTools.snackerWithCancel(v!!, message, null, cancelAction)
+ UiTools.snackerWithCancel(player.requireActivity().findViewById(android.R.id.content), message, null, cancelAction)
} else if (player is Context) {
Toast.makeText(AppContextProvider.appContext, message, Toast.LENGTH_SHORT).show()
}
More information about the Android
mailing list