Bug 1427771 - Exit fullscreen with back key is pressed.
MozReview-Commit-ID: LYN22XJG4S1
--- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
@@ -262,17 +262,21 @@ public class CustomTabsActivity extends
overridePendingTransition(IntentUtil.getEnterAnimationRes(intent),
IntentUtil.getExitAnimationRes(intent));
usingCustomAnimation = false;
}
}
@Override
public void onBackPressed() {
- if (mCanGoBack) {
+ final boolean fullScreen = ActivityUtils.isFullScreen(this);
+ if (fullScreen) {
+ handleFullScreen(false);
+ mGeckoSession.exitFullScreen();
+ } else if (mCanGoBack) {
mGeckoSession.goBack();
} else {
finish();
}
}
// Usually should use onCreateOptionsMenu() to initialize menu items. But GeckoApp overwrite
// it to support custom menu(Bug 739412). Then the parameter *menu* in this.onCreateOptionsMenu()
@@ -672,16 +676,20 @@ public class CustomTabsActivity extends
@Override
public void onTitleChange(GeckoSession session, String title) {
mCurrentTitle = title;
updateActionBar();
}
@Override
public void onFullScreen(GeckoSession session, boolean fullScreen) {
+ handleFullScreen(fullScreen);
+ }
+
+ private void handleFullScreen(boolean fullScreen) {
ActivityUtils.setFullScreen(this, fullScreen);
if (fullScreen) {
getSupportActionBar().hide();
} else {
getSupportActionBar().show();
}
}