[Android] Browser: refresh once fragment is ready

Geoffrey Métais git at videolan.org
Wed Jan 31 15:36:50 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 31 15:23:44 2018 +0100| [a558ef986dff506e103c8873dc9dd02efcf42ea5] | committer: Geoffrey Métais

Browser: refresh once fragment is ready

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 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 4cb0a4d38..6bcb6c621 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -205,7 +205,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         if (!Util.isListEmpty(mediaList))
             mAdapter.update(mediaList);
         else
-            refresh();
+            mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_REFRESH);
     }
 
     @Override
@@ -457,8 +457,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         @Override
         public void handleMessage(Message msg) {
             final BaseBrowserFragment fragment = getOwner();
-            if (fragment == null)
-                return;
+            if (fragment == null) return;
             switch (msg.what){
                 case MSG_SHOW_LOADING:
                     if (fragment.mSwipeRefreshLayout != null)
@@ -470,8 +469,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
                         fragment.mSwipeRefreshLayout.setRefreshing(false);
                     break;
                 case MSG_REFRESH:
-                    if (fragment != null && !fragment.isDetached())
-                        fragment.refresh();
+                    if (!fragment.isDetached()) fragment.refresh();
             }
         }
     }



More information about the Android mailing list