Ejemplo n.º 1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_key_list_import:
        callIntentForDrawerItem(Constants.DrawerItems.IMPORT_KEYS);

        return true;
      case R.id.menu_key_list_export:
        mExportHelper.showExportKeysDialog(
            null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB, null);

        return true;
      case R.id.menu_key_list_create:
        createKey();

        return true;
      case R.id.menu_key_list_create_expert:
        createKeyExpert();

        return true;
      case R.id.menu_key_list_secret_export:
        mExportHelper.showExportKeysDialog(
            null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC, null);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_key_list_secret_create:
        createKey();

        return true;
      case R.id.menu_key_list_secret_create_expert:
        createKeyExpert();

        return true;
      case R.id.menu_key_list_secret_export:
        mExportHelper.showExportKeysDialog(
            null, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC);

        return true;
      case R.id.menu_key_list_secret_import:
        Intent intentImportFromFile = new Intent(this, ImportKeysActivity.class);
        intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_FILE);
        startActivityForResult(intentImportFromFile, 0);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Ejemplo n.º 3
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       Intent homeIntent = new Intent(this, KeyListPublicActivity.class);
       homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       startActivity(homeIntent);
       return true;
     case R.id.menu_key_view_update:
       updateFromKeyserver(mDataUri);
       return true;
     case R.id.menu_key_view_export_keyserver:
       uploadToKeyserver(mDataUri);
       return true;
     case R.id.menu_key_view_export_file:
       long[] ids = new long[] {Long.valueOf(mDataUri.getLastPathSegment())};
       mExportHelper.showExportKeysDialog(
           ids, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB);
       return true;
     case R.id.menu_key_view_share_default_fingerprint:
       shareKey(mDataUri, true);
       return true;
     case R.id.menu_key_view_share_default:
       shareKey(mDataUri, false);
       return true;
     case R.id.menu_key_view_share_qr_code_fingerprint:
       shareKeyQrCode(mDataUri, true);
       return true;
     case R.id.menu_key_view_share_qr_code:
       shareKeyQrCode(mDataUri, false);
       return true;
     case R.id.menu_key_view_share_nfc:
       shareNfc();
       return true;
     case R.id.menu_key_view_share_clipboard:
       copyToClipboard(mDataUri);
       return true;
     case R.id.menu_key_view_delete:
       {
         deleteKey(mDataUri);
         return true;
       }
   }
   return super.onOptionsItemSelected(item);
 }