Example #1
0
 @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);
   }
 }
Example #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (drawerToggle.onOptionsItemSelected(item)) {
     return true;
   }
   return true;
 }
Example #3
0
 @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);
   }
 }
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle.onOptionsItemSelected(item)) {
      return true;
    }

    return false;
  }
Example #5
0
  @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);
    }
  }
Example #7
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (drawerListener.onOptionsItemSelected(item)) {
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
Example #8
0
  @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);
    }
  }
Example #9
0
  @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);
  }
Example #10
0
  @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);
    }
  }
Example #11
0
 @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);
 }
Example #12
0
  @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);
  }
Example #14
0
  // 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);
  }
Example #15
0
 @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);
 }
Example #16
0
 @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);
 }
Example #17
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if (mDrawerToggle.onOptionsItemSelected(item)) {

      return true;
    }
    return super.onOptionsItemSelected(item);
  }
 @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);
 }
Example #19
0
  @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);
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int id = item.getItemId();
   if (mDrawerToggle.onOptionsItemSelected(item)) {
     return true;
   }
   if (id == R.id.action_settings) {
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_add_category) {
      Intent intent = new Intent(this, AddCategoryActivity.class);
      startActivityForResult(intent, ADD_NEW_CAT);
      return true;
    }

    return actionBarDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
  }
Example #24
0
 @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()) {
   //		default:
   return super.onOptionsItemSelected(item);
   //		}
 }
Example #25
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        drawerLayout.closeDrawer(Gravity.START);
        break;

      case R.id.menu_refresh:
        mainFragment.adapter.reloadNew();
        break;

      case R.id.menu_settings:
        startActivity(new Intent(getApplicationContext(), Settings.class));
        break;

      case R.id.menu_add_call:
        {
          if (accountAlreadyAdded(Item.Type.CALL)) {
            showDialog("Cannot add", "You've already added a Call Logs account.");
          } else if (new Refresh(getApplicationContext()).canGetCalls()) {
            addAccount(new Account(Item.Type.CALL, null));
          } else {
            showDialog("Cannot add", "Call Logs couldn't be retrieved from your device.");
          }

          break;
        }

      case R.id.menu_add_sms:
        {
          if (accountAlreadyAdded(Item.Type.SMS)) {
            showDialog("Cannot add", "You've already added an SMS Messages account.");
          } else if (new Refresh(getApplicationContext()).canGetCalls()) {
            addAccount(new Account(Item.Type.SMS, null));
          } else {
            showDialog("Cannot add", "SMS Messages couldn't be retrieved from your device.");
          }

          break;
        }

      case R.id.menu_add_tw_mn:
        break;

      case R.id.menu_add_tw_dm:
        break;

      case R.id.menu_add_gmail:
        break;
    }

    return drawerAbToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle.onOptionsItemSelected(item)) {
      return true;
    }

    if (item.getItemId() == R.id.action_example) {
      Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle.onOptionsItemSelected(item)) {
      return true;
    }

    if (item.getItemId() == R.id.action_settings) {
      startActivity(i);
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
Example #28
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // 将ActionBar上的图标与Drawer结合起来
   if (mDrawerToggle.onOptionsItemSelected(item)) {
     return true;
   }
   int id = item.getItemId();
   if (id == R.id.action_settings) {
     item.setVisible(false);
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // if (appInitialized) {
   if (mDrawerToggle.onOptionsItemSelected(item)) {
     return true;
   } else {
     // UserTracker.getInstance().trackEvent("MenuClicks", item.getTitle().toString(), "", 0);
     return ((GMSClient3MainActivity) getActivity()).onMenuItemSelected(item.getItemId());
   }
   // } else {
   //	return true;
   // }
 }
 @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()) {
     default:
       return super.onOptionsItemSelected(item);
   }
 }