[Android] Fix context menu in AudioAlbumsSongsFragment
Geoffrey Métais
git at videolan.org
Thu Jun 4 18:07:51 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 4 18:07:14 2015 +0200| [1b538ddd66482ce9a53d49f382c45788127a9bf1] | committer: Geoffrey Métais
Fix context menu in AudioAlbumsSongsFragment
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1b538ddd66482ce9a53d49f382c45788127a9bf1
---
vlc-android/res/menu/audio_list_browser.xml | 6 +++---
.../org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 8 +++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/vlc-android/res/menu/audio_list_browser.xml b/vlc-android/res/menu/audio_list_browser.xml
index f838a5a..eb8753c 100644
--- a/vlc-android/res/menu/audio_list_browser.xml
+++ b/vlc-android/res/menu/audio_list_browser.xml
@@ -11,10 +11,10 @@
<item
android:id="@+id/audio_list_browser_play_all"
android:title="@string/play_all" />
+ <item
+ android:id="@+id/audio_list_browser_delete"
+ android:title="@string/delete"/>
</group>
- <item
- android:id="@+id/audio_list_browser_delete"
- android:title="@string/delete"/>
<group android:id="@+id/phone_only" >
<item
android:id="@+id/audio_list_browser_set_song"
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 747202b..fb00851 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -190,16 +190,18 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
- MenuInflater inflater = getActivity().getMenuInflater();
- inflater.inflate(R.menu.audio_list_browser, menu);
int position = 0;
if (menuInfo instanceof AdapterContextMenuInfo)
position = ((AdapterContextMenuInfo)menuInfo).position;
+ if (mViewPager.getCurrentItem() == MODE_SONG && mSongsAdapter.getItem(position).mIsSeparator)
+ return;
+ MenuInflater inflater = getActivity().getMenuInflater();
+ inflater.inflate(R.menu.audio_list_browser, menu);
setContextMenuItems(menu, v, position);
}
private void setContextMenuItems(Menu menu, View v, int position) {
- if (mViewPager.getCurrentItem() != MODE_SONG || mSongsAdapter.getItem(position).mIsSeparator) {
+ if (mViewPager.getCurrentItem() != MODE_SONG) {
menu.setGroupVisible(R.id.songs_view_only, false);
menu.setGroupVisible(R.id.phone_only, false);
}
More information about the Android
mailing list