[Android] TV: Initial update even if ML is not initiated

Geoffrey Métais git at videolan.org
Thu Aug 10 11:10:15 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 10 11:06:21 2017 +0200| [7dd2d2e7f8f994f107f24e13792de9bf2dcfccd6] | committer: Geoffrey Métais

TV: Initial update even if ML is not initiated

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

 .../org/videolan/vlc/gui/tv/MainTvActivity.java    | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index e37d4203f..729df7619 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -168,23 +168,25 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
         /*
          * skip browser and show directly Audio Player if a song is playing
          */
-        if (mMediaLibrary.isInitiated() && (mRowsAdapter == null || mRowsAdapter.size() == 0) && Permissions.canReadStorage())
+        if ((mRowsAdapter == null || mRowsAdapter.size() == 0) && Permissions.canReadStorage())
             update();
         else {
             updateBrowsers();
             updateNowPlayingCard();
-            VLCApplication.runBackground(new Runnable() {
-                @Override
-                public void run() {
-                    final MediaWrapper[] history = VLCApplication.getMLInstance().lastMediaPlayed();
-                    mHandler.post(new Runnable() {
-                        @Override
-                        public void run() {
-                            updateHistory(history);
-                        }
-                    });
-                }
-            });
+            if (mMediaLibrary.isInitiated()) {
+                VLCApplication.runBackground(new Runnable() {
+                    @Override
+                    public void run() {
+                        final MediaWrapper[] history = mMediaLibrary.lastMediaPlayed();
+                        mHandler.post(new Runnable() {
+                            @Override
+                            public void run() {
+                                updateHistory(history);
+                            }
+                        });
+                    }
+                });
+            }
         }
     }
 



More information about the Android mailing list