[Android] TV: Fix History section display
Geoffrey Métais
git at videolan.org
Tue Mar 6 15:51:50 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 6 15:51:32 2018 +0100| [921090fd6b71fa43da9aa7376f0c3a15c46eced4] | committer: Geoffrey Métais
TV: Fix History section display
> https://code.videolan.org/videolan/vlc-android/commit/921090fd6b71fa43da9aa7376f0c3a15c46eced4
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 9 +++++----
1 file changed, 5 insertions(+), 4 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 c425bd6d9..ca0140faf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -173,12 +173,12 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
/*
* skip browser and show directly Audio Player if a song is playing
*/
- if ((mRowsAdapter == null || mRowsAdapter.size() == 0) && Permissions.canReadStorage(this))
+ if (!mMediaLibrary.isWorking() && (mRowsAdapter == null || mRowsAdapter.size() == 0) && Permissions.canReadStorage(this))
update();
else {
updateBrowsers();
updateNowPlayingCard();
- if (mMediaLibrary.isInitiated()) {
+ if (mRowsAdapter != null && mMediaLibrary.isInitiated()) {
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
@@ -377,6 +377,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
protected void onPreExecute() {
showHistory = mSettings.getBoolean(PreferencesFragment.PLAYBACK_HISTORY, true);
mHandler.sendEmptyMessageDelayed(SHOW_LOADING, 300);
+ mHistoryAdapter = null;
}
@Override
@@ -453,8 +454,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
}
@MainThread
- private void updateHistory(MediaWrapper[] history) {
- if (history == null) return;
+ private synchronized void updateHistory(MediaWrapper[] history) {
+ if (history == null || mRowsAdapter == null) return;
final boolean createAdapter = mHistoryAdapter == null;
if (createAdapter) mHistoryAdapter = new ArrayObjectAdapter(new CardPresenter(mContext));
else mHistoryAdapter.clear();
More information about the Android
mailing list