[Android] Do not refresh videos list everytime

Geoffrey Métais git at videolan.org
Thu Oct 16 12:13:34 CEST 2014


vlc-ports/android | branch: tv | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 14 16:24:59 2014 +0200| [36a801f2e666040ce86ffca4b7834c16d0f550cf] | committer: Geoffrey Métais

Do not refresh videos list everytime

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=36a801f2e666040ce86ffca4b7834c16d0f550cf
---

 .../org/videolan/vlc/gui/video/VideoGridFragment.java  |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 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 3967477..7e30a83 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -170,15 +170,19 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
     @Override
     public void onResume() {
         super.onResume();
-        //Get & set times
-        HashMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes(getActivity());
-        mVideoAdapter.setTimes(times);
-        mVideoAdapter.notifyDataSetChanged();
-        updateList();
+        final boolean refresh = mVideoAdapter.isEmpty();
+        if (refresh){
+            updateList();
+            //Get & set times
+            HashMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes(getActivity());
+            mVideoAdapter.setTimes(times);
+            mVideoAdapter.notifyDataSetChanged();
+        }
         mMediaLibrary.addUpdateHandler(mHandler);
         mGridView.setSelection(mGVFirstVisiblePos);
         updateViewMode();
-        mAnimator.animate();
+        if (refresh)
+            mAnimator.animate();
 
         /* Start the thumbnailer */
         if (mThumbnailer != null)



More information about the Android mailing list