[Android] TV: Ensure browser selected position is correct
Geoffrey Métais
git at videolan.org
Thu Jan 4 17:08:04 CET 2018
vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 4 16:08:46 2018 +0100| [6f97f9a47eb32b8e6244eda1961c274094debc64] | committer: Geoffrey Métais
TV: Ensure browser selected position is correct
(cherry picked from commit e2657876013226e4bd3b19fc87b7ec6edc33cb54)
> https://code.videolan.org/videolan/vlc-android/commit/6f97f9a47eb32b8e6244eda1961c274094debc64
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 2 ++
1 file changed, 2 insertions(+)
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 b6b5f1b68..4fde0238e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -48,6 +48,7 @@ import android.support.v17.leanback.widget.RowPresenter;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.util.SimpleArrayMap;
+import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
@@ -470,6 +471,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
mOtherAdapter.add(new CardPresenter.SimpleCard(ID_ABOUT, getString(R.string.about), getString(R.string.app_name_full)+" "+ BuildConfig.VERSION_NAME, R.drawable.ic_default_cone));
mOtherAdapter.add(new CardPresenter.SimpleCard(ID_LICENCE, getString(R.string.licence), R.drawable.ic_default_cone));
mRowsAdapter.add(new ListRow(miscHeader, mOtherAdapter));
+ if (mBrowseFragment.getSelectedPosition() >= mRowsAdapter.size()) mBrowseFragment.setSelectedPosition(RecyclerView.NO_POSITION);
mBrowseFragment.setAdapter(mRowsAdapter);
mBrowseFragment.setSelectedPosition(Math.min(mBrowseFragment.getSelectedPosition(), mRowsAdapter.size()-1));
More information about the Android
mailing list