[Android] Don't stack toast error messages

Geoffrey Métais git at videolan.org
Tue Feb 5 13:48:20 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb  5 13:47:38 2019 +0100| [9f9de4604e9eff104a6297c901bf8c8fb777560d] | committer: Geoffrey Métais

Don't stack toast error messages

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

 vlc-android/src/org/videolan/vlc/PlaybackService.kt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 424fada3d..44a76d525 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -953,13 +953,14 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
     }
 
     fun showToast(text: String, duration: Int) {
-        val msg = Message().apply {
+        val msg = handler.obtainMessage().apply {
             what = SHOW_TOAST
             data = Bundle(2).apply {
                 putString("text", text)
                 putInt("duration", duration)
             }
         }
+        handler.removeMessages(SHOW_TOAST)
         handler.sendMessage(msg)
     }
 



More information about the Android mailing list