@Override public boolean onContextItemSelected(MenuItem item) { ContextMenuInfo menuInfo = item.getMenuInfo(); if (menuInfo instanceof AdapterContextMenuInfo) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; if (info.position < mAdapter.getCount()) { File file = mAdapter.getItem(info.position); switch (item.getItemId()) { case R.id.browse_context_open: openDirectory(file); return true; case R.id.browse_context_play: getMediaServer().status().command.input.play(file.getMrl(), file.getOptions()); return true; // case R.id.browse_context_stream: // getMediaServer().status().command.input.play(file.getMrl(), // file.getStreamingOptions()); // Intent intent = // file.getIntentForStreaming(getMediaServer().getAuthority()); // startActivity(intent); // return true; case R.id.browse_context_enqueue: getMediaServer().status().command.input.enqueue(file.getMrl()); // delay reloading playlist to give vlc time to queue and read metadata ((Reloader) getActivity()).reloadDelayed(Tags.FRAGMENT_PLAYLIST, null, 100); return true; } } } return super.onContextItemSelected(item); }
@Override public void onListItemClick(ListView l, View v, int position, long id) { File file = mAdapter.getItem(position); if (file.isDirectory()) { openDirectory(file); } else { getMediaServer().status().command.input.play(file.getMrl(), file.getOptions()); } }