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

The following examples show how to use org.chromium.chrome.browser.appmenu.AppMenuHandler. 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: EmptyBackgroundViewTablet.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * 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");
        }
    });
}
 
Example #4
Source File: EmptyBackgroundViewTablet.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * 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");
        }
    });
}
 
Example #5
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();
        }
    });
}
 
Example #6
Source File: EmptyBackgroundViewTablet.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * 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");
        }
    });
}
 
Example #7
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public AppMenuHandler get(
        Activity activity, AppMenuPropertiesDelegate delegate, int menuResourceId) {
    return new AppMenuHandler(activity, delegate, menuResourceId);
}
 
Example #8
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return The {@link AppMenuHandler} associated with this activity.
 */
@VisibleForTesting
public AppMenuHandler getAppMenuHandler() {
    return mAppMenuHandler;
}
 
Example #9
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public AppMenuHandler get(
        Activity activity, AppMenuPropertiesDelegate delegate, int menuResourceId) {
    return new AppMenuHandler(activity, delegate, menuResourceId);
}
 
Example #10
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return The {@link AppMenuHandler} associated with this activity.
 */
@VisibleForTesting
public AppMenuHandler getAppMenuHandler() {
    return mAppMenuHandler;
}
 
Example #11
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public AppMenuHandler get(
        Activity activity, AppMenuPropertiesDelegate delegate, int menuResourceId) {
    return new AppMenuHandler(activity, delegate, menuResourceId);
}
 
Example #12
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return The {@link AppMenuHandler} associated with this activity.
 */
@VisibleForTesting
public AppMenuHandler getAppMenuHandler() {
    return mAppMenuHandler;
}
 
Example #13
Source File: ChromeActivity.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * @return AppMenuHandler for the given activity and menu resource id.
 */
public AppMenuHandler get(Activity activity, AppMenuPropertiesDelegate delegate,
        int menuResourceId);
 
Example #14
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * @return AppMenuHandler for the given activity and menu resource id.
 */
public AppMenuHandler get(Activity activity, AppMenuPropertiesDelegate delegate,
        int menuResourceId);
 
Example #15
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * @return AppMenuHandler for the given activity and menu resource id.
 */
public AppMenuHandler get(Activity activity, AppMenuPropertiesDelegate delegate,
        int menuResourceId);