[Android] Fix context menus from dots for songs
Geoffrey Métais
git at videolan.org
Thu Nov 5 14:25:54 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 5 14:25:24 2015 +0100| [dcc908dfc2e4df945bc314861867a2d3279e5fe0] | committer: Geoffrey Métais
Fix context menus from dots for songs
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=dcc908dfc2e4df945bc314861867a2d3279e5fe0
---
.../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