[Android] Don't share handler between browser framgents

Geoffrey Métais git at videolan.org
Mon Mar 20 14:54:48 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 20 14:34:51 2017 +0100| [c30a7be71a4a0225044483e35a48e786a2839b07] | committer: Geoffrey Métais

Don't share handler between browser framgents

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

 .../org/videolan/vlc/gui/browser/BaseBrowserFragment.java  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 1d8658c..49825fc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -111,19 +111,19 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
     protected abstract void browseRoot();
     protected abstract String getCategoryTitle();
 
-    private static Handler sBrowserHandler;
+    private Handler mBrowserHandler;
 
     protected void runOnBrowserThread(Runnable runnable) {
-        sBrowserHandler.post(runnable);
+        mBrowserHandler.post(runnable);
     }
 
     public BaseBrowserFragment(){
         mHandler = new BrowserFragmentHandler(this);
         mAdapter = new BaseBrowserAdapter(this);
-        if (sBrowserHandler == null) {
+        if (mBrowserHandler == null) {
             HandlerThread handlerThread = new HandlerThread("vlc-browser", Process.THREAD_PRIORITY_DEFAULT+Process.THREAD_PRIORITY_LESS_FAVORABLE);
             handlerThread.start();
-            sBrowserHandler = new Handler(handlerThread.getLooper());
+            mBrowserHandler = new Handler(handlerThread.getLooper());
         }
     }
 
@@ -255,7 +255,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
     }
 
     public void browse (MediaWrapper media, int position, boolean save) {
-        sBrowserHandler.removeCallbacksAndMessages(null);
+        mBrowserHandler.removeCallbacksAndMessages(null);
         FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
         Fragment next = createFragment();
         Bundle args = new Bundle();
@@ -342,7 +342,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
 
     @Override
     public void refresh() {
-        sBrowserHandler.removeCallbacksAndMessages(null);
+        mBrowserHandler.removeCallbacksAndMessages(null);
         mHandler.sendEmptyMessageDelayed(BrowserFragmentHandler.MSG_SHOW_LOADING, 300);
         mAdapter.clear();
         runOnBrowserThread(new Runnable() {
@@ -366,7 +366,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
 
     protected void initMediaBrowser(MediaBrowser.EventListener listener) {
         if (mMediaBrowser == null)
-            mMediaBrowser = new MediaBrowser(VLCInstance.get(), listener, sBrowserHandler);
+            mMediaBrowser = new MediaBrowser(VLCInstance.get(), listener, mBrowserHandler);
         else
             mMediaBrowser.changeEventListener(listener);
     }



More information about the Android mailing list