Skip to content
Snippets Groups Projects
Commit 64d26653 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix snackbar position for audio player play queue

(cherry picked from commit b50471eb)
parent 9ff25f09
No related branches found
No related tags found
1 merge request!7943.3.x
......@@ -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)
......
......@@ -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()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment