[Android] Set selection after setting adapter
Geoffrey Métais
git at videolan.org
Tue Jul 4 17:49:15 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul 4 17:48:51 2017 +0200| [06f3aa3f1d00243edb0f4675b8c40defe78362f2] | committer: Geoffrey Métais
Set selection after setting adapter
> https://code.videolan.org/videolan/vlc-android/commit/06f3aa3f1d00243edb0f4675b8c40defe78362f2
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 6 +++---
1 file changed, 3 insertions(+), 3 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 1e93e4966..bf5ad3e65 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -439,6 +439,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
@Override
protected void onPostExecute(Void result) {
mHandler.sendEmptyMessage(HIDE_LOADING);
+ if (!isVisible())
+ return;
mVideoAdapter = new ArrayObjectAdapter(
new CardPresenter(mContext));
final HeaderItem videoHeader = new HeaderItem(HEADER_VIDEO, getString(R.string.video));
@@ -494,10 +496,8 @@ 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));
- mBrowseFragment.setSelectedPosition(Math.min(mBrowseFragment.getSelectedPosition(), mRowsAdapter.size()-1));
- if (!isVisible())
- return;
mBrowseFragment.setAdapter(mRowsAdapter);
+ mBrowseFragment.setSelectedPosition(Math.min(mBrowseFragment.getSelectedPosition(), mRowsAdapter.size()-1));
}
}
More information about the Android
mailing list