[Android] Set onClickListener on every iteration of getView
Geoffrey Métais
git at videolan.org
Wed Dec 10 11:14:22 CET 2014
vlc-ports/android | branch: 1.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 10 10:52:30 2014 +0100| [492d707e06aa4e554dcc21eb3de025b2c88d9b4a] | committer: Geoffrey Métais
Set onClickListener on every iteration of getView
It avoids the listener to be reused on other items.
popup context menu was loaded for the wrong items.
This should fix delete for wrong files.
(cherry picked from commit 05fcd9b42f07d9d951143dffbab5fd76ead6d49b)
Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=492d707e06aa4e554dcc21eb3de025b2c88d9b4a
---
.../org/videolan/vlc/gui/video/VideoListAdapter.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 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 243c04d..648786b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -153,13 +153,6 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder.listmode = mListMode;
v.setTag(holder);
- holder.more.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mFragment != null)
- mFragment.onContextPopupMenu(v, position);
- }
- });
/* Set the layoutParams based on the values set in the video_grid_item.xml root element */
v.setLayoutParams(new GridView.LayoutParams(v.getLayoutParams().width, v.getLayoutParams().height));
@@ -167,6 +160,14 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder = (ViewHolder) v.getTag();
}
+ holder.more.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mFragment != null)
+ mFragment.onContextPopupMenu(v, position);
+ }
+ });
+
Media media = getItem(position);
/* Thumbnail */
More information about the Android
mailing list