[Android] Data binding for media browsers
Geoffrey Métais
git at videolan.org
Mon Sep 7 14:29:23 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Sep 1 18:42:44 2015 +0200| [5dbe9435c818c401b5e7e2476e4d9bac3e791832] | committer: Geoffrey Métais
Data binding for media browsers
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5dbe9435c818c401b5e7e2476e4d9bac3e791832
---
.../vlc/gui/browser/BaseBrowserAdapter.java | 24 +++++++-------------
.../vlc/gui/browser/StorageBrowserAdapter.java | 2 +-
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 4dc71a0..2db7eb8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -49,7 +49,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnLongClickListener {
protected static final String TAG = "VLC/BaseBrowserAdapter";
protected static final int TYPE_MEDIA = 0;
@@ -111,13 +111,7 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
vh.icon.setImageResource(getIconResId(media));
if (hasContextMenu) {
-// vh.more.setOnClickListener(new View.OnClickListener() {
-// @Override
-// public void onClick(View v) {
-// fragment.onPopupMenu(vh.more, holder.getAdapterPosition());
-// }
-// });
- vh.itemView.setOnLongClickListener(mLongClickListener);
+ vh.itemView.setOnLongClickListener(this);
}
}
@@ -346,12 +340,10 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
protected void checkBoxAction(View v){}
- View.OnLongClickListener mLongClickListener = new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- final MediaViewHolder holder = (MediaViewHolder) v.getTag(R.id.layout_item);
- fragment.mRecyclerView.openContextMenu(holder.getAdapterPosition());
- return true;
- }
- };
+ @Override
+ public boolean onLongClick(View v) {
+ final MediaViewHolder holder = (MediaViewHolder) v.getTag(R.id.layout_item);
+ fragment.mRecyclerView.openContextMenu(holder.getAdapterPosition());
+ return true;
+ }
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
index 2818ae8..a98d8ec 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
@@ -80,7 +80,7 @@ public class StorageBrowserAdapter extends BaseBrowserAdapter {
}
});
if (hasContextMenu)
- vh.itemView.setOnLongClickListener(mLongClickListener);
+ vh.itemView.setOnLongClickListener(this);
}
public void addItem(Media media, boolean notify, boolean top){
More information about the Android
mailing list