Search in sources :

Example 1 with AppMenuButtonHelper

use of org.chromium.chrome.browser.appmenu.AppMenuButtonHelper in project AndroidChromium by JackyAndroid.

the class EmptyBackgroundViewTablet method setMenuOnTouchListener.

/**
     * Creates an on touch listener for the menu button using the given menu handler.
     * @param menuHandler The menu handler to be used for showing the pop up menu.
     */
public void setMenuOnTouchListener(final AppMenuHandler menuHandler) {
    final ImageButton menuBtn = (ImageButton) findViewById(R.id.empty_menu_button);
    final AppMenuButtonHelper menuPopupButtonHelper = new AppMenuButtonHelper(menuHandler);
    menuBtn.setOnTouchListener(menuPopupButtonHelper);
    menuPopupButtonHelper.setOnAppMenuShownListener(new Runnable() {

        @Override
        public void run() {
            RecordUserAction.record("MobileToolbarShowMenu");
        }
    });
}
Also used : AppMenuButtonHelper(org.chromium.chrome.browser.appmenu.AppMenuButtonHelper) ImageButton(android.widget.ImageButton)

Example 2 with AppMenuButtonHelper

use of org.chromium.chrome.browser.appmenu.AppMenuButtonHelper in project AndroidChromium by JackyAndroid.

the class ToolbarManager method setMenuHandler.

/**
     * 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);
}
Also used : AppMenuButtonHelper(org.chromium.chrome.browser.appmenu.AppMenuButtonHelper) AppMenuObserver(org.chromium.chrome.browser.appmenu.AppMenuObserver)

Aggregations

AppMenuButtonHelper (org.chromium.chrome.browser.appmenu.AppMenuButtonHelper)2 ImageButton (android.widget.ImageButton)1 AppMenuObserver (org.chromium.chrome.browser.appmenu.AppMenuObserver)1