[Android] Ensure Medialibray is OK on TV after restoration

Geoffrey Métais git at videolan.org
Thu Jun 15 18:02:46 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 15 16:02:37 2017 +0200| [bd514e5e857b34d39b124f46b35f1c0792a68994] | committer: Geoffrey Métais

Ensure Medialibray is OK on TV after restoration

> https://code.videolan.org/videolan/vlc-android/commit/bd514e5e857b34d39b124f46b35f1c0792a68994
---

 vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
index 5ea45bf3d..4a4e5bef7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
@@ -44,6 +44,7 @@ import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.DialogActivity;
 import org.videolan.vlc.gui.PlaybackServiceActivity;
 import org.videolan.vlc.gui.tv.SearchActivity;
+import org.videolan.vlc.util.Permissions;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public abstract class BaseTvActivity extends PlaybackServiceActivity {
@@ -57,6 +58,9 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        //Init Medialibrary if KO
+        if (savedInstanceState != null && !VLCApplication.getMLInstance().isInitiated() && Permissions.canReadStorage())
+            startService(new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class));
         super.onCreate(savedInstanceState);
         mMediaLibrary = VLCApplication.getMLInstance();
         mSettings = PreferenceManager.getDefaultSharedPreferences(this);



More information about the Android mailing list