コード例 #1
0
  @Override
  public void onClick(View view) {
    // Close the navigation drawer, currently all click listeners are drawer items
    mDrawerLayout.closeDrawer(GravityCompat.START);

    if (view == mNavAccountItemLayout) {
      EvercamPlayApplication.sendEventAnalytics(
          this, R.string.category_menu, R.string.action_manage_account, R.string.label_account);

      startActivityForResult(
          new Intent(CamerasActivity.this, ManageAccountsActivity.class),
          Constants.REQUEST_CODE_MANAGE_ACCOUNT);
    } else if (view == mNavSettingsItemLayout) {
      EvercamPlayApplication.sendEventAnalytics(
          this, R.string.category_menu, R.string.action_settings, R.string.label_settings);

      startActivity(new Intent(CamerasActivity.this, CameraPrefsActivity.class));
    } else if (view == mNavFeedbackItemLayout) {
      startActivity(new Intent(CamerasActivity.this, FeedbackActivity.class));
    } else if (view == mNavAboutItemLayout) {
      Intent aboutIntent = new Intent(CamerasActivity.this, SimpleWebActivity.class);
      aboutIntent.putExtra(Constants.BUNDLE_KEY_URL, getString(R.string.evercam_url));
      startActivity(aboutIntent);
    }
  }
コード例 #2
0
  // Tells that the item has been selected from the menu. Now check and get
  // the selected item and perform the relevant action
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menurefresh) {
      EvercamPlayApplication.sendEventAnalytics(
          this, R.string.category_menu, R.string.action_refresh, R.string.label_list_refresh);

      if (refresh != null) refresh.setActionView(R.layout.actionbar_indeterminate_progress);

      startCameraLoadingTask();

    } else if (itemId == R.id.menu_logout) {
      showSignOutDialog();
    } else {
      return super.onOptionsItemSelected(item);
    }

    return true;
  }