mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 886528: Postpone popup menu initialization. [r=mfinkle]
--HG-- extra : rebase_source : 063c64a6340b92a75d00b1a5ed434b0a249827d6
This commit is contained in:
parent
28cd3320ca
commit
81b1972949
@ -417,29 +417,8 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
View panel = mActivity.getMenuPanel();
|
||||
|
||||
// If panel is null, the app is starting up for the first time;
|
||||
// add this to the popup only if we have a soft menu button.
|
||||
// else, browser-toolbar is initialized on rotation,
|
||||
// and we need to re-attach action-bar items.
|
||||
|
||||
if (panel == null) {
|
||||
// Create the panel and inflate the custom menu.
|
||||
mActivity.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, null);
|
||||
panel = mActivity.getMenuPanel();
|
||||
|
||||
if (mHasSoftMenuButton) {
|
||||
mMenuPopup = new MenuPopup(mActivity);
|
||||
mMenuPopup.setPanelView(panel);
|
||||
|
||||
mMenuPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
mActivity.onOptionsMenuClosed(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mFocusOrder = Arrays.asList(mBack, mForward, mLayout, mReader, mSiteSecurity, mStop, mTabs);
|
||||
@ -1167,8 +1146,22 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
|
||||
if (!mHasSoftMenuButton)
|
||||
return false;
|
||||
|
||||
// Initialize the popup.
|
||||
if (mMenuPopup == null) {
|
||||
View panel = mActivity.getMenuPanel();
|
||||
mMenuPopup = new MenuPopup(mActivity);
|
||||
mMenuPopup.setPanelView(panel);
|
||||
|
||||
mMenuPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
mActivity.onOptionsMenuClosed(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
GeckoAppShell.getGeckoInterface().invalidateOptionsMenu();
|
||||
if (mMenuPopup != null && !mMenuPopup.isShowing())
|
||||
if (!mMenuPopup.isShowing())
|
||||
mMenuPopup.showAsDropDown(mMenu);
|
||||
|
||||
return true;
|
||||
@ -1178,7 +1171,7 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
|
||||
if (!mHasSoftMenuButton)
|
||||
return false;
|
||||
|
||||
if (mMenuPopup != null && mMenuPopup.isShowing())
|
||||
if (mMenuPopup.isShowing())
|
||||
mMenuPopup.dismiss();
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user