List of usage examples for android.view MenuItem getOrder
public int getOrder();
From source file:com.skubit.iab.activities.SkubitAndroidActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int order = item.getOrder(); if (order == 2) { Intent intent = AppRequestActivity.newInstance(this, null, Permissions.SKUBIT_DEFAULT); startActivity(intent);//from w ww.java2 s . c o m } else if (order == 3) { startBarcodeScan(); } else if (order == 4) { Intent i = new Intent(); i.setClass(this, DisplayLicensesActivity.class); startActivity(i); } else if (order == 5) { } else if (order == 6) { } return super.onOptionsItemSelected(item); }
From source file:com.google.android.apps.iosched.util.actionmodecompat.ActionModeBase.java
/**{@inheritDoc}*/ @Override/* w w w. j ava 2 s.c om*/ public void invalidate() { mMenuItemArrayAdapter.clear(); List<MenuItem> items = new ArrayList<MenuItem>(); for (int i = 0; i < mMenu.size(); i++) { MenuItem item = mMenu.getItem(i); if (item.isVisible()) { items.add(item); } } Collections.sort(items, new Comparator<MenuItem>() { @Override public int compare(MenuItem a, MenuItem b) { return a.getOrder() - b.getOrder(); } }); for (MenuItem item : items) { mMenuItemArrayAdapter.add(item); } }
From source file:com.skubit.satoshidice.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int order = item.getOrder(); if (order == 0) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }//from ww w.j a va 2s .c o m } else if (order == 1) { Intent intent = new Intent(); intent.setClass(this, CreateAccountActivity.class); startActivity(intent); } else if (order == 2) { Intent i = new Intent(); i.setClass(this, CashoutActivity.class); startActivity(i); } else if (order == 3) { Intent i = new Intent(); i.setClass(this, DepositActivity.class); startActivity(i); } else if (order == 4) { Intent i = new Intent(); i.setClass(this, DisplayLicensesActivity.class); startActivity(i); } return super.onOptionsItemSelected(item); }
From source file:com.boardgamegeek.util.actionmodecompat.ActionModeBase.java
/** * {@inheritDoc}/* www. j a v a 2 s. co m*/ */ @Override public void invalidate() { mMenuItemArrayAdapter.clear(); List<MenuItem> items = new ArrayList<>(); for (int i = 0; i < mMenu.size(); i++) { MenuItem item = mMenu.getItem(i); if (item.isVisible()) { items.add(item); } } Collections.sort(items, new Comparator<MenuItem>() { @Override public int compare(MenuItem a, MenuItem b) { return a.getOrder() - b.getOrder(); } }); for (MenuItem item : items) { mMenuItemArrayAdapter.add(item); } }
From source file:com.skubit.comics.activities.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int order = item.getOrder(); if (order == 1) { Utils.startAuthorization(this); } else if (order == 4) { Intent i = new Intent(); i.setClass(this, DisplayLicensesActivity.class); startActivity(i);//from w ww .jav a2s. co m return true; } return super.onOptionsItemSelected(item); }
From source file:com.facebook.react.views.toolbar.ReactToolbarManager.java
@Override protected void addEventEmitters(final ThemedReactContext reactContext, final ReactToolbar view) { final EventDispatcher mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class) .getEventDispatcher();/* www . j ava 2 s. co m*/ view.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mEventDispatcher.dispatchEvent(new ToolbarClickEvent(view.getId(), -1)); } }); view.setOnMenuItemClickListener(new ReactToolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { mEventDispatcher.dispatchEvent(new ToolbarClickEvent(view.getId(), menuItem.getOrder())); return true; } }); }
From source file:com.white.bihudaily.module.dailys.DailyActivity.java
private void setupDrawerContent(NavigationView navigationView) { navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override//from ww w . j av a2s .c o m public boolean onNavigationItemSelected(MenuItem menuItem) { int themeId = menuItem.getOrder(); switch (menuItem.getItemId()) { case R.id.menu_main_page: // mDailyFragment = (DailyFragment) getSupportFragmentManager() .findFragmentByTag(Constant.TAG_MAIN); if (mDailyFragment == null) { mDailyFragment = new DailyFragment(); } switchFragment(mDailyFragment, Constant.TAG_MAIN, getResources().getString(R.string.index)); break; default: // ? ThemesFragment themesFragment = (ThemesFragment) getSupportFragmentManager() .findFragmentByTag(themeId + ""); if (themesFragment == null) { themesFragment = ThemesFragment.newInstance(themeId); } switchFragment(themesFragment, themeId + "", menuItem.getTitle().toString()); break; } // ?? menuItem.setChecked(true); mDrawerLayout.closeDrawers(); return true; } }); }
From source file:com.skubit.android.SkubitAndroidActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int order = item.getOrder(); if (order == 0) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }/*ww w .j av a2 s . c om*/ } else if (order == 1) { Intent intent = new Intent(); intent.setClass(this, LoginActivity.class); startActivity(intent); } else if (order == 2) { Intent i = new Intent(); i.setClass(this, RequestMoneyActivity.class); startActivity(i); } else if (order == 3) { Intent i = new Intent(); i.setClass(this, SendMoneyActivity.class); startActivity(i); } else if (order == 4) { Intent i = new Intent(); i.setClass(this, QrCodeActivity.class); startActivity(i); } else if (order == 5) { Intent i = new Intent(); i.setClass(this, DisplayLicensesActivity.class); startActivity(i); } return super.onOptionsItemSelected(item); }
From source file:test.red.house.DeviceFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); Log.d("DeviceFragment", "item = " + item + ", getGroupId() = " + item.getGroupId()); if (item.getGroupId() == 0) { switch (item.getOrder()) { case 0:/*from ww w. ja v a2s . com*/ Log.d("DeviceFragment", "item.getOrder() = 0"); Cursor c = (Cursor) getListAdapter().getItem(info.position); Log.d("DeviceFragment", "Device OPTION1 remove object: " + c.getInt(0)); MainActivity.db.removeDevice(c.getInt(0)); c.close(); Cursor c1 = MainActivity.db.getDevices(); DeviceFragment.adapter.changeCursor(c1); return true; case 1: return true; default: } return super.onContextItemSelected(item); } else if (item.getGroupId() == 1) { switch (item.getOrder()) { case 0: Log.d("DeviceFragment", "P"); // Cursor c = (Cursor) getListAdapter().getItem(info.position); Cursor c = (Cursor) SensorFragment.adapter.getItem(info.position); Log.d("DeviceFragment", "Sensor OPTION1 remove object:" + c.getInt(0)); MainActivity.db.removeSensor(c.getInt(0)); c.close(); Cursor c1 = MainActivity.db.getSensors(); SensorFragment.adapter.changeCursor(c1); return true; case 1: return true; default: } return super.onContextItemSelected(item); } else { return true; } }
From source file:com.paranoid.gerrit.PatchSetViewerFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { String tab = null;// w ww. j a v a 2 s. c o m switch (item.getOrder()) { case OWNER: tab = CardsFragment.KEY_OWNER; break; case REVIEWER: tab = CardsFragment.KEY_REVIEWER; } committerObject.setState(tab); Intent intent = new Intent(mParent, ReviewTab.class); intent.putExtra(CardsFragment.KEY_DEVELOPER, committerObject); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); return true; }