예제 #1
0
  public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case 1:
        mBtn.setTextColor(Color.RED);
        return true;
      case 2:
        mBtn.setTextColor(Color.GREEN);
        return true;
      case 3:
        mBtn.setTextColor(Color.BLUE);
        return true;
      case 4:
        Toast.makeText(this, "번역했다.", Toast.LENGTH_SHORT).show();
        return true;
      case 5:
        Toast.makeText(this, "필기 인식했다.", Toast.LENGTH_SHORT).show();
        return true;
      case 100:
        Toast.makeText(this, "회전했다 치고.", Toast.LENGTH_SHORT).show();
        return true;
      case 101:
        Toast.makeText(this, "크기 변경 했다 치고.", Toast.LENGTH_SHORT).show();
        return true;
    }

    return true;
  }
예제 #2
0
파일: Expr.java 프로젝트: thorntonrose/Expr
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "onOptionsItemSelected: itemId: " + item.getItemId());

    switch (item.getItemId()) {
      case R.id.menu_clear:
        Log.d(TAG, "onOptionsItemSelected: menu_clear");
        clear();
        break;

      case R.id.menu_help:
        Log.d(TAG, "onOptionsItemSelected: menu_help");
        startActivity(new Intent(Intent.ACTION_VIEW, null, this, Help.class));
        break;

      case R.id.menu_about:
        Log.d(TAG, "onOptionsItemSelected: menu_about");
        Messages.about(this);
        break;
    }

    return super.onOptionsItemSelected(item);
  }
예제 #3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.loader_menu_set_user_id:
        {
          showUserHashDialog();
          return true;
        }

      case R.id.loader_menu_refresh_map_list:
        {
          refreshMapList();
          return true;
        }

      default:
        return super.onOptionsItemSelected(item);
    }
  }
  // code which handles the action for each menu item
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.settings:
        {
          Intent preferences_intent = new Intent();
          preferences_intent.setComponent(
              new ComponentName(download_photos.this, preferences.class));
          preferences_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          getApplicationContext().startActivity(preferences_intent);

          return true;
        }
      case R.id.logout:
        {
          try {
            download_photos.this.facebook.logout(getApplicationContext());
          } catch (IOException e) {
            e.printStackTrace();
          }

          mPrefs = getSharedPreferences("COMMON", MODE_PRIVATE);

          SharedPreferences.Editor editor = mPrefs.edit();
          editor.putString("access_token", null);
          editor.putLong("access_expires", 0);
          editor.putBoolean("logout", true);
          editor.commit();
          finish();
          return true;
        }
      case R.id.about:
        {
          // shows our customized about dialog
          AboutDialog about = new AboutDialog(this);

          about.show();
          return true;
        }
        // lets deal with default case
      default:
        return super.onOptionsItemSelected(item);
    }
  }