Esempio n. 1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;
    switch (item.getItemId()) {
      case android.R.id.home:
        savaDraft();
        InputMethodManager imm =
            (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm.isActive())
          imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
        intent = new Intent(this, MainTimeLineActivity.class);
        intent.putExtra("account", getAccount());
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        break;
      case R.id.menu_emoticon:
        EmotionsGridDialog dialog = new EmotionsGridDialog();
        dialog.show(getFragmentManager(), "");
        break;

      case R.id.menu_topic:
        String ori = content.getText().toString();
        String topicTag = "##";
        content.setText(ori + topicTag);
        content.setSelection(content.getText().toString().length() - 1);
        break;
      case R.id.menu_at:
        intent = new Intent(WriteWeiboActivity.this, AtUserActivity.class);
        intent.putExtra("token", token);
        startActivityForResult(intent, AT_USER);
        break;
    }
    return true;
  }
Esempio n. 2
0
    @Override
    public void onClick(View v) {
      switch (v.getId()) {
        case R.id.menu_add_gps:
          addLocation();
          break;
        case R.id.menu_add_pic:
          addPic();
          break;

        case R.id.menu_add_emotions:
          EmotionsGridDialog dialog = new EmotionsGridDialog();
          dialog.show(getFragmentManager(), "");
          break;

        case R.id.menu_send:
          send();
          break;
      }
    }