[Android] Restore scan after interrupted refresh

Geoffrey Métais git at videolan.org
Thu Aug 13 10:57:45 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 13 10:57:15 2015 +0200| [30007fba73f0d751a6ea080a6d46da404369aee9] | committer: Geoffrey Métais

Restore scan after interrupted refresh

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index c6b6c12..5835cdb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -105,6 +105,7 @@ public class MainActivity extends AudioPlayerContainerActivity implements OnItem
 
     private int mVersionNumber = -1;
     private boolean mFirstRun = false;
+    private boolean mScanNeeded = false;
 
     private Handler mHandler = new MainActivityHandler(this);
     private int mFocusedPrior = 0;
@@ -220,9 +221,12 @@ public class MainActivity extends AudioPlayerContainerActivity implements OnItem
     protected void onResume() {
         super.onResume();
 
+        /* Load media items from database and storage */
+        if (mScanNeeded)
+            mMediaLibrary.loadMediaItems();
         if (mSlidingPane.getState() == mSlidingPane.STATE_CLOSED)
             mActionBar.hide();
-   }
+    }
 
     @Override
     protected void onResumeFragments() {
@@ -266,6 +270,8 @@ public class MainActivity extends AudioPlayerContainerActivity implements OnItem
     @Override
     protected void onPause() {
         super.onPause();
+        /* Check for an ongoing scan that needs to be resumed during onResume */
+        mScanNeeded = mMediaLibrary.isWorking();
         /* Stop scanning for files */
         mMediaLibrary.stop();
         /* Save the tab status in pref */



More information about the Android mailing list