[Android] Fix context menus from dots for songs
Geoffrey Métais
git at videolan.org
Fri Nov 6 13:37:52 CET 2015
vlc-ports/android | branch: playlist | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 5 14:25:24 2015 +0100| [e7427aa41a8224fddb20984eec64b5ab70d7bb17] | committer: Geoffrey Métais
Fix context menus from dots for songs
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e7427aa41a8224fddb20984eec64b5ab70d7bb17
---
.../org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 36cb298..3d30b33 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -26,8 +26,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.support.design.widget.Snackbar;
import android.support.design.widget.FloatingActionButton;
+import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.ContextMenu;
@@ -375,10 +375,12 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
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 = ((AdapterContextMenuInfo) menuInfo).position;
+ setContextMenuItems(menu, position);
}
- private void setContextMenuItems(Menu menu, View v) {
+ private void setContextMenuItems(Menu menu, int position) {
final int pos = mViewPager.getCurrentItem();
if (pos != MODE_SONG) {
menu.setGroupVisible(R.id.songs_view_only, false);
@@ -390,7 +392,6 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
menu.findItem(R.id.audio_list_browser_delete).setVisible(false);
else {
MenuItem item = menu.findItem(R.id.audio_list_browser_delete);
- int position = ((AdapterContextMenuInfo) item.getMenuInfo()).position;
AudioBrowserListAdapter adapter = pos == MODE_SONG ? mSongsAdapter : mPlaylistAdapter;
AudioBrowserListAdapter.ListItem mediaItem = adapter.getItem(position);
if (pos == MODE_PLAYLIST && MediaDatabase.getInstance().playlistExists(mediaItem.mTitle))
@@ -832,7 +833,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
- setContextMenuItems(popupMenu.getMenu(), anchor);
+ setContextMenuItems(popupMenu.getMenu(), position);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
More information about the Android
mailing list