[Android] Player background fallback in UI thread

Geoffrey Métais git at videolan.org
Wed Mar 22 10:20:43 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 22 10:18:51 2017 +0100| [109b6643581d275bcb1463f1bc8b68b9531d6186] | committer: Geoffrey Métais

Player background fallback in UI thread

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 8ed0c15..d4da603 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -34,6 +34,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.preference.PreferenceManager;
+import android.support.annotation.MainThread;
 import android.support.annotation.Nullable;
 import android.support.annotation.RequiresPermission;
 import android.support.constraint.ConstraintSet;
@@ -311,8 +312,14 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
                                     mBinding.songsList.setBackgroundResource(0);
                                 }
                             });
-                        else
-                            setDefaultBackground();
+                        else {
+                            VLCApplication.runOnMainThread(new Runnable() {
+                                @Override
+                                public void run() {
+                                    setDefaultBackground();
+                                }
+                            });
+                        }
                     }
                 });
             }
@@ -322,6 +329,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
 
     }
 
+    @MainThread
     private void setDefaultBackground() {
         mBinding.songsList.setBackgroundResource(DEFAULT_BACKGROUND_ID);
         mBinding.backgroundView.setVisibility(View.INVISIBLE);



More information about the Android mailing list