@Override public boolean onOptionsItemSelected(MenuItem item) { // Pass the event to ActionBarDrawerToggle, if it returns // true, then it has handled the app icon touch event //noinspection SimplifiableIfStatement if (mDrawerToggle.isDrawerIndicatorEnabled() && mDrawerToggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@Override protected void onPostCreate(Bundle savedInstanceState) { // 需要将ActionDrawerToggle与DrawerLayout的状态同步 // 将ActionBarDrawerToggle中的drawer图标,设置为ActionBar中的Home-Button的Icon super.onPostCreate(savedInstanceState); mDrawerToggle.syncState(); }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (drawerToggle.onOptionsItemSelected(item)) { return true; } return true; }
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { case R.id.action_share: // updateShareIntent(); showShare(); return true; case R.id.action_share_wechat: // updateShareIntent(); showShareWeChat(); return true; // case R.id.action_about: // showAbout(); // return true; default: return super.onOptionsItemSelected(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. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { case R.id.action_logout: ParseUser.logOut(); navigateToLogin(); return true; case R.id.popup_menu_product1: Intent intent = new Intent(this, AddProduct1_Activity.class); startActivity(intent); return true; case R.id.popup_menu_product2: Intent intent2 = new Intent(this, AddProduct2_Activity.class); startActivity(intent2); return true; default: return super.onOptionsItemSelected(item); } }
@Override public void onConfigurationChanged(final Configuration newConfig) { super.onConfigurationChanged(newConfig); if (!isTablet()) { drawerToggle.onConfigurationChanged(newConfig); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle == null) { return super.onOptionsItemSelected(item); } // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case MENU_ID_PREFERENCE: { Intent intent = new Intent(this, PreferencesActivity.class); startActivity(intent); return true; } case MENU_ID_HELP: { Intent intent = new Intent(this, HelpActivity.class); startActivity(intent); return true; } default: return super.onOptionsItemSelected(item); } }
public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } return false; }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (drawerListener.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (!mTabletLandscape) { mDrawerToggle.onConfigurationChanged(newConfig); } }
@SuppressWarnings("deprecation") @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggles mDrawerToggle.onConfigurationChanged(newConfig); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet // Intent intent = new // Intent(Intent.ACTION_WEB_SEARCH);//默认的打开浏览器,是www.google.com Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://www.baidu.com")); // 指定特定的网址显示 intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (Logging.DEBUG) Log.d(Logging.TAG, "BOINCActivity onOptionsItemSelected()"); // toggle drawer if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.run_mode: if (item.getTitle().equals(getApplication().getString(R.string.menu_run_mode_disable))) { if (Logging.DEBUG) Log.d(Logging.TAG, "run mode: disable"); new WriteClientModeAsync().execute(BOINCDefs.RUN_MODE_NEVER); } else if (item.getTitle() .equals(getApplication().getString(R.string.menu_run_mode_enable))) { if (Logging.DEBUG) Log.d(Logging.TAG, "run mode: enable"); new WriteClientModeAsync().execute(BOINCDefs.RUN_MODE_AUTO); } else if (Logging.DEBUG) Log.d(Logging.TAG, "run mode: unrecognized command"); return true; case R.id.projects_add: startActivity(new Intent(this, SelectionListActivity.class)); return true; default: return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { // toggle nav drawer on selecting action bar app icon/title if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action bar actions click switch (item.getItemId()) { case R.id.action_search: // search action return true; case R.id.action_location_found: // location found LocationFound(); return true; case R.id.action_login: // login login(); return true; case R.id.action_profile: profile(); return true; case R.id.action_logOut: logOut(); return true; default: return super.onOptionsItemSelected(item); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } Intent intent; switch (item.getItemId()) { case R.id.add_keyring: intent = new Intent(this, KeyringActivity.class); this.startActivity(intent); break; case R.id.remove_keyring: delete(position); break; case R.id.change_keyring_password: changePassword(position); break; case R.id.action_settings: intent = new Intent(this, SettingsActivity.class); this.startActivity(intent); break; case R.id.add_secret: intent = new Intent(this, PasswordActivity.class); intent.putExtra(PasswordActivity.NEW_SECRET, true); intent.putExtra(PasswordActivity.KEYRING_POSITION, position); startActivityForResult(intent, PASSWORD_ACTIVITY); break; } return super.onOptionsItemSelected(item); }
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (drawerToggle != null) { drawerToggle.syncState(); } }
@Override public void onDrawerOpened(View drawerView) { // TODO Auto-generated method stub super.onDrawerOpened(drawerView); invalidateOptionsMenu(); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggles if (mDrawerToggle != null) { mDrawerToggle.onConfigurationChanged(newConfig); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (mDrawerToggle != null) return mDrawerToggle.onOptionsItemSelected(item); else break; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { android.view.MenuItem homeMenuItem = new HomeMenuItemForNavigationDrawer(); drawerToggle.onOptionsItemSelected(homeMenuItem); return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_search) { Toast.makeText(this, "搜索", Toast.LENGTH_SHORT).show(); return true; } return mDrawerToggle.onOptionsItemSelected(item) | super.onOptionsItemSelected(item); }
// Selection-of-Menu @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_refresh: Intent i = new Intent(Sunday.this, SundayActivity.class); startActivity(i); break; case R.id.action_settings: mySQL.DeleteAll(); onCreate(new Bundle()); break; case R.id.notification: Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); Intent not_Intent; if (item.isChecked()) { item.setChecked(false); editor = someData.edit(); editor.putBoolean("CHECK", false); editor.commit(); nm.cancel(0); } else { item.setChecked(true); editor = someData.edit(); editor.putBoolean("CHECK", true); editor.commit(); if ((values.length != 0) && day == Calendar.SUNDAY) { nm.notify(0, n); } else if (day == Calendar.WEDNESDAY) { not_Intent = new Intent(Sunday.this, Wednesday.class); startActivity(not_Intent); } else if (day == Calendar.THURSDAY) { not_Intent = new Intent(Sunday.this, Thursday.class); startActivity(not_Intent); } else if (day == Calendar.FRIDAY) { not_Intent = new Intent(Sunday.this, Friday.class); startActivity(not_Intent); } else if (day == Calendar.TUESDAY) { not_Intent = new Intent(Sunday.this, Tuesday.class); startActivity(not_Intent); } else if (day == Calendar.SATURDAY) { not_Intent = new Intent(Sunday.this, Saturday.class); startActivity(not_Intent); } else if (day == Calendar.MONDAY) { not_Intent = new Intent(Sunday.this, Monday.class); startActivity(not_Intent); } break; } } if (drawertoggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@SuppressWarnings("deprecation") @Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } if (item.getItemId() == R.id.settings) { startActivity(new Intent(this, Prefs.class)); return true; } if (item.getTitle().toString().contains("Sort by")) { if (sortDir.equals("DESC")) { sortDir = "ASC"; } else { sortDir = "DESC"; } } if (item.getTitle().toString().equals("Sort by Title")) { sortStr = "title"; try { populateMyMovies(lv); } catch (ParseException e) { e.printStackTrace(); } return true; } if (item.getTitle().toString().equals("Sort by Rating")) { sortStr = "rating"; try { populateMyMovies(lv); } catch (ParseException e) { e.printStackTrace(); } return true; } if (item.getTitle().toString().equals("Sort by Theater")) { sortStr = "theater_id"; try { populateMyMovies(lv); } catch (ParseException e) { e.printStackTrace(); } return true; } switch (item.getItemId()) { case android.R.id.home: return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@Override protected void onPostCreate(final Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getCurrentUser(); if (!isTablet()) { // was // Sync the toggle state after onRestoreInstanceState has occurred. drawerToggle.syncState(); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // TODO Handle your other itmes... return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } return super.onOptionsItemSelected(item); }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { } return super.onOptionsItemSelected(item); }