[Android] Fix playlist scroll
Geoffrey Métais
git at videolan.org
Tue Nov 25 16:38:41 CET 2014
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 25 16:34:45 2014 +0100| [ffbd177990105de76ec0d94baecc7f1d579a66ed] | committer: Geoffrey Métais
Fix playlist scroll
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ffbd177990105de76ec0d94baecc7f1d579a66ed
---
.../gui/tv/audioplayer/AudioPlayerActivity.java | 21 +++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index f0d6f7a..adcbedb 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -276,16 +276,19 @@ public class AudioPlayerActivity extends Activity implements AudioServiceControl
}
private void selectItem(final int position){
- if (position >= mLayoutManager.getChildCount())
+ if (position >= mLocations.size())
return;
- mSelectedItem = position;
- mRecyclerView.stopScroll();
- mLayoutManager.scrollToPosition(position);
- mRecyclerView.post(new Runnable() {
- @Override
- public void run() {
+ mRecyclerView.post(new Runnable() {
+ @Override
+ public void run() {
+ if (position > mLayoutManager.findLastCompletelyVisibleItemPosition()
+ || position < mLayoutManager.findFirstCompletelyVisibleItemPosition()) {
+ mRecyclerView.stopScroll();
+ mRecyclerView.smoothScrollToPosition(position);
+ }
mAdapter.setSelection(position);
- }
- });
+ }
+ });
+ mSelectedItem = position;
}
}
More information about the Android
mailing list