[Android] Do not refresh videos list everytime

Geoffrey Métais git at videolan.org
Wed Oct 15 11:09:47 CEST 2014


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

Do not refresh videos list everytime

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

 .../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 64d7fc1..a35180a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -174,15 +174,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