private void displayNavigationPopup(boolean isForward, View anchorView) { Tab tab = getToolbarDataProvider().getTab(); if (tab == null || tab.getWebContents() == null) return; mNavigationPopup = new NavigationPopup( tab.getProfile(), getContext(), tab.getWebContents().getNavigationController(), isForward); mNavigationPopup.setAnchorView(anchorView); int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width); mNavigationPopup.setWidth(menuWidth); if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show(); }
@Override public void onWindowFocusChanged(boolean hasWindowFocus) { // Ensure the the popup is not shown after resuming activity from background. if (hasWindowFocus && mNavigationPopup != null) { mNavigationPopup.dismiss(); mNavigationPopup = null; } super.onWindowFocusChanged(hasWindowFocus); }