org.chromium.chrome.browser.appmenu.AppMenuObserver Java Examples

The following examples show how to use org.chromium.chrome.browser.appmenu.AppMenuObserver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ToolbarManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the handler for any special case handling related with the menu button.
 * @param menuHandler The handler to be used.
 */
private void setMenuHandler(AppMenuHandler menuHandler) {
    menuHandler.addObserver(new AppMenuObserver() {
        @Override
        public void onMenuVisibilityChanged(boolean isVisible) {
            if (mFullscreenManager == null) return;
            if (isVisible) {
                mFullscreenMenuToken =
                        mFullscreenManager.showControlsPersistentAndClearOldToken(
                                mFullscreenMenuToken);
            } else {
                mFullscreenManager.hideControlsPersistent(mFullscreenMenuToken);
                mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN;
            }
        }
    });
    mAppMenuButtonHelper = new AppMenuButtonHelper(menuHandler);
    mAppMenuButtonHelper.setOnAppMenuShownListener(new Runnable() {
        @Override
        public void run() {
            RecordUserAction.record("MobileToolbarShowMenu");
        }
    });
    mLocationBar.setMenuButtonHelper(mAppMenuButtonHelper);
}
 
Example #2
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the handler for any special case handling related with the menu button.
 * @param menuHandler The handler to be used.
 */
private void setMenuHandler(AppMenuHandler menuHandler) {
    menuHandler.addObserver(new AppMenuObserver() {
        @Override
        public void onMenuVisibilityChanged(boolean isVisible) {
            if (mControlsVisibilityDelegate == null) return;
            if (isVisible) {
                mFullscreenMenuToken =
                        mControlsVisibilityDelegate.showControlsPersistentAndClearOldToken(
                                mFullscreenMenuToken);
            } else {
                mControlsVisibilityDelegate.hideControlsPersistent(mFullscreenMenuToken);
                mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN;
            }
        }
    });
    mAppMenuButtonHelper = new AppMenuButtonHelper(menuHandler);
    mAppMenuButtonHelper.setOnAppMenuShownListener(new Runnable() {
        @Override
        public void run() {
            RecordUserAction.record("MobileToolbarShowMenu");
        }
    });
    mLocationBar.setMenuButtonHelper(mAppMenuButtonHelper);
}
 
Example #3
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the handler for any special case handling related with the menu button.
 * @param menuHandler The handler to be used.
 */
private void setMenuHandler(AppMenuHandler menuHandler) {
    menuHandler.addObserver(new AppMenuObserver() {
        @Override
        public void onMenuVisibilityChanged(boolean isVisible) {
            if (mControlsVisibilityDelegate == null) return;
            if (isVisible) {
                mFullscreenMenuToken =
                        mControlsVisibilityDelegate.showControlsPersistentAndClearOldToken(
                                mFullscreenMenuToken);
            } else {
                mControlsVisibilityDelegate.hideControlsPersistent(mFullscreenMenuToken);
                mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN;
            }
        }

        @Override
        public void onMenuHighlightChanged(boolean highlighting) {
            mToolbar.setMenuButtonHighlight(highlighting);

            if (mControlsVisibilityDelegate == null) return;
            if (highlighting) {
                mFullscreenHighlightToken =
                        mControlsVisibilityDelegate.showControlsPersistentAndClearOldToken(
                                mFullscreenHighlightToken);
            } else {
                mControlsVisibilityDelegate.hideControlsPersistent(mFullscreenHighlightToken);
                mFullscreenHighlightToken = FullscreenManager.INVALID_TOKEN;
            }
        }
    });
    mAppMenuButtonHelper = new AppMenuButtonHelper(menuHandler);
    mAppMenuButtonHelper.setOnAppMenuShownListener(new Runnable() {
        @Override
        public void run() {
            RecordUserAction.record("MobileToolbarShowMenu");
            mToolbar.onMenuShown();
        }
    });
}