@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());
   }
 }
 private boolean isDirectory(ContextMenuInfo menuInfo) {
   if (menuInfo instanceof AdapterContextMenuInfo) {
     AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
     if (info.position < mAdapter.getCount()) {
       File file = mAdapter.getItem(info.position);
       return file.isDirectory();
     }
   }
   return false;
 }
 private void openParentDirectory() {
   for (int position = 0, n = mAdapter.getCount(); position < n; position++) {
     File file = mAdapter.getItem(position);
     if (file.isParent()) {
       openDirectory(file);
       return;
     }
   }
   if (!mAdapter.isEmpty()) { // Open the root directory if no parent.
     openDirectory(Directory.ROOT_DIRECTORY);
   }
 }
 private void handleEmptyDirectory() {
   showEmptyDirectoryError();
   openDirectory(File.getNormalizedPath(mDirectory.concat("/..")));
 }
 private void openDirectory(File file) {
   openDirectory(file.getNormalizedPath());
 }