@Test public void importPrivateKey(){ String privateKey = "541a6474dfccc0d36d88ef9269fbede85c35b3ec08d9a327ce488349fcd52888"; String name = "Ella"; String password = "qq123456"; String repeatPassword = "qq123456"; presenter.importPrivateKey(privateKey,name,password,repeatPassword); }
@Override public void importPrivateKey(String privateKey, String name, String password, String repeatPassword) { if (isExists(name)) { return; } if (!password.equals(repeatPassword)) { showShortToast(string(R.string.passwordTips)); return; } showLoadingDialog(); new Thread() { @Override public void run() { int code = WalletManager.getInstance().importPrivateKey(privateKey, name, password); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_PRIVATEKEY: mHandler.sendEmptyMessage(MSG_PRIVATEKEY_ERROR); break; case WalletManager.CODE_ERROR_NAME: break; case WalletManager.CODE_ERROR_PASSWORD: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; case WalletManager.CODE_ERROR_WALLET_EXISTS: mHandler.sendEmptyMessage(MSG_WALLET_EXISTS); break; case WalletManager.CODE_ERROR_UNKNOW: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; default: break; } } }.start(); }
ImportPrivateKeyPresenter extends BasePresenter<ImportPrivateKeyContract.View> implements ImportPrivateKeyContract.Presenter { @Override public void importPrivateKey(String privateKey, String name, String password, String repeatPassword) { if (isExists(name)) { return; } if (!password.equals(repeatPassword)) { showShortToast(string(R.string.passwordTips)); return; } showLoadingDialog(); new Thread() { @Override public void run() { int code = WalletManager.getInstance().importPrivateKey(privateKey, name, password); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_PRIVATEKEY: mHandler.sendEmptyMessage(MSG_PRIVATEKEY_ERROR); break; case WalletManager.CODE_ERROR_NAME: break; case WalletManager.CODE_ERROR_PASSWORD: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; case WalletManager.CODE_ERROR_WALLET_EXISTS: mHandler.sendEmptyMessage(MSG_WALLET_EXISTS); break; case WalletManager.CODE_ERROR_UNKNOW: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; default: break; } } }.start(); } }
ImportPrivateKeyPresenter extends BasePresenter<ImportPrivateKeyContract.View> implements ImportPrivateKeyContract.Presenter { @Override public void importPrivateKey(String privateKey, String name, String password, String repeatPassword) { if (isExists(name)) { return; } if (!password.equals(repeatPassword)) { showShortToast(string(R.string.passwordTips)); return; } showLoadingDialog(); new Thread() { @Override public void run() { int code = WalletManager.getInstance().importPrivateKey(privateKey, name, password); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_PRIVATEKEY: mHandler.sendEmptyMessage(MSG_PRIVATEKEY_ERROR); break; case WalletManager.CODE_ERROR_NAME: break; case WalletManager.CODE_ERROR_PASSWORD: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; case WalletManager.CODE_ERROR_WALLET_EXISTS: mHandler.sendEmptyMessage(MSG_WALLET_EXISTS); break; case WalletManager.CODE_ERROR_UNKNOW: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; default: break; } } }.start(); }  }
ImportPrivateKeyPresenter extends BasePresenter<ImportPrivateKeyContract.View> implements ImportPrivateKeyContract.Presenter { @Override public void importPrivateKey(String privateKey, String name, String password, String repeatPassword) { if (isExists(name)) { return; } if (!password.equals(repeatPassword)) { showShortToast(string(R.string.passwordTips)); return; } showLoadingDialog(); new Thread() { @Override public void run() { int code = WalletManager.getInstance().importPrivateKey(privateKey, name, password); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_PRIVATEKEY: mHandler.sendEmptyMessage(MSG_PRIVATEKEY_ERROR); break; case WalletManager.CODE_ERROR_NAME: break; case WalletManager.CODE_ERROR_PASSWORD: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; case WalletManager.CODE_ERROR_WALLET_EXISTS: mHandler.sendEmptyMessage(MSG_WALLET_EXISTS); break; case WalletManager.CODE_ERROR_UNKNOW: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; default: break; } } }.start(); }  @Override void init(); @Override void checkPaste(); @Override void parseQRCode(String QRCode); @Override void importPrivateKey(String privateKey, String name, String password, String repeatPassword); @Override boolean isExists(String walletName); @Override void loadDBWalletNumber(); }
ImportPrivateKeyPresenter extends BasePresenter<ImportPrivateKeyContract.View> implements ImportPrivateKeyContract.Presenter { @Override public void importPrivateKey(String privateKey, String name, String password, String repeatPassword) { if (isExists(name)) { return; } if (!password.equals(repeatPassword)) { showShortToast(string(R.string.passwordTips)); return; } showLoadingDialog(); new Thread() { @Override public void run() { int code = WalletManager.getInstance().importPrivateKey(privateKey, name, password); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_PRIVATEKEY: mHandler.sendEmptyMessage(MSG_PRIVATEKEY_ERROR); break; case WalletManager.CODE_ERROR_NAME: break; case WalletManager.CODE_ERROR_PASSWORD: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; case WalletManager.CODE_ERROR_WALLET_EXISTS: mHandler.sendEmptyMessage(MSG_WALLET_EXISTS); break; case WalletManager.CODE_ERROR_UNKNOW: mHandler.sendEmptyMessage(MSG_PASSWORD_FAILED); break; default: break; } } }.start(); }  @Override void init(); @Override void checkPaste(); @Override void parseQRCode(String QRCode); @Override void importPrivateKey(String privateKey, String name, String password, String repeatPassword); @Override boolean isExists(String walletName); @Override void loadDBWalletNumber();  }