[Android] Do not store browsers content at root level

Geoffrey Métais git at videolan.org
Wed Feb 7 11:57:33 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb  7 11:57:02 2018 +0100| [d4307d5ed0c964d2b4f82b4b2cfec62da4c87204] | committer: Geoffrey Métais

Do not store browsers content at root level

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

 .../videolan/vlc/gui/browser/BaseBrowserFragment.java    | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 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 ee03ec4cc..3d8cee548 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -201,11 +201,9 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         if (content != null)
             mFoldersContentLists = content;
         @SuppressWarnings("unchecked")
-        final List<MediaLibraryItem> mediaList = (List<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST + mMrl);
-        if (!Util.isListEmpty(mediaList))
-            mAdapter.update(mediaList);
-        else
-            mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_REFRESH);
+        final List<MediaLibraryItem> mediaList = mRoot ? null : (List<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST + mMrl);
+        if (!Util.isListEmpty(mediaList)) mAdapter.update(mediaList);
+        else mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_REFRESH);
     }
 
     @Override
@@ -245,11 +243,9 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     public void onSaveInstanceState(Bundle outState){
         outState.putString(KEY_MRL, mMrl);
         outState.putParcelable(KEY_MEDIA, mCurrentMedia);
-        if (mAdapter != null)
-            VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
+        if (!mRoot && mAdapter != null) VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
         VLCApplication.storeData(KEY_CONTENT_LIST+mMrl, mFoldersContentLists);
-        if (mRecyclerView != null)
-            outState.putInt(KEY_POSITION, mLayoutManager.findFirstCompletelyVisibleItemPosition());
+        if (mRecyclerView != null) outState.putInt(KEY_POSITION, mLayoutManager.findFirstCompletelyVisibleItemPosition());
         super.onSaveInstanceState(outState);
     }
 
@@ -293,7 +289,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         final FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
         final Fragment next = createFragment();
         final Bundle args = new Bundle();
-        VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
+        if (!mRoot) VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
         VLCApplication.storeData(KEY_CONTENT_LIST+ mMrl, mFoldersContentLists);
         final List<MediaLibraryItem> list = mFoldersContentLists.get(media);
         if (!Util.isListEmpty(list) && !(this instanceof StorageBrowserFragment))



More information about the Android mailing list