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

The following examples show how to use org.chromium.chrome.browser.appmenu.AppMenuButtonHelper. 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 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 #4
Source File: ToolbarLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the external dependencies required for view interaction.
 * @param toolbarDataProvider The provider for toolbar data.
 * @param tabController       The controller that handles interactions with the tab.
 * @param appMenuButtonHelper The helper for managing menu button interactions.
 */
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    mToolbarDataProvider = toolbarDataProvider;
    mToolbarTabController = tabController;

    mMenuButton.setOnTouchListener(new OnTouchListener() {
        @Override
        @SuppressLint("ClickableViewAccessibility")
        public boolean onTouch(View v, MotionEvent event) {
            return onMenuButtonTouchEvent(v, event);
        }
    });
    mAppMenuButtonHelper = appMenuButtonHelper;
}
 
Example #5
Source File: ToolbarLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the external dependencies required for view interaction.
 * @param toolbarDataProvider The provider for toolbar data.
 * @param tabController       The controller that handles interactions with the tab.
 * @param appMenuButtonHelper The helper for managing menu button interactions.
 */
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    mToolbarDataProvider = toolbarDataProvider;
    mToolbarTabController = tabController;

    mAppMenuButtonHelper = appMenuButtonHelper;

    mMenuButton.setOnTouchListener(mAppMenuButtonHelper);
    mMenuButton.setAccessibilityDelegate(mAppMenuButtonHelper);
}
 
Example #6
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 #7
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 #8
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 #9
Source File: ToolbarLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the external dependencies required for view interaction.
 * @param toolbarDataProvider The provider for toolbar data.
 * @param tabController       The controller that handles interactions with the tab.
 * @param appMenuButtonHelper The helper for managing menu button interactions.
 */
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    mToolbarDataProvider = toolbarDataProvider;
    mToolbarTabController = tabController;

    mMenuButton.setOnTouchListener(new OnTouchListener() {
        @Override
        @SuppressLint("ClickableViewAccessibility")
        public boolean onTouch(View v, MotionEvent event) {
            return onMenuButtonTouchEvent(v, event);
        }
    });
    mAppMenuButtonHelper = appMenuButtonHelper;
}
 
Example #10
Source File: CustomTabToolbar.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    super.initialize(toolbarDataProvider, tabController, appMenuButtonHelper);
    updateVisualsForState();
}
 
Example #11
Source File: ToolbarLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return The helper for menu button UI interactions.
 */
protected AppMenuButtonHelper getMenuButtonHelper() {
    return mAppMenuButtonHelper;
}
 
Example #12
Source File: CustomTabToolbar.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    super.initialize(toolbarDataProvider, tabController, appMenuButtonHelper);
    updateVisualsForState();
}
 
Example #13
Source File: ToolbarLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return The helper for menu button UI interactions.
 */
protected AppMenuButtonHelper getMenuButtonHelper() {
    return mAppMenuButtonHelper;
}
 
Example #14
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void setMenuButtonHelper(AppMenuButtonHelper helper) { }
 
Example #15
Source File: ToolbarLayout.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return The helper for menu button UI interactions.
 */
protected AppMenuButtonHelper getMenuButtonHelper() {
    return mAppMenuButtonHelper;
}
 
Example #16
Source File: CustomTabToolbar.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(ToolbarDataProvider toolbarDataProvider,
        ToolbarTabController tabController, AppMenuButtonHelper appMenuButtonHelper) {
    super.initialize(toolbarDataProvider, tabController, appMenuButtonHelper);
    updateVisualsForState();
}
 
Example #17
Source File: LocationBarLayout.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void setMenuButtonHelper(AppMenuButtonHelper helper) { }
 
Example #18
Source File: LocationBar.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the menu helper that should be used if there is a menu button in {@link LocationBar}.
 * @param helper The helper to be used.
 */
void setMenuButtonHelper(AppMenuButtonHelper helper);
 
Example #19
Source File: LocationBar.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the menu helper that should be used if there is a menu button in {@link LocationBar}.
 * @param helper The helper to be used.
 */
void setMenuButtonHelper(AppMenuButtonHelper helper);