[Android] Do not refresh videos list everytime

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


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

Do not refresh videos list everytime

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

 .../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