[Android] Load library when medialib items list is empty

Geoffrey Métais git at videolan.org
Fri Aug 14 11:01:59 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 14 10:57:25 2015 +0200| [f521da35d7364a9d3ab4743918712f8d68276db0] | committer: Geoffrey Métais

Load library when medialib items list is empty

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java         |    2 +-
 .../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java |    8 --------
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 5835cdb..f803a77 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -136,7 +136,7 @@ public class MainActivity extends AudioPlayerContainerActivity implements OnItem
         }
 
         mMediaLibrary = MediaLibrary.getInstance();
-        if (savedInstanceState == null) { // means first creation, savedInstanceState is not null after rotation
+        if (mMediaLibrary.getMediaItems().isEmpty()) { // means first creation, savedInstanceState is not null after rotation
         /* Load media items from database and storage */
             mMediaLibrary.loadMediaItems();
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index 3e7962e..cb0a388 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -41,14 +41,6 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment {
         mMediaLibrary = MediaLibrary.getInstance();
     }
 
-    @Override
-    public void onViewStateRestored(Bundle savedInstanceState) {
-        super.onViewStateRestored(savedInstanceState);
-        if (MediaLibrary.getInstance().getMediaItems().isEmpty()) {
-            mMediaLibrary.loadMediaItems();
-        }
-    }
-
     public void setReadyToDisplay(boolean ready) {
         if (ready && !mReadyToDisplay)
             display();



More information about the Android mailing list