[Android] TV: clear adapters only once update is ready

Geoffrey Métais git at videolan.org
Thu Oct 26 15:40:25 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 26 15:39:53 2017 +0200| [39dd3bcb979e335fd5d63bfe1657cdcebfb1352e] | committer: Geoffrey Métais

TV: clear adapters only once update is ready

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

 .../src/org/videolan/vlc/gui/tv/MainTvActivity.java   | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 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 6eba48fd6..a98534954 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -386,23 +386,15 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
     };
 
     private class AsyncUpdate extends AsyncTask<Void, Void, Void> {
-        boolean showHistory;
-        MediaWrapper[] history, videoList;
+        private boolean showHistory;
+        private MediaWrapper[] history, videoList;
 
         AsyncUpdate() {}
 
         @Override
         protected void onPreExecute() {
             showHistory = mSettings.getBoolean(PreferencesFragment.PLAYBACK_HISTORY, true);
-            if (mRowsAdapter != null)
-                mRowsAdapter.clear();
-            else
-                mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
             mHandler.sendEmptyMessageDelayed(SHOW_LOADING, 300);
-            mHistoryIndex.clear();
-
-            //Video Section
-            mVideoIndex.clear();
         }
 
         @Override
@@ -425,6 +417,13 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             mHandler.sendEmptyMessage(HIDE_LOADING);
             if (!isVisible())
                 return;
+            if (mRowsAdapter != null)
+                mRowsAdapter.clear();
+            else
+                mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+            mHistoryIndex.clear();
+            //Video Section
+            mVideoIndex.clear();
             mVideoAdapter = new ArrayObjectAdapter(
                     new CardPresenter(mContext));
             final HeaderItem videoHeader = new HeaderItem(HEADER_VIDEO, getString(R.string.video));



More information about the Android mailing list