Java Code Examples for net.bither.bitherj.utils.Utils#validBitcoinPrivateKey()

The following examples show how to use net.bither.bitherj.utils.Utils#validBitcoinPrivateKey() . 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: ImportPrivateTextDialog.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private void importPrivateText() {
    final String result = tfPrivateKey.getText();
    boolean isPrivateKey = Utils.validBitcoinPrivateKey(result);
    if (isPrivateKey) {
        PasswordPanel dialogPassword = new PasswordPanel(new IDialogPasswordListener() {
            @Override
            public void onPasswordEntered(SecureCharSequence password) {
                if (password == null) {
                    return;
                }
                ImportPrivateKeyDesktop importPrivateKey = new ImportPrivateKeyDesktop(
                        ImportPrivateKey.ImportPrivateKeyType.Text, result, password);
                importPrivateKey.importPrivateKey();
            }
        });
        dialogPassword.showPanel();


    } else {
        showMsg(LocaliserUtils.getString("import_private_key_text_format_erro"));
    }


}
 
Example 2
Source File: DialogImportPrivateKeyText.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    clickedId = v.getId();
    if (v.getId() == R.id.btn_ok) {
        String s = et.getText().toString();
        tvError.setText(R.string.import_private_key_text_format_error);
        if (Utils.isEmpty(s)) {
            tvError.setVisibility(View.VISIBLE);
            shake();
            return;
        } else if (!Utils.validBitcoinPrivateKey(s)) {
            tvError.setVisibility(View.VISIBLE);
            shake();
            return;
        }

        privateKeyString = et.getText().toString();
        dismiss();

    } else {
        dismiss();
    }
}
 
Example 3
Source File: ImportPrivateTextDialog.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private void importPrivateText() {
    final String result = tfPrivateKey.getText();
    boolean isPrivateKey = Utils.validBitcoinPrivateKey(result);
    if (isPrivateKey) {
        PasswordPanel dialogPassword = new PasswordPanel(new IDialogPasswordListener() {
            @Override
            public void onPasswordEntered(SecureCharSequence password) {
                if (password == null) {
                    return;
                }
                ImportPrivateKeyDesktop importPrivateKey = new ImportPrivateKeyDesktop(
                        ImportPrivateKey.ImportPrivateKeyType.Text, result, password);
                importPrivateKey.importPrivateKey();
            }
        });
        dialogPassword.showPanel();


    } else {
        showMsg(LocaliserUtils.getString("import_private_key_text_format_erro"));
    }


}
 
Example 4
Source File: ImportPrivateTextDialog.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private void onOK() {
    String text = tfPrivateKey.getText().trim();
    if (!Utils.isEmpty(text) && Utils.validBitcoinPrivateKey(text)) {
        dispose();
        importPrivateText();

    } else {
        showMsg(LocaliserUtils.getString("import_private_key_text_format_erro"));
    }
}
 
Example 5
Source File: ImportPrivateTextDialog.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
private void onOK() {
    String text = tfPrivateKey.getText().trim();
    if (!Utils.isEmpty(text) && Utils.validBitcoinPrivateKey(text)) {
        dispose();
        importPrivateText();

    } else {
        showMsg(LocaliserUtils.getString("import_private_key_text_format_erro"));
    }
}