[Android] Check click position is valid before doing action
Geoffrey Métais
git at videolan.org
Wed Oct 11 11:10:46 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 11 11:10:11 2017 +0200| [fa545d4ff0a8edbeaac15ef5419a27a0c5120a35] | committer: Geoffrey Métais
Check click position is valid before doing action
> https://code.videolan.org/videolan/vlc-android/commit/fa545d4ff0a8edbeaac15ef5419a27a0c5120a35
---
.../src/org/videolan/vlc/gui/video/VideoListAdapter.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index a0b162be8..33acf9729 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -297,17 +297,20 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
}
public void onClick(View v) {
- int position = getLayoutPosition();
- mEventsHandler.onClick(v, position, mDataset.get(position));
+ final int position = getLayoutPosition();
+ if (isPositionValid(position))
+ mEventsHandler.onClick(v, position, mDataset.get(position));
}
public void onMoreClick(View v){
- mEventsHandler.onCtxClick(v, getLayoutPosition(), null);
+ final int position = getLayoutPosition();
+ if (isPositionValid(position))
+ mEventsHandler.onCtxClick(v, position, null);
}
public boolean onLongClick(View v) {
- int position = getLayoutPosition();
- return mEventsHandler.onLongClick(v, position, mDataset.get(position));
+ final int position = getLayoutPosition();
+ return isPositionValid(position) && mEventsHandler.onLongClick(v, position, mDataset.get(position));
}
@Override
More information about the Android
mailing list