[Android] Remove dead code

Geoffrey Métais git at videolan.org
Wed Jul 5 17:23:03 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul  5 17:22:12 2017 +0200| [9d039b0cc50d203996f499b5aa232ae1da708ef1] | committer: Geoffrey Métais

Remove dead code

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

 .../org/videolan/vlc/gui/tv/MainTvActivity.java    | 27 +++++++---------------
 1 file changed, 8 insertions(+), 19 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 447024878..2ff382c4c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -29,7 +29,6 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Build;
@@ -112,9 +111,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
     private ProgressBar mProgressBar;
     private ArrayObjectAdapter mRowsAdapter = null;
     private ArrayObjectAdapter mVideoAdapter, mCategoriesAdapter, mHistoryAdapter, mBrowserAdapter, mOtherAdapter;
-    private View mRootContainer;
     private final SimpleArrayMap<String, Integer> mVideoIndex = new SimpleArrayMap<>(), mHistoryIndex = new SimpleArrayMap<>();
-    private Drawable mDefaultBackground;
     private Activity mContext;
     private Object mSelectedItem;
     private AsyncUpdate mUpdateTask;
@@ -137,7 +134,6 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
         mContext = this;
         setContentView(R.layout.tv_main);
 
-        mDefaultBackground = getResources().getDrawable(R.drawable.background);
         final FragmentManager fragmentManager = getFragmentManager();
         mBrowseFragment = (BrowseFragment) fragmentManager.findFragmentById(
                 R.id.browse_fragment);
@@ -159,7 +155,6 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             mBrowseFragment.setSearchAffordanceColor(getResources().getColor(R.color.orange500));
         }
 
-        mRootContainer = mBrowseFragment.getView();
         mBrowseFragment.setBrandColor(ContextCompat.getColor(this, R.color.orange800));
         mBackgroundManager = BackgroundManager.getInstance(this);
         mBackgroundManager.attachToView(findViewById(R.id.tv_container));
@@ -412,7 +407,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             showHistory = mSettings.getBoolean(PreferencesFragment.PLAYBACK_HISTORY, true);
             if (mRowsAdapter != null)
                 mRowsAdapter.clear();
-            mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+            else
+                mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
             mHandler.sendEmptyMessageDelayed(SHOW_LOADING, 300);
             mHistoryIndex.clear();
 
@@ -448,18 +444,11 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             // Update video section
             if (!Tools.isArrayEmpty(videoList)) {
                 final int size = Math.min(NUM_ITEMS_PREVIEW, videoList.length);
-                mRootContainer.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        MediaWrapper item;
-                        for (int i = 0; i < size; ++i) {
-                            item = videoList[i];
-                            Tools.setMediaDescription(item);
-                            mVideoAdapter.add(item);
-                            mVideoIndex.put(item.getLocation(), i);
-                        }
-                    }
-                });
+                for (int i = 0; i < size; ++i) {
+                    Tools.setMediaDescription(videoList[i]);
+                    mVideoAdapter.add(videoList[i]);
+                    mVideoIndex.put(videoList[i].getLocation(), i);
+                }
             }
             mRowsAdapter.add(new ListRow(videoHeader, mVideoAdapter));
 
@@ -519,7 +508,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
             return;
         mBrowserAdapter.clear();
         List<MediaWrapper> directories = AndroidDevices.getMediaDirectoriesList();
-        if (!AndroidDevices.showInternalStorage())
+        if (!AndroidDevices.showInternalStorage() && !directories.isEmpty())
             directories.remove(0);
         for (MediaWrapper directory : directories)
             mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_DIRECTORIES, directory.getTitle(), R.drawable.ic_menu_folder_big, directory.getUri()));



More information about the Android mailing list