[Android] Fix content restoration in browser fragments
Geoffrey Métais
git at videolan.org
Wed Jul 12 15:06:24 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul 12 15:05:00 2017 +0200| [3781e65868346881d7d8ccc7947a6342cb5c0dec] | committer: Geoffrey Métais
Fix content restoration in browser fragments
> https://code.videolan.org/videolan/vlc-android/commit/3781e65868346881d7d8ccc7947a6342cb5c0dec
---
.../org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 12 +++++-------
1 file changed, 5 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 f9394c9b4..352b21711 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -138,15 +138,16 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("browser_show_hidden_files", false);
}
+ @SuppressWarnings("unchecked")
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
- ArrayList<ArrayList<MediaLibraryItem>> foldersContent = null;
if (bundle == null)
bundle = getArguments();
- else
- foldersContent = (ArrayList<ArrayList<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST);
if (bundle != null) {
- mediaList = (ArrayList<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST);
+ if (VLCApplication.hasData(KEY_CONTENT_LIST))
+ mFoldersContentLists = (SimpleArrayMap<MediaLibraryItem, ArrayList<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST);
+ if (VLCApplication.hasData(KEY_MEDIA_LIST))
+ mediaList = (ArrayList<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST);
mCurrentMedia = bundle.getParcelable(KEY_MEDIA);
if (mCurrentMedia != null)
mMrl = mCurrentMedia.getLocation();
@@ -157,9 +158,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mMrl = getActivity().getIntent().getDataString();
getActivity().setIntent(null);
}
- if (!Util.isListEmpty(foldersContent))
- for (int i = 0; i<mediaList.size(); i++)
- mFoldersContentLists.put(mediaList.get(i), foldersContent.get(i));
}
protected int getLayoutId(){
More information about the Android
mailing list