use of org.videolan.vlc.gui.network.MRLPanelFragment in project vlc-android by videolan.
the class MainActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// This should not happen
if (item == null)
return false;
int id = item.getItemId();
final Fragment current = getCurrentFragment();
if (item.getGroupId() == R.id.extensions_group) {
if (mCurrentFragmentId == id) {
clearBackstackFromClass(ExtensionBrowser.class);
mDrawerLayout.closeDrawer(mNavigationView);
return false;
} else
mExtensionManagerService.openExtension(id);
} else {
if (mExtensionServiceConnection != null)
mExtensionManagerService.disconnect();
if (current == null) {
mDrawerLayout.closeDrawer(mNavigationView);
return false;
}
if (mCurrentFragmentId == id) {
// Go back at root level of current browser
if (current instanceof BaseBrowserFragment && !((BaseBrowserFragment) current).isRootDirectory()) {
getSupportFragmentManager().popBackStackImmediate(getTag(id), FragmentManager.POP_BACK_STACK_INCLUSIVE);
} else {
mDrawerLayout.closeDrawer(mNavigationView);
return false;
}
} else
switch(id) {
case R.id.nav_about:
showSecondaryFragment(SecondaryActivity.ABOUT);
break;
case R.id.nav_settings:
startActivityForResult(new Intent(this, PreferencesActivity.class), ACTIVITY_RESULT_PREFERENCES);
break;
case R.id.nav_mrl:
new MRLPanelFragment().show(getSupportFragmentManager(), "fragment_mrl");
break;
case R.id.nav_directories:
if (TextUtils.equals(BuildConfig.FLAVOR_target, "chrome")) {
final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/* video/*");
startActivityForResult(intent, ACTIVITY_RESULT_OPEN);
mDrawerLayout.closeDrawer(mNavigationView);
return true;
}
default:
/* Slide down the audio player */
slideDownAudioPlayer();
/* Switch the fragment */
showFragment(id);
}
}
mDrawerLayout.closeDrawer(mNavigationView);
return true;
}
Aggregations