[Android] AUdioBrowser: Get settings with current context
Geoffrey Métais
git at videolan.org
Wed May 30 09:43:20 CEST 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 30 09:35:14 2018 +0200| [de5066a88e716e1779fb473078b410a78533a627] | committer: Geoffrey Métais
AUdioBrowser: Get settings with current context
> https://code.videolan.org/videolan/vlc-android/commit/de5066a88e716e1779fb473078b410a78533a627
---
.../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 13f8410d2..756a75ecb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -88,6 +88,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
private TextView mEmptyView;
private final ContextMenuRecyclerView[] mLists = new ContextMenuRecyclerView[MODE_TOTAL];
private FastScroller mFastScroller;
+ private SharedPreferences mSettings;
private static final int REFRESH = 101;
private static final int UPDATE_LIST = 102;
@@ -107,6 +108,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Resources res = getResources();
+ mSettings = PreferenceManager.getDefaultSharedPreferences(getActivity());
mSongsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_MEDIA, this, true, res);
mArtistsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_ARTIST, this, true, res);
mAlbumsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_ALBUM, this, true, res);
@@ -435,7 +437,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
public void onTabSelected(TabLayout.Tab tab) {
getActivity().supportInvalidateOptionsMenu();
mFastScroller.setRecyclerView(mLists[tab.getPosition()]);
- VLCApplication.getSettings().edit().putInt(Constants.KEY_AUDIO_CURRENT_TAB, tab.getPosition()).apply();
+ mSettings.edit().putInt(Constants.KEY_AUDIO_CURRENT_TAB, tab.getPosition()).apply();
}
@Override
@@ -607,7 +609,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
- final List<MediaLibraryItem> artists = Util.arrayToMediaArrayList(mMediaLibrary.getArtists(VLCApplication.getSettings().getBoolean(Constants.KEY_ARTISTS_SHOW_ALL, false)));
+ final List<MediaLibraryItem> artists = Util.arrayToMediaArrayList(mMediaLibrary.getArtists(mSettings.getBoolean(Constants.KEY_ARTISTS_SHOW_ALL, false)));
VLCApplication.runOnMainThread(new Runnable() {
@Override
public void run() {
More information about the Android
mailing list