@Test public void importMnemonic(){ String str = "a b c d e f g i q t h e"; presenter.importMnemonic(str,"Ella","qq123456","qq123456", WalletType.ORDINARY_WALLET); }
@Override public void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType) { 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().importMnemonic(phrase, name, password,walletType); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_MNEMONIC: mHandler.sendEmptyMessage(MSG_MNEMONIC_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(); }
ImportMnemonicPhrasePresenter extends BasePresenter<ImportMnemonicPhraseContract.View> implements ImportMnemonicPhraseContract.Presenter { @Override public void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType) { 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().importMnemonic(phrase, name, password,walletType); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_MNEMONIC: mHandler.sendEmptyMessage(MSG_MNEMONIC_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(); } }
ImportMnemonicPhrasePresenter extends BasePresenter<ImportMnemonicPhraseContract.View> implements ImportMnemonicPhraseContract.Presenter { @Override public void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType) { 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().importMnemonic(phrase, name, password,walletType); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_MNEMONIC: mHandler.sendEmptyMessage(MSG_MNEMONIC_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(); }  }
ImportMnemonicPhrasePresenter extends BasePresenter<ImportMnemonicPhraseContract.View> implements ImportMnemonicPhraseContract.Presenter { @Override public void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType) { 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().importMnemonic(phrase, name, password,walletType); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_MNEMONIC: mHandler.sendEmptyMessage(MSG_MNEMONIC_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 parseQRCode(String QRCode); @Override void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType); @Override boolean isExists(String walletName); @Override void loadDBWalletNumber(); }
ImportMnemonicPhrasePresenter extends BasePresenter<ImportMnemonicPhraseContract.View> implements ImportMnemonicPhraseContract.Presenter { @Override public void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType) { 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().importMnemonic(phrase, name, password,walletType); switch (code) { case WalletManager.CODE_OK: mHandler.sendEmptyMessage(MSG_OK); break; case WalletManager.CODE_ERROR_MNEMONIC: mHandler.sendEmptyMessage(MSG_MNEMONIC_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 parseQRCode(String QRCode); @Override void importMnemonic(String phrase, String name, String password, String repeatPassword, @WalletType int walletType); @Override boolean isExists(String walletName); @Override void loadDBWalletNumber();  }