Java Code Examples for net.bither.bitherj.crypto.mnemonic.MnemonicCode#instanceForWord()
The following examples show how to use
net.bither.bitherj.crypto.mnemonic.MnemonicCode#instanceForWord() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogHdmImportWordListReplace.java From bither-android with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { if (v.getId() == R.id.btn_ok) { String word = et.getText().toString().toLowerCase().trim(); if (Utils.isEmpty(word)) { return; } try { MnemonicCode mnemonic = MnemonicCode.instanceForWord(new MnemonicCodeAndroid(), word); if (mnemonic == null) { tvError.setVisibility(View.VISIBLE); shake(); return; } dismiss(); if (listener != null) { listener.replace(index, word); } } catch (IOException e) { e.printStackTrace(); } } else { dismiss(); } }
Example 2
Source File: HdmImportWordListActivity.java From bither-android with Apache License 2.0 | 6 votes |
private void isZhTw() { try { int zhCnCount = 0; for (String word: words) { mnemonic = MnemonicCode.instanceForWord(new MnemonicCodeAndroid(), word); ArrayList<String> zhCnWorsList = mnemonic.getWordListForInputStream(BitherApplication.mContext.getResources().openRawResource(R.raw.mnemonic_wordlist_zh_cn)); ArrayList<String> zhTwWorsList = mnemonic.getWordListForInputStream(BitherApplication.mContext.getResources().openRawResource(R.raw.mnemonic_wordlist_zh_tw)); if (!zhCnWorsList.contains(word) && zhTwWorsList.contains(word)) { mnemonic.setWordList(zhTwWorsList, MnemonicWordList.ZhTw); return; } if (zhCnWorsList.contains(word)) { zhCnCount += 1; } if (zhCnCount == words.size()) { mnemonic.setWordList(zhCnWorsList, MnemonicWordList.ZhCN); return; } } return; } catch (IOException e) { e.printStackTrace(); return; } }
Example 3
Source File: HdmImportWordListActivity.java From bither-android with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { if (words.size() >= WordCount) { return; } String word = etInput.getText().toString().toLowerCase().trim(); if (Utils.isEmpty(word)) { return; } try { mnemonic = MnemonicCode.instanceForWord(new MnemonicCodeAndroid(), word); if (mnemonic == null) { DropdownMessage.showDropdownMessage(HdmImportWordListActivity.this, R.string.hdm_import_word_list_wrong_word_warn); return; } words.add(word); etInput.setText(""); refresh(); gv.smoothScrollToPosition(words.size() - 1); if (words.size() >= WordCount) { complete(); } } catch (IOException e) { e.printStackTrace(); return; } }