[Android] Fix refresh on some devices

Geoffrey Métais git at videolan.org
Mon Dec 1 12:28:56 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  1 12:28:16 2014 +0100| [941ff4fb3275fc1a9b1e969119eab58facb6ea83] | committer: Geoffrey Métais

Fix refresh on some devices

Ensure we are in the proper state

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

 .../src/org/videolan/vlc/gui/DirectoryViewFragment.java       |    7 +++++--
 vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java     |    7 +++++--
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java     |    9 +++++++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 040b60f..db23e72 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -297,12 +297,15 @@ public class DirectoryViewFragment extends ListFragment implements IBrowser, IRe
 
     @Override
     public void setReadyToDisplay(boolean ready) {
-        mReady = ready;
+        if (ready && !mReady)
+            display();
+        else
+            mReady = ready;
     }
 
     @Override
     public void display() {
-        refresh();
         mReady = true;
+        refresh();
     }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index f9335be..7acc53b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -156,12 +156,15 @@ public class HistoryFragment extends ListFragment implements IBrowser, IRefresha
 
     @Override
     public void setReadyToDisplay(boolean ready) {
-        mReady = ready;
+        if (ready && !mReady)
+            display();
+        else
+            mReady = ready;
     }
 
     @Override
     public void display() {
-        refresh();
         mReady = true;
+        refresh();
     }
 }
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 7294aaa..185aace 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -414,6 +414,7 @@ public class VideoGridFragment extends SherlockGridFragment implements IBrowser,
                 @Override
                 public void run() {
                     if (mGroup != null || itemList.size() <= 10) {
+                        mVideoAdapter.setNotifyOnChange(false);
                         for (Media item : itemList) {
                             if (mGroup == null || item.getTitle().startsWith(mGroup)) {
                                 mVideoAdapter.add(item);
@@ -424,6 +425,7 @@ public class VideoGridFragment extends SherlockGridFragment implements IBrowser,
                     }
                     else {
                         List<MediaGroup> groups = MediaGroup.group(itemList);
+                        mVideoAdapter.setNotifyOnChange(false);
                         for (MediaGroup item : groups) {
                             mVideoAdapter.add(item.getMedia());
                             if (mThumbnailer != null)
@@ -488,7 +490,10 @@ public class VideoGridFragment extends SherlockGridFragment implements IBrowser,
 
     @Override
     public void setReadyToDisplay(boolean ready) {
-        mReady = ready;
+        if (ready && !mReady)
+            display();
+        else
+            mReady = ready;
     }
 
     @Override
@@ -497,13 +502,13 @@ public class VideoGridFragment extends SherlockGridFragment implements IBrowser,
             getActivity().runOnUiThread(new Runnable() {
                 @Override
                 public void run() {
+                    mReady = true;
                     mVideoAdapter.sort();
                     mVideoAdapter.notifyDataSetChanged();
                     mGVFirstVisiblePos = mGridView.getFirstVisiblePosition();
                     mGridView.setSelection(mGVFirstVisiblePos);
                     mGridView.requestFocus();
                     focusHelper(false);
-                    mReady = true;
                 }
             });
     }



More information about the Android mailing list