[Android] Browsers: init preferences with correct context

Geoffrey Métais git at videolan.org
Wed Apr 4 11:27:32 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr  3 10:18:56 2018 +0200| [89e755fdf8c29162681c55ac719ab2a510960e24] | committer: Geoffrey Métais

Browsers: init preferences with correct context

(cherry picked from commit 54e4a066933cb87261a950705a74b110cb5fc68d)

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java      | 7 +++----
 1 file changed, 3 insertions(+), 4 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 5ac112efa..bf1e1995f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -107,7 +107,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     protected int mSavedPosition = -1, mFavorites = 0;
     public boolean mRoot;
     protected boolean goBack = false;
-    private final boolean mShowHiddenFiles;
+    private boolean mShowHiddenFiles;
 
     private SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>> mFoldersContentLists;
     public int mCurrentParsedPosition = 0;
@@ -132,14 +132,12 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
             handlerThread.start();
             mBrowserHandler = new Handler(handlerThread.getLooper());
         }
-        mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("browser_show_hidden_files", false);
     }
 
     @SuppressWarnings("unchecked")
     public void onCreate(Bundle bundle) {
         super.onCreate(bundle);
-        if (bundle == null)
-            bundle = getArguments();
+        if (bundle == null) bundle = getArguments();
         if (bundle != null) {
             mCurrentMedia = bundle.getParcelable(KEY_MEDIA);
             if (mCurrentMedia != null) mMrl = mCurrentMedia.getLocation();
@@ -149,6 +147,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
             mMrl = getActivity().getIntent().getDataString();
             getActivity().setIntent(null);
         }
+        mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("browser_show_hidden_files", false);
         mRoot = defineIsRoot();
         if (mFoldersContentLists == null) mFoldersContentLists = new SimpleArrayMap<>();
     }



More information about the Android mailing list