[Android] Do not refresh while MediaLib is scanning

Geoffrey Métais git at videolan.org
Wed Mar 4 15:55:32 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  4 15:26:43 2015 +0100| [fe1a550c5499729c7b14dc6c64f10ac26cbccb18] | committer: Geoffrey Métais

Do not refresh while MediaLib is scanning

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java       |   10 ++++++----
 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java |    3 ++-
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java    |    2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 408a9c9..658e5a1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -617,10 +617,12 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
                 break;
             // Refresh
             case R.id.ml_menu_refresh:
-                if(current != null && current instanceof IRefreshable)
-                    ((IRefreshable) current).refresh();
-                else
-                    MediaLibrary.getInstance().loadMediaItems(this, true);
+                if (!MediaLibrary.getInstance().isWorking()) {
+                    if(current != null && current instanceof IRefreshable)
+                        ((IRefreshable) current).refresh();
+                    else
+                        MediaLibrary.getInstance().loadMediaItems(this, true);
+                }
                 break;
             // Restore last playlist
             case R.id.ml_menu_last_playlist:
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index eab8739..615070e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -437,7 +437,8 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
 
     @Override
     public void onRefresh() {
-        MediaLibrary.getInstance().loadMediaItems(getActivity(), true);
+        if (!MediaLibrary.getInstance().isWorking())
+            MediaLibrary.getInstance().loadMediaItems(getActivity(), true);
     }
 
     @Override
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 51be6ab..df1a554 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -516,7 +516,7 @@ public class VideoGridFragment extends BrowserFragment implements ISortable, IVi
 
     @Override
     public void onRefresh() {
-        if (getActivity()!=null)
+        if (getActivity()!=null && !MediaLibrary.getInstance().isWorking())
             MediaLibrary.getInstance().loadMediaItems(getActivity(), true);
     }
 



More information about the Android mailing list