コード例 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_delete:
        DialogHelper.showDeleteConversationsDialog((MainActivity) mContext, mAdapter);
        return true;
      case R.id.menu_mark_read:
        for (long threadId : mAdapter.getSelectedItems()) {
          new ConversationLegacy(mContext, threadId).markRead();
        }
        mAdapter.disableMultiSelectMode(true);
        return true;
    }

    return super.onOptionsItemSelected(item);
  }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: tariq86/qksms
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        onKeyUp(KeyEvent.KEYCODE_BACK, null);
        break;
      case R.id.menu_settings:
        switchContent(SettingsFragment.newInstance(R.xml.settings_main), true);
        break;
      case R.id.menu_search:
        switchContent(new SearchFragment(), true);
        break;
      case R.id.menu_changelog:
        DialogHelper.showChangelog(this);
        break;
      case R.id.menu_donate:
        DonationManager.getInstance(this).showDonateDialog();
        break;
    }

    return super.onOptionsItemSelected(item);
  }