[Android] Use app UI thread handler instead of creating one

Geoffrey Métais git at videolan.org
Tue Jun 13 15:00:58 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 13 10:52:33 2017 +0200| [0744a721b533d1dd57288c6ba25065cf4e31965b] | committer: Geoffrey Métais

Use app UI thread handler instead of creating one

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

 vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
index 4c2f817c0..8a974e679 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
@@ -30,8 +30,6 @@ import android.databinding.ViewDataBinding;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.net.Uri;
-import android.os.Handler;
-import android.os.Looper;
 import android.support.v4.view.ViewCompat;
 import android.text.TextUtils;
 import android.view.View;
@@ -55,7 +53,6 @@ public class AsyncImageLoader {
     }
 
     public final static String TAG = "VLC/AsyncImageLoader";
-    private static final Handler sHandler = new Handler(Looper.getMainLooper());
 
     public static final Bitmap DEFAULT_COVER_VIDEO = BitmapCache.getFromResource(VLCApplication.getAppResources(), R.drawable.ic_no_thumbnail_1610);
     public static final BitmapDrawable DEFAULT_COVER_VIDEO_DRAWABLE = new BitmapDrawable(VLCApplication.getAppResources(), DEFAULT_COVER_VIDEO);
@@ -158,7 +155,7 @@ public class AsyncImageLoader {
             vdb.setVariable(BR.cover, new BitmapDrawable(VLCApplication.getAppResources(), bitmap));
             vdb.setVariable(BR.protocol, null);
         } else {
-            sHandler.post(new Runnable() {
+            VLCApplication.runOnMainThread(new Runnable() {
                 @Override
                 public void run() {
                     if (target instanceof ImageView) {



More information about the Android mailing list