[Android] albums/songs: fix context menu in songs tab
Sébastien Toque
git at videolan.org
Thu May 22 17:44:23 CEST 2014
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu May 22 15:06:52 2014 +0200| [30f47e169b48b660b938ebbe71d062655803b39e] | committer: Adrien Maglo
albums/songs: fix context menu in songs tab
Signed-off-by: Adrien Maglo <magsoft at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=30f47e169b48b660b938ebbe71d062655803b39e
---
.../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 2f97715..bd02f81 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -216,11 +216,14 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.audio_list_browser, menu);
- setContextMenuItems(menu, v);
+ int position = 0;
+ if (menuInfo instanceof AdapterContextMenuInfo)
+ position = ((AdapterContextMenuInfo)menuInfo).position;
+ setContextMenuItems(menu, v, position);
}
- private void setContextMenuItems(Menu menu, View v) {
- if (v.getId() != R.id.songs) {
+ private void setContextMenuItems(Menu menu, View v, int position) {
+ if (mTabHost.getCurrentTabTag() != "songs" || mSongsAdapter.getItem(position).mIsSeparator) {
menu.setGroupVisible(R.id.songs_view_only, false);
menu.setGroupVisible(R.id.phone_only, false);
}
@@ -356,7 +359,7 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
- setContextMenuItems(popupMenu.getMenu(), anchor);
+ setContextMenuItems(popupMenu.getMenu(), anchor, position);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
More information about the Android
mailing list