Skip to content
Snippets Groups Projects
Commit 9df05867 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Prevent IndexOutOfBoundsException in audio browser

(cherry picked from commit ae5be6f2)
parent e0269296
No related branches found
No related tags found
No related merge requests found
......@@ -93,12 +93,13 @@ public abstract class BaseAudioBrowser extends SortableFragment<AudioBrowserAdap
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
int count = getCurrentAdapter().getSelectionCount();
final List<MediaLibraryItem> selection = getCurrentAdapter().getSelection();
final int count = selection.size();
if (count == 0) {
stopActionMode();
return false;
}
boolean isSong = count == 1 && getCurrentAdapter().getSelection().get(0).getItemType() == MediaLibraryItem.TYPE_MEDIA;
boolean isSong = count == 1 && selection.get(0).getItemType() == MediaLibraryItem.TYPE_MEDIA;
menu.findItem(R.id.action_mode_audio_set_song).setVisible(isSong && AndroidDevices.isPhone);
menu.findItem(R.id.action_mode_audio_info).setVisible(count == 1);
menu.findItem(R.id.action_mode_audio_append).setVisible(mService.hasMedia());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment