Ejemplo n.º 1
0
 @Override
 public MenuWrapper getMenu() {
   if (mMenu == null) {
     mMenu = new MenuWrapper(mActionMode.getMenu());
   }
   return mMenu;
 }
Ejemplo n.º 2
0
  /**
   * https://android.googlesource.com/platform/frameworks/base/+/cd92588/core/java/android/webkit/SelectActionModeCallback.java
   *
   * @param actionMode
   * @return ActionMode
   */
  @Override
  public ActionMode onWebViewStartActionMode(ActionMode actionMode) {
    Menu menu = actionMode.getMenu();

    for (int i = 0; i < menu.size(); i++) {
      MenuItem item = menu.getItem(i);
      item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    }

    MenuInflater inflater = actionMode.getMenuInflater();
    inflater.inflate(R.menu.browser_action_mode, menu);
    translatePanelFragment.hide();

    menu.findItem(R.id.action_search)
        .setOnMenuItemClickListener(
            new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem menuItem) {
                startGettingSelectionInBrowser(JAVASCRIPT_CALLBACK_SEARCH);
                return false;
              }
            });
    menu.findItem(R.id.action_speech)
        .setOnMenuItemClickListener(
            new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem menuItem) {
                startGettingSelectionInBrowser(JAVASCRIPT_CALLBACK_SPEECH);
                return false;
              }
            });

    return actionMode;
  }
Ejemplo n.º 3
0
 public Menu getMenu() {
   return MenuWrapperFactory.createMenuWrapper(mWrappedObject.getMenu());
 }