示例#1
0
  @Override
  protected void onDestroy() {
    super.onDestroy();
    if (getEmotionsTask != null) getEmotionsTask.cancel(true);

    Set<String> keys = emotionsPic.keySet();
    for (String key : keys) {
      emotionsPic.put(key, null);
    }
  }
示例#2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.at_other);

    String token = getIntent().getStringExtra("token");

    getFragmentManager()
        .beginTransaction()
        .replace(android.R.id.content, new AtUserFragment(token))
        .commit();
  }
示例#3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.statusnewactivity_layout);
    initLayout();

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();
    if (Intent.ACTION_SEND.equals(action) && type != null) {
      if ("text/plain".equals(type)) {
        handleSendText(intent);
      } else if (type.startsWith("image/")) {
        handleSendImage(intent);
      }
    } else {
      handleNormalOperation(intent);
    }
    if (getEmotionsTask == null || getEmotionsTask.getStatus() == MyAsyncTask.Status.FINISHED) {
      getEmotionsTask = new GetEmotionsTask();
      getEmotionsTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
    }
  }
示例#4
0
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (resultCode == RESULT_OK) {
      switch (requestCode) {
        case CAMERA_RESULT:
          if (TextUtils.isEmpty(content.getText().toString())) {
            content.setText(getString(R.string.share_pic));
            content.setSelection(content.getText().toString().length());
          }

          picPath = getPicPathFromUri(imageFileUri);
          havePic.setVisibility(View.VISIBLE);
          break;
        case PIC_RESULT:
          if (TextUtils.isEmpty(content.getText().toString())) {
            content.setText(getString(R.string.share_pic));
            content.setSelection(content.getText().toString().length());
          }

          Uri imageFileUri = intent.getData();
          picPath = getPicPathFromUri(imageFileUri);
          havePic.setVisibility(View.VISIBLE);
          break;
        case AT_USER:
          String name = intent.getStringExtra("name");
          String ori = content.getText().toString();
          int index = content.getSelectionStart();
          StringBuilder stringBuilder = new StringBuilder(ori);
          stringBuilder.insert(index, name);
          content.setText(stringBuilder.toString());
          content.setSelection(index + name.length());
          break;
      }
    }
  }
示例#5
0
 @Override
 public void onBackPressed() {
   super.onBackPressed();
   savaDraft();
 }