use of org.mozilla.focus.fragment.UrlInputFragment in project focus-android by mozilla-mobile.
the class MainActivity method onBackPressed.
@Override
public void onBackPressed() {
final FragmentManager fragmentManager = getSupportFragmentManager();
final SessionsSheetFragment sessionsSheetFragment = (SessionsSheetFragment) fragmentManager.findFragmentByTag(SessionsSheetFragment.FRAGMENT_TAG);
if (sessionsSheetFragment != null && sessionsSheetFragment.isVisible() && sessionsSheetFragment.onBackPressed()) {
// SessionsSheetFragment handles back presses itself (custom animations).
return;
}
final UrlInputFragment urlInputFragment = (UrlInputFragment) fragmentManager.findFragmentByTag(UrlInputFragment.FRAGMENT_TAG);
if (urlInputFragment != null && urlInputFragment.isVisible() && urlInputFragment.onBackPressed()) {
// we do not try to remove it from outside.
return;
}
final BrowserFragment browserFragment = (BrowserFragment) fragmentManager.findFragmentByTag(BrowserFragment.FRAGMENT_TAG);
if (browserFragment != null && browserFragment.isVisible() && browserFragment.onBackPressed()) {
// in the browsing history.
return;
}
super.onBackPressed();
}
Aggregations