[Android] Fix fast browsing with preparsed elements

Geoffrey Métais git at videolan.org
Mon Dec 5 16:43:33 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  5 16:42:10 2016 +0100| [b428dc18c0ec6d74b559dba06e5233ad77c21be7] | committer: Geoffrey Métais

Fix fast browsing with preparsed elements

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 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 8d3e714..fd21839 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -112,7 +112,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         mAdapter = new BaseBrowserAdapter(this);
     }
 
-    public void onCreate(Bundle bundle){
+    public void onCreate(Bundle bundle) {
         super.onCreate(bundle);
 
         if (bundle == null)
@@ -162,6 +162,11 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         mFAB = (FloatingActionButton) getActivity().findViewById(R.id.fab);
         if (mFAB != null)
             mFAB.setImageResource(R.drawable.ic_fab_play);
+        if (!mAdapter.isEmpty()) {
+            updateEmptyView();
+            mAdapter.notifyItemRangeInserted(0, mAdapter.getItemCount());
+            parseSubDirectories();
+        }
     }
 
     @Override
@@ -285,7 +290,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
     /**
      * Update views visibility and emptiness info
      */
-    protected void updateEmptyView(){
+    protected void updateEmptyView() {
         if (mAdapter.isEmpty()){
             if (mSwipeRefreshLayout.isRefreshing()) {
                 mEmptyView.setText(R.string.loading);



More information about the Android mailing list