Fix system Navigation bar covering menu when fullscreen
Fixed one case of the navigation bar covering the app
menu popup.
Needed to make the popup non-modal before showing it
and modal immediately after so that it can be
interacted with.
This will happen only when Immersive mode is in use
since testing doesn't work with non-modal popups.
CR-Fixed: 903500
Change-Id: Ia265d434a96822e8c1095e89aa42f67a335a13ff
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 46fde6a..e0e7095 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -79,8 +79,11 @@
}
Bundle extras = intent.getExtras();
- if (extras == null)
+ if (extras == null){
+ getFragmentManager().beginTransaction().replace(android.R.id.content,
+ new GeneralPreferencesFragment()).commit();
return;
+ }
String fragment = (String) extras.getCharSequence(PreferenceActivity.EXTRA_SHOW_FRAGMENT);
if (fragment != null) {
diff --git a/src/com/android/browser/appmenu/AppMenu.java b/src/com/android/browser/appmenu/AppMenu.java
index 8453464..f0b9a5a 100644
--- a/src/com/android/browser/appmenu/AppMenu.java
+++ b/src/com/android/browser/appmenu/AppMenu.java
@@ -26,6 +26,8 @@
import android.widget.PopupWindow.OnDismissListener;
import org.chromium.base.SysUtils;
+
+import com.android.browser.BrowserSettings;
import com.android.browser.R;
import java.util.ArrayList;
@@ -159,7 +161,12 @@
setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight, sizingPadding);
setPopupOffset(mPopup, mCurrentScreenRotation, visibleDisplayFrame, sizingPadding);
mPopup.setOnItemClickListener(this);
+ boolean isImmersive = BrowserSettings.getInstance().useFullscreen();
+ if (isImmersive)
+ mPopup.setModal(false); //Disable modal here(it's required until this point)
mPopup.show();
+ if (isImmersive)
+ mPopup.setModal(true); //Set modal after show, so that Immersive Mode doesn't break
mPopup.getListView().setItemsCanFocus(true);
mPopup.getListView().setOnKeyListener(this);