[Android] Delay visual feedback on video refresh

Geoffrey Métais git at videolan.org
Mon Dec 5 15:32:11 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  5 11:28:35 2016 +0100| [05b7bdd494fbed9c53cc396ee1ae23f7354e5f54] | committer: Geoffrey Métais

Delay visual feedback on video refresh

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index b1319e1..88b5da7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -34,9 +34,7 @@ import android.os.Message;
 import android.preference.PreferenceManager;
 import android.support.annotation.MainThread;
 import android.support.v4.content.LocalBroadcastManager;
-import android.support.v4.util.SimpleArrayMap;
 import android.support.v7.view.ActionMode;
-import android.text.TextUtils;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.ContextMenu;
@@ -355,8 +353,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
 
     @MainThread
     public void updateList() {
-        if (!mSwipeRefreshLayout.isRefreshing())
-            mSwipeRefreshLayout.setRefreshing(true);
+        mHandler.sendEmptyMessageDelayed(SET_REFRESHING, 300);
 
         VLCApplication.runBackground(new Runnable() {
             @Override
@@ -377,9 +374,9 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
                 mHandler.post(new Runnable() {
                     @Override
                     public void run() {
+                        stopRefresh();
                         mVideoAdapter.dispatchUpdate(displayList);
                         mViewNomedia.setVisibility(mVideoAdapter.getItemCount() > 0 ? View.GONE : View.VISIBLE);
-                        stopRefresh();
                     }
                 });
             }
@@ -414,6 +411,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
     };
 
     public void stopRefresh() {
+        mHandler.removeMessages(SET_REFRESHING);
         mSwipeRefreshLayout.setRefreshing(false);
     }
 



More information about the Android mailing list