Exemplo n.º 1
0
 public static void exportSelectedPrivateKey(final Activity parent) {
   final Record record = MbwManager.getInstance(parent).getRecordManager().getSelectedRecord();
   if (record == null || !record.hasPrivateKey()) {
     return;
   }
   AlertDialog.Builder builder = new AlertDialog.Builder(parent);
   builder
       .setMessage(R.string.export_single_private_key_warning)
       .setCancelable(true)
       .setPositiveButton(
           R.string.yes,
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
               dialog.dismiss();
               Intent intent = new Intent(parent, ExportAsQrCodeActivity.class);
               parent.startActivity(intent);
             }
           })
       .setNegativeButton(
           R.string.no,
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {}
           });
   AlertDialog alertDialog = builder.create();
   alertDialog.show();
 }
Exemplo n.º 2
0
  public static void pinProtectedBackup(final Activity activity) {
    MbwManager manager = MbwManager.getInstance(activity);
    manager.runPinProtectedFunction(
        activity,
        new Runnable() {

          @Override
          public void run() {
            Utils.backup(activity);
          }
        });
  }
Exemplo n.º 3
0
  private static void backup(final Activity parent) {

    // Get a list of all records
    RecordManager recordManager = MbwManager.getInstance(parent).getRecordManager();
    List<Record> records = new LinkedList<Record>();
    records.addAll(recordManager.getRecords(Tag.ACTIVE));
    records.addAll(recordManager.getRecords(Tag.ARCHIVE));

    if (records.size() == 1 && records.get(0).hasPrivateKey()) {
      // If there is only one record, and it has a private key we let the
      // user choose which backup method to use
      backupSingleRecord(parent, records.get(0));
    } else {
      // Otherwise we automatically launch encrypted PDF backup
      backupAllRecords(parent);
    }
  }