[Android] Fix Chromecast switch on Android P

Geoffrey Métais git at videolan.org
Fri May 18 16:39:31 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 18 15:49:26 2018 +0200| [ba7b53fd593164ee5e278ec931f445dd01a5ca74] | committer: Geoffrey Métais

Fix Chromecast switch on Android P

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

 vlc-android/src/org/videolan/vlc/PlaybackService.kt             | 3 ++-
 vlc-android/src/org/videolan/vlc/gui/dialogs/RenderersDialog.kt | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 62d9cf158..0370a68a7 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -70,6 +70,8 @@ import org.videolan.vlc.widget.VLCAppWidgetProviderBlack
 import org.videolan.vlc.widget.VLCAppWidgetProviderWhite
 import java.util.*
 
+private const val TAG = "VLC/PlaybackService"
+
 class PlaybackService : MediaBrowserServiceCompat() {
 
     lateinit var playlistManager: PlaylistManager
@@ -1301,7 +1303,6 @@ class PlaybackService : MediaBrowserServiceCompat() {
 
     companion object {
 
-        private const val TAG = "VLC/PlaybackService"
 
         private const val SHOW_TOAST = 1
         private const val END_MEDIASESSION = 2
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/RenderersDialog.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/RenderersDialog.kt
index 16d232373..1b924aa41 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/RenderersDialog.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/RenderersDialog.kt
@@ -126,12 +126,12 @@ class RenderersDialog : DialogFragment(), PlaybackService.Client.Callback {
 
     inner class RendererClickhandler {
         fun connect(item: RendererItem?) {
-            RendererDelegate.selectRenderer(item)
             mService?.setRenderer(item)
+            dismissAllowingStateLoss()
+            RendererDelegate.selectRenderer(item)
             if (item !== null) activity?.window?.findViewById<View>(R.id.audio_player_container)?.let {
                 UiTools.snacker(it, getString(R.string.casting_connected_renderer, item.displayName))
             }
-            dismiss()
         }
     }
 }



More information about the Android mailing list