/* (non-Javadoc)
  * @see android.view.ActionMode.Callback#onCreateActionMode(android.view.ActionMode, android.view.Menu)
  */
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.activity_client_connections_contextual, menu);
   clientConnections.contextualActionBarActive = true;
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   selectedPos = new HashSet<Integer>();
   mode.setSubtitle(R.string.selected);
   mode.getMenuInflater().inflate(R.menu.action_contact_list, menu);
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   // Inflate the menu for the CAB
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.context, menu);
   return true;
 }
Ejemplo n.º 4
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.º 5
0
 @Override
 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
   menu.clear();
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.newconversation_context, menu);
   SparseBooleanArray checkedItems = contactsView.getCheckedItemPositions();
   selectedContacts.clear();
   for (int i = 0; i < aggregatedContacts.size(); ++i) {
     if (checkedItems.get(i, false)) {
       selectedContacts.add(aggregatedContacts.get(i));
     }
   }
   if (selectedContacts.size() == 0) {
     menu.findItem(R.id.action_start_conversation).setVisible(false);
     menu.findItem(R.id.action_contact_details).setVisible(false);
     menu.findItem(R.id.action_invite).setVisible(false);
     menu.findItem(R.id.action_invite_to_existing).setVisible(false);
   } else if ((selectedContacts.size() == 1) && (!inviteIntent)) {
     menu.findItem(R.id.action_start_conversation).setVisible(true);
     menu.findItem(R.id.action_contact_details).setVisible(true);
     menu.findItem(R.id.action_invite).setVisible(false);
     menu.findItem(R.id.action_invite_to_existing).setVisible(true);
   } else if (!inviteIntent) {
     menu.findItem(R.id.action_start_conversation).setVisible(true);
     menu.findItem(R.id.action_contact_details).setVisible(false);
     menu.findItem(R.id.action_invite).setVisible(false);
     menu.findItem(R.id.action_invite_to_existing).setVisible(true);
   } else {
     menu.findItem(R.id.action_invite).setVisible(true);
     menu.findItem(R.id.action_start_conversation).setVisible(false);
     menu.findItem(R.id.action_contact_details).setVisible(false);
     menu.findItem(R.id.action_invite_to_existing).setVisible(false);
   }
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.cab_jsonarray, menu);
   mode.setTitle(mCheckedCount + getString(R.string.desc_selected));
   return true;
 }
 // Called when the action mode is created; startActionMode() was called
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   // Inflate a menu resource providing context menu items
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.menu_cab, menu);
   return true;
 }
Ejemplo n.º 8
0
  @Override
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    // TODO Auto-generated method stub
    MenuInflater inflater = mode.getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    return true;
  }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.list_view_selection_menu, menu);
   ExampleActivity ea = (ExampleActivity) getActivity();
   ea.toggleExampleInfoMenuStripVisibility(false);
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
   mActionMode = actionMode;
   MenuInflater inflater = actionMode.getMenuInflater();
   inflater.inflate(R.menu.menu_comments_cab, menu);
   mPullToRefreshHelper.setEnabled(false);
   return true;
 }
Ejemplo n.º 11
0
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   // Inflate the menu for the CAB
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.save_list, menu);
   selection = new TreeSet<Long>();
   return true;
 }
Ejemplo n.º 12
0
 @Override
 public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
   // Se infla la especificación del menú contextual en el
   // menú.
   actionMode.getMenuInflater().inflate(R.menu.fragment_lista_alumnos, menu);
   // Se retorna que ya se ha gestionado el evento.
   return true;
 }
  @Override
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = mode.getMenuInflater();
    inflater.inflate(R.menu.selection_cab, menu);
    MenuItem item = menu.findItem(R.id.menu_item_share);
    mShareActionProvider = (ShareActionProvider) item.getActionProvider();

    return true;
  }
        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
          MenuInflater menuInflater = mode.getMenuInflater();
          menuInflater.inflate(R.menu.menu_contextual_action_bar, menu);

          actionMode = mode;
          countSelected = 0;

          return true;
        }
  @Override
  public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = mode.getMenuInflater();
    menu.clear();

    // sina weibo has bug,everyone's following is false
    inflater.inflate(R.menu.contextual_menu_fragment_user_listview, menu);
    //        if(bean.isFollowing()){
    //           menu.findItem(R.id.menu_follow).setVisible(false);
    //        }

    mode.setTitle(bean.getScreen_name());

    return true;
  }
Ejemplo n.º 16
0
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {

    mActionMode = mode;

    // First inflate the menu - default action
    mode.getMenuInflater().inflate(mMenuResId, menu);

    // Now, parse the menu
    XmlResourceParser parser = mContext.getResources().getXml(mMenuResId);
    try {
      int eventType = parser.getEventType();
      while (eventType != XmlResourceParser.END_DOCUMENT) {
        if (eventType == XmlResourceParser.START_TAG) {
          int id = parser.getAttributeResourceValue(Binder.ANDROID_NAMESPACE, "id", -1);
          MenuItem mi = menu.findItem(id);
          if (mi != null) {
            String nodeName = parser.getName();
            if (id > 0) {
              AttributeSet attrs = Xml.asAttributeSet(parser);
              AbsMenuBridge item = null;
              if ("item".equals(nodeName)) {
                item = new MenuItemBridge(id, attrs, mContext, mModel, this);
              } else if ("group".equals(nodeName)) {
                item = new MenuGroupBridge(id, attrs, mContext, mModel, this);
              }
              if (item != null) {
                items.put(id, item);
              }
            }
          }
        }
        eventType = parser.next();
      }
    } catch (XmlPullParserException e) {
      e.printStackTrace();
    } catch (IOException ex) {
      ex.printStackTrace();
    }

    for (AbsMenuBridge item : items.values()) {
      item.onCreateOptionItem(menu);
      item.onPrepareOptionItem(menu);
    }
    return true;
  }
  private void createActionMenu(ActionMode mode, Menu menu) {
    mode.getMenuInflater().inflate(R.menu.select_action_menu, menu);
    if (!mEditable || !canPaste()) {
      menu.removeItem(R.id.select_action_menu_paste);
    }

    if (!mEditable) {
      menu.removeItem(R.id.select_action_menu_cut);
    }

    if (mEditable || !mActionHandler.isShareAvailable()) {
      menu.removeItem(R.id.select_action_menu_share);
    }

    if (mEditable || mIncognito || !mActionHandler.isWebSearchAvailable()) {
      menu.removeItem(R.id.select_action_menu_web_search);
    }
  }
Ejemplo n.º 18
0
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   mode.getMenuInflater().inflate(R.menu.menu_action, menu);
   return true;
 }
Ejemplo n.º 19
0
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   mode.getMenuInflater().inflate(R.menu.contextual_menu_draftfragment, menu);
   return true;
 }
Ejemplo n.º 20
0
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.menu_cab_lista_viagens, menu);
   return true;
 }
 @Override
 public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
   mActionMode = mode;
   mode.getMenuInflater().inflate(R.menu.action_multi_select_items, menu);
   return true;
 }
 // Called when the action mode is created; startActionMode() was called
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   mode.setTitle("Remove Item");
   mode.getMenuInflater().inflate(R.menu.menu_item, menu);
   return true;
 }
Ejemplo n.º 23
0
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.files_action_mode, menu);
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.selected_screen, menu);
   return true;
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   // TODO Auto-generated method stub
   mode.getMenuInflater().inflate(R.menu.contextual_menu, menu);
   return true;
 }
 public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
   final MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.context_menu, menu);
   return true;
 }
 // Called when the action mode is created by calling startActionMode()
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   // Inflate a menu resource providing content menu items
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.service_entries_list_content_menu, menu);
   return true;
 }
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.input_history_action_mode_menu, menu);
   return true;
 }
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   /* Inflate a menu resource with context menu items. */
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.editaction, menu);
   return true;
 }