use of org.videolan.vlc.gui.browser.ExtensionBrowser in project vlc-android by videolan.
the class MainActivity method restoreFragmentsStack.
private void restoreFragmentsStack(Bundle savedInstanceState, FragmentManager fm) {
final List<Fragment> fragments = fm.getFragments();
if (fragments != null) {
final FragmentTransaction ft = fm.beginTransaction();
final Fragment displayed = fm.getFragment(savedInstanceState, "current_fragment_visible");
for (Fragment fragment : fragments) if (fragment != null) {
if (fragment instanceof ExtensionBrowser) {
ft.remove(fragment);
} else if ((fragment instanceof MediaBrowserFragment)) {
mFragmentsStack.put(fragment.getTag(), new WeakReference<>(fragment));
if (!TextUtils.equals(fragment.getTag(), displayed.getTag()))
ft.hide(fragment);
}
}
ft.commit();
}
}
use of org.videolan.vlc.gui.browser.ExtensionBrowser in project vlc-android by GeoffreyMetais.
the class MainActivity method onBackPressed.
@Override
public void onBackPressed() {
/* Close the menu first */
if (mDrawerLayout.isDrawerOpen(mNavigationView)) {
closeDrawer();
return;
}
/* Close playlist search if open or Slide down the audio player if it is shown entirely. */
if (isAudioPlayerReady() && (mAudioPlayer.clearSearch() || slideDownAudioPlayer()))
return;
// If it's the directory view, a "backpressed" action shows a parent.
final Fragment fragment = getCurrentFragment();
if (fragment instanceof BaseBrowserFragment && ((BaseBrowserFragment) fragment).goBack()) {
return;
} else if (fragment instanceof ExtensionBrowser) {
((ExtensionBrowser) fragment).goBack();
return;
}
if (AndroidUtil.isNougatOrLater && isInMultiWindowMode()) {
UiTools.confirmExit(this);
return;
}
finish();
}
use of org.videolan.vlc.gui.browser.ExtensionBrowser in project vlc-android by GeoffreyMetais.
the class MainActivity method onSaveInstanceState.
protected void onSaveInstanceState(Bundle outState) {
final Fragment current = mNavigator.getCurrentFragment();
if (!(current instanceof ExtensionBrowser))
getSupportFragmentManager().putFragment(outState, "current_fragment", current);
super.onSaveInstanceState(outState);
outState.putInt("current", mNavigator.getCurrentFragmentId());
}
Aggregations