@Override public boolean onContextItemSelected(android.view.MenuItem item) { if (item.getGroupId() == MENU_GROUP_FILTER) { // give an initial value for the row before adding it CustomFilterCriterion criterion = filterCriteriaProvider.getAll().get(item.getItemId()); final CriterionInstance instance = new CriterionInstance(); instance.criterion = criterion; adapter.showOptionsFor( instance, new Runnable() { @Override public void run() { adapter.add(instance); updateList(); } }); return true; } // item type context item else if (item.getGroupId() == MENU_GROUP_CONTEXT_TYPE) { CriterionInstance instance = adapter.getItem(item.getOrder()); instance.type = item.getItemId(); updateList(); } // delete context item else if (item.getGroupId() == MENU_GROUP_CONTEXT_DELETE) { CriterionInstance instance = adapter.getItem(item.getOrder()); adapter.remove(instance); updateList(); } return super.onContextItemSelected(item); }
@Override public boolean onContextItemSelected(MenuItem item) { // return super.onContextItemSelected(item); // RecyclerContextMenuInfo info = (RecyclerContextMenuInfo) item.getMenuInfo(); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int clickedItemPosition = item.getOrder(); switch (item.getItemId()) { case 1: Intent intent_client = new Intent(this.getActivity(), AddClientActivity.class); startActivityForResult(intent_client, CLIENT_ACTIVITY_CREATE); // MainActivity.editClient(); break; case 2: dbHelper.deleteClient(clickedItemPosition); Toast.makeText(this.getActivity(), "Delete" + clickedItemPosition, Toast.LENGTH_LONG) .show(); fillData(); return true; } return super.onContextItemSelected(item); }
@Override public boolean onMenuItemClick(MenuItem item) { if (!mConsumed) { mSuccess.invoke(UIManagerModuleConstants.ACTION_ITEM_SELECTED, item.getOrder()); mConsumed = true; return true; } return false; }
private static int findInsertIndex(ArrayList<? extends MenuItem> items, int order) { for (int i = items.size() - 1; i >= 0; i--) { MenuItem item = items.get(i); if (item.getOrder() <= order) { return i + 1; } } return 0; }
@Override public boolean onContextItemSelected(MenuItem item) { switch (item.getOrder()) { case MENU_DELETE: itemList.deleteItem(item.getItemId()); return true; default: return super.onContextItemSelected(item); } }
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { // TODO Auto-generated method stub // com.monitor.utils.Log.i(featureId + "_" + item.getTitle().toString() + "_" + item.getItemId() // + "_" + item.getOrder()); switch (item.getOrder()) { case 100: // setting ((LinearLayout) findViewById(R.id.top_bar)).getChildAt(3).performClick(); break; case 101: // about Redirect.toAbout(this); break; } return super.onMenuItemSelected(featureId, item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); StringBuilder sb = new StringBuilder(); sb.append("Item Menu"); sb.append("\r\n groupId: " + String.valueOf(item.getGroupId())); sb.append("\r\n itemId: " + String.valueOf(item.getItemId())); sb.append("\r\n order: " + String.valueOf(item.getOrder())); sb.append("\r\n title: " + item.getTitle()); tv.setText(sb.toString()); return super.onOptionsItemSelected(item); }
@Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); SceneListAdapter ada = (SceneListAdapter) listaScenesView.getAdapter(); long arrayAdapterPosition = info.position; final SoulissScene todoItem = (SoulissScene) ada.getItem((int) arrayAdapterPosition); switch (item.getItemId()) { case R.id.eseguiScena: ScenesDialogHelper.executeSceneDialog(SceneListActivity.this, todoItem, opzioni); return true; case R.id.eliminaScena: ScenesDialogHelper.removeSceneDialog(this, listaScenesView, datasource, todoItem, opzioni); return true; case R.id.rinominaScena: AlertDialog.Builder alert3 = AlertDialogHelper.renameSoulissObjectDialog( this, null, listaScenesView, datasource, todoItem); alert3.show(); return true; case R.id.scegliconaScena: SoulissScene convertView = (SoulissScene) listaScenesView.getItemAtPosition(item.getOrder()); ImageView at = new ImageView(getApplicationContext()); at.setImageResource(convertView.getIconResourceId()); AlertDialog.Builder alert2 = AlertDialogHelper.chooseIconDialog(this, at, listaScenesView, datasource, todoItem); alert2.show(); // nodesAdapter.notifyDataSetChanged(); // listaNodiView.invalidateViews(); return true; default: return super.onContextItemSelected(item); } }
@Override public int getOrder() { return mNativeItem.getOrder(); }
@Override public int getOrder() { return mMenuItem.getOrder(); }