@Subscribe public void balanceChanged(BlockchainReady blockchainReady) { final BalanceInfo balanceAfterRefresh = getWallet().getLocalBalance(_mbwManager.getBlockChainAddressTracker()); if (!balanceAfterRefresh.equals(balanceBeforeRefresh)) { // refresh history _mbwManager.getAsyncApi().getTransactionSummary(getWallet().getAddressSet()); } }
public static void pinProtectedBackup(final Activity activity) { MbwManager manager = MbwManager.getInstance(activity); manager.runPinProtectedFunction( activity, new Runnable() { @Override public void run() { Utils.backup(activity); } }); }
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(); }
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); } }
// todo make sure proxy is set before this. require as dependency? public static HttpErrorCollector registerInVM(Context applicationContext) { MbwEnvironment env = MbwEnvironment.determineEnvironment(applicationContext); String version = MbwManager.determineVersion(applicationContext); return registerInVM(applicationContext, version, env.getMwsApi()); }
public static Bitmap getLargeQRCodeBitmap(String text, MbwManager manager) { // make size 85% of display size int size = Math.min(manager.getDisplayWidth(), manager.getDisplayHeight()) * 81 / 100; int margin = Math.min(manager.getDisplayWidth(), manager.getDisplayHeight()) * 8 / 100; return getQRCodeBitmap(text, size, margin); }