net.bither.bitherj.core.AddressManager Java Examples

The following examples show how to use net.bither.bitherj.core.AddressManager. 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: ColdAddressFragment.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public void refresh() {
    if (AbstractApp.addressIsReady) {
        List<Address> ps = AddressManager.getInstance().getPrivKeyAddresses();
        if (ps != null) {
            privates.clear();
            privates.addAll(ps);
        }
        mAdapter.notifyDataSetChanged();
        if (privates.size() == 0 &&
                !AddressManager.getInstance().hasBitpieHDAccountCold() &&
                !AddressManager.getInstance().hasHDMKeychain() &&
                !AddressManager.getInstance().hasHDAccountCold() &&
                !EnterpriseHDMSeed.hasSeed()) {
            ivNoAddress.setVisibility(View.VISIBLE);
            lvPrivate.setVisibility(View.GONE);
        } else {
            ivNoAddress.setVisibility(View.GONE);
            lvPrivate.setVisibility(View.VISIBLE);
        }
        if (addressesToShowAdded != null) {
            lvPrivate.postDelayed(showAddressesAddedRunnable, 600);
        }
    }
}
 
Example #2
Source File: MainFrameUI.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
public void updateHeader() {
    if (UserPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD) {
        return;
    }
    long finalEstimatedBalance = 0;
    for (Address address : AddressManager.getInstance().getAllAddresses()) {
        finalEstimatedBalance = finalEstimatedBalance + address.getBalance();
    }
    if (AddressManager.getInstance().getHdAccount() != null) {
        finalEstimatedBalance = finalEstimatedBalance + AddressManager.getInstance().getHdAccount().getBalance();
    }
    final long total = finalEstimatedBalance;

    if (EventQueue.isDispatchThread()) {
        updateHeaderOnSwingThread(total);
    } else {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                updateHeaderOnSwingThread(total);
            }
        });
    }
}
 
Example #3
Source File: Bither.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private static void initBitherApplication() {
    ApplicationInstanceManager.txDBHelper = new TxDBHelper(applicationDataDirectoryLocator.getApplicationDataDirectory());
    ApplicationInstanceManager.txDBHelper.initDb();
    ApplicationInstanceManager.addressDBHelper = new AddressDBHelper(applicationDataDirectoryLocator.getApplicationDataDirectory());
    ApplicationInstanceManager.addressDBHelper.initDb();
    if (UserPreference.getInstance().getAppMode() == null) {
        UserPreference.getInstance().setAppMode(BitherjSettings.AppMode.HOT);
    }

    DesktopImplAbstractApp desktopImplAbstractApp = new DesktopImplAbstractApp();
    desktopImplAbstractApp.construct();
    DesktopDbImpl desktopDb = new DesktopDbImpl();
    desktopDb.construct();
    AddressManager.getInstance();
    try {
        MnemonicCode.setInstance(new MnemonicCodeDesktop());
    } catch (IOException e) {
        e.printStackTrace();
    }


}
 
Example #4
Source File: AddAddressHotHDMFragment.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public void moveToFinal(boolean animToFinish) {
    hdmHotAddWithAndroid.hdmKeychainLimit = AddressManager.isHDMKeychainLimit();
    llHot.setEnabled(false);
    llHot.setSelected(true);
    llCold.setEnabled(false);
    llCold.setSelected(true);
    llServer.setEnabled(false);
    llServer.setSelected(true);
    stopAllFlash();
    if (!animToFinish) {
        vBg.addLine(llServer, llHot);
        if (hdmHotAddWithAndroid.hdmKeychainLimit) {
            llHot.setEnabled(true);
            llCold.setEnabled(true);
            llServer.setEnabled(true);
        }
    } else {
        vBg.addLineAnimated(llServer, llHot, new Runnable() {
            @Override
            public void run() {
                finalAnimation();
            }
        });
    }
}
 
Example #5
Source File: ColdAddressFragmentHDAccountColdListItemView.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private void init() {
    hdAccountCold = AddressManager.getInstance().getHDAccountCold();
    View v = LayoutInflater.from(getContext()).inflate(R.layout
            .list_item_address_fragment_hd_account_cold, null);
    addView(v, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    ibtnXRandomLabel = (ImageButton) findViewById(R.id.ibtn_xrandom_label);
    ibtnXRandomLabel.setOnLongClickListener(DialogXRandomInfo.InfoLongClick);
    if (hdAccountCold.isFromXRandom()) {
        ibtnXRandomLabel.setVisibility(View.VISIBLE);
    } else {
        ibtnXRandomLabel.setVisibility(View.GONE);
    }
    findViewById(R.id.iv_type).setOnLongClickListener(typeClick);
    findViewById(R.id.ibtn_seed_option).setOnClickListener(seedOptionClick);
    findViewById(R.id.ibtn_qr_code_option).setOnClickListener(qrCodeOptionClick);
    dp = new DialogProgress(getContext(), R.string.please_wait);
    dp.setCancelable(false);
}
 
Example #6
Source File: PeerUtil.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private static synchronized void startPeerInBackground() {
    try {

        if (!peerCanRun) {
            return;
        }
        if (!UserPreference.getInstance().getDownloadSpvFinish()) {
            BlockUtil.dowloadSpvBlock();
        }
        if (UserPreference.getInstance().getAppMode() != BitherjSettings.AppMode.COLD) {
            if (!UserPreference.getInstance().getBitherjDoneSyncFromSpv()) {
                if (!PeerManager.instance().isConnected()) {
                    PeerManager.instance().start();
                }
            } else {
                if (!AddressManager.getInstance().addressIsSyncComplete()) {
                    TransactionsUtil.getMyTxFromBither();
                }
                startPeerManager();

            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #7
Source File: ColdAddressFragmentBitpieHDAccountColdListItemView.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private void init() {
    bitpiehdAccountCold = AddressManager.getInstance().getBitpieHDAccountCold();
    View v = LayoutInflater.from(getContext()).inflate(R.layout
            .list_item_address_fragment_hd_account_cold, null);
    addView(v, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    TextView tvTitle = v.findViewById(R.id.tv_title);
    tvTitle.setText(R.string.bitpie_hd_account_cold_address_list_label);
    ibtnXRandomLabel = findViewById(R.id.ibtn_xrandom_label);
    ibtnXRandomLabel.setOnLongClickListener(DialogXRandomInfo.InfoLongClick);
    if (bitpiehdAccountCold.isFromXRandom()) {
        ibtnXRandomLabel.setVisibility(View.VISIBLE);
    } else {
        ibtnXRandomLabel.setVisibility(View.GONE);
    }
    findViewById(R.id.iv_type).setOnLongClickListener(typeClick);
    findViewById(R.id.ibtn_seed_option).setOnClickListener(seedOptionClick);
    findViewById(R.id.ibtn_qr_code_option).setOnClickListener(qrCodeOptionClick);
    dp = new DialogProgress(getContext(), R.string.please_wait);
    dp.setCancelable(false);
}
 
Example #8
Source File: BlockchainService.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    LogUtil.d("block", "sendBroadcastSyncSPVFinished onReceive");
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                if (!AddressManager.getInstance().addressIsSyncComplete()) {
                    TransactionsUtil.getMyTxFromBither();
                }
                startPeerManager();
                AbstractApp.notificationService.removeBroadcastSyncSPVFinished();
                if (spvFinishedReceiver != null && spvFinishedReceivered) {
                    unregisterReceiver(spvFinishedReceiver);
                    spvFinishedReceivered = false;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }).start();


}
 
Example #9
Source File: ColdAdvanceActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private int getStringResouceForIndex(int index) {
    switch (index) {
        case 0:
            return R.string.import_private_key_qr_code;
        case 1:
            return R.string.import_private_key_text;
    }
    if (!AddressManager.getInstance().hasHDMKeychain()) {
        switch (index) {
            case 2:
                return R.string.import_hdm_cold_seed_qr_code;
            case 3:
                return R.string.import_hdm_cold_seed_phrase;
        }
        index -= 2;
    }
    if (!AddressManager.getInstance().hasHDAccountCold()) {
        switch (index) {
            case 2:
                return R.string.import_cold_hd_account_seed_qr_code;
            case 3:
                return R.string.import_cold_hd_account_seed_phrase;
        }
    }
    return 0;
}
 
Example #10
Source File: PeerUtil.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private static synchronized void startPeerInBackground() {
    try {

        if (!peerCanRun) {
            return;
        }
        if (!UserPreference.getInstance().getDownloadSpvFinish()) {
            BlockUtil.dowloadSpvBlock();
        }
        if (UserPreference.getInstance().getAppMode() != BitherjSettings.AppMode.COLD) {
            if (!UserPreference.getInstance().getBitherjDoneSyncFromSpv()) {
                if (!PeerManager.instance().isConnected()) {
                    PeerManager.instance().start();
                }
            } else {
                if (!AddressManager.getInstance().addressIsSyncComplete()) {
                    TransactionsUtil.getMyTxFromBither();
                }
                startPeerManager();

            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #11
Source File: AddressOfColdFragmentListAdapter.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public AddressOfColdFragmentListAdapter(FragmentActivity activity,
                                        List<Address> privates, ColdAddressFragmentHDMListItemView.RequestHDMServerQrCodeDelegate requestHDMServerQrCodeDelegate) {
    this.activity = activity;
    this.privates = privates;
    this.requestHDMServerQrCodeDelegate = requestHDMServerQrCodeDelegate;
    if (AddressManager.getInstance().hasHDAccountCold()) {
        hdAccountCold = AddressManager.getInstance().getHDAccountCold();
    } else {
        hdAccountCold = null;
    }
    if (AddressManager.getInstance().hasBitpieHDAccountCold()) {
        bitpieHDAccountCold = AddressManager.getInstance().getBitpieHDAccountCold();
    } else {
        bitpieHDAccountCold = null;
    }
    if (EnterpriseHDMSeed.hasSeed()) {
        enterpriseHDMSeed = EnterpriseHDMSeed.seed();
    } else {
        enterpriseHDMSeed = null;
    }
}
 
Example #12
Source File: ColdActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private void checkBackup() {
    if (AddressManager.getInstance().getPrivKeyAddresses() != null && AddressManager
            .getInstance().getPrivKeyAddresses().size() == 0 && AddressManager
            .getInstance().getHdmKeychain() == null
            && !AddressManager.getInstance().hasHDAccountCold()
            && !AddressManager.getInstance().hasBitpieHDAccountCold()) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                final List<File> files = FileUtil.getBackupFileListOfCold();
                if (files != null && files.size() > 0) {
                    showDialogOfColdBackup();
                }
            }
        }).start();
    }
}
 
Example #13
Source File: HotActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private void initClick() {
    flAddAddress.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isPrivateKeyLimit = AddressManager.isPrivateLimit();
            boolean isWatchOnlyLimit = AddressManager.isWatchOnlyLimit();
            if (isPrivateKeyLimit && isWatchOnlyLimit) {
                DropdownMessage.showDropdownMessage(HotActivity.this,
                        R.string.private_key_count_limit);
                DropdownMessage.showDropdownMessage(HotActivity.this,
                        R.string.watch_only_address_count_limit);
                return;
            }
            Intent intent = new Intent(HotActivity.this, AddHotAddressActivity.class);
            startActivityForResult(intent, BitherSetting.INTENT_REF.SCAN_REQUEST_CODE);
            overridePendingTransition(R.anim.activity_in_drop, R.anim.activity_out_back);

        }
    });

}
 
Example #14
Source File: ColdDefaultPanel.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
@Override
public void displayView(DisplayHint displayHint) {
    // panelMain = Panels.newPanel();
    panelMain.removeAll();
    panelMain.setLayout(new MigLayout(
            Panels.migXYLayout(),
            "20[][][][][]10", // Column constraints
            "[][80][][30][30][20]" // Row constraints
    ));
    if (Bither.getActionAddress() == null) {
        if (AddressManager.getInstance().hasHDMKeychain()) {
            panelMain.add(btnHDMCold, "shrink");
        }
    } else {
        panelMain.add(btnAddress, "shrink");
        panelMain.add(btnWatchOnlyQRCode, "shrink");
    }
    panelMain.add(btnBitherColdWallet, "shrink");
    panelMain.add(btnSignTransaction, "shrink");


}
 
Example #15
Source File: BitpieHDAccountColdUEntropyActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
void didSuccess(Object obj) {
    final Intent intent = new Intent();
    ArrayList<String> addresses = new ArrayList<String>();
    addresses.add(BitpieHDAccountCold.BitpieHDAccountPlaceHolder);
    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, addresses);
    DialogFragmentHDMSingularColdSeed.newInstance(
            words,
            AddressManager.getInstance().getBitpieHDAccountCold().getQRCodeFullEncryptPrivKey(),
            R.string.bitpie_add_hd_account_show_seed_label,
            R.string.bitpie_add_hd_account_show_seed_button,
            new DialogFragmentHDMSingularColdSeed.DialogFragmentHDMSingularColdSeedListener() {
                @Override
                public void HDMSingularColdSeedRemembered() {
                    setResult(RESULT_OK, intent);
                    finish();
                    overridePendingTransition(0, R.anim.slide_out_bottom);
                }
            })
            .show(getSupportFragmentManager(), DialogFragmentHDMSingularColdSeed.FragmentTag);
}
 
Example #16
Source File: CommitTransactionThread.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public CommitTransactionThread(DialogProgress dp, int addressPosition, Tx tx, boolean isHDM,
                               boolean withPrivateKey, CommitTransactionListener listener)
        throws Exception {
    super(dp, dp.getContext());
    this.addressPosition = addressPosition;
    this.listener = listener;
    if (isHDM) {
        wallet = AddressManager.getInstance().getHdmKeychain().getAddresses().get
                (addressPosition);
    } else if (withPrivateKey) {
        Address a = AddressManager.getInstance().getPrivKeyAddresses().get(addressPosition);
        if (a.hasPrivKey()) {
            wallet = a;
        } else {
            throw new Exception("address not with private key");
        }
    } else {
        wallet = AddressManager.getInstance().getWatchOnlyAddresses().get(addressPosition);
    }
    this.tx = tx;
}
 
Example #17
Source File: HdmSendActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.slide_in_right, 0);
    setContentView(R.layout.activity_send);
    if (getIntent().getExtras().containsKey(BitherSetting.INTENT_REF
            .ADDRESS_POSITION_PASS_VALUE_TAG)) {
        addressPosition = getIntent().getExtras().getInt(BitherSetting.INTENT_REF
                .ADDRESS_POSITION_PASS_VALUE_TAG);
        if (addressPosition >= 0 && addressPosition < AddressManager.getInstance()
                .getHdmKeychain().getAddresses().size()) {
            address = AddressManager.getInstance().getHdmKeychain().getAddresses().get
                    (addressPosition);
        }
    }
    if (address == null) {
        finish();
        return;
    }
    isInRecovery = address.isInRecovery();
    initView();
    processIntent();
    configureDonate();
}
 
Example #18
Source File: SelectAddressToSendActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    int position;
    Class<?> target;
    if (address.isHDM()) {
        position = AddressManager.getInstance().getHdmKeychain().getAddresses().indexOf
                (address);
        target = HdmSendActivity.class;
    } else if (address.hasPrivKey()) {
        position = AddressManager.getInstance().getPrivKeyAddresses().indexOf(address);
        target = SendActivity.class;
    } else {
        position = AddressManager.getInstance().getWatchOnlyAddresses().indexOf(address);
        target = GenerateUnsignedTxActivity.class;
    }
    Intent intent = new Intent(SelectAddressToSendActivity.this, target);
    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, position);
    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_IS_HDM_KEY_PASS_VALUE_TAG,
            address.isHDM());
    intent.putExtra(INTENT_EXTRA_ADDRESS, receivingAddress);
    intent.putExtra(INTENT_EXTRA_AMOUNT, btc);
    intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
    startActivity(intent);
    lv.postDelayed(finishRunnable, 800);
}
 
Example #19
Source File: EnterpriseHDMSendActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void initAddress() {
    if (!AddressManager.getInstance().hasEnterpriseHDMKeychain()) {
        return;
    }
    if (getIntent().getExtras().containsKey(BitherSetting.INTENT_REF
            .ADDRESS_POSITION_PASS_VALUE_TAG)) {
        addressPosition = getIntent().getExtras().getInt(BitherSetting.INTENT_REF
                .ADDRESS_POSITION_PASS_VALUE_TAG);
        if (addressPosition >= 0 && addressPosition < AddressManager.getInstance()
                .getEnterpriseHDMKeychain().getAddresses().size()) {
            address = AddressManager.getInstance().getEnterpriseHDMKeychain().getAddresses()
                    .get(addressPosition);
        }
    }
}
 
Example #20
Source File: AddAddressHotHDMFragment.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
public void singularServerFinish(final List<String> words, final String qr) {
    hdmHotAddWithAndroid.hdmKeychainLimit = AddressManager.isHDMKeychainLimit();
    llHot.setEnabled(false);
    llHot.setSelected(true);
    llCold.setEnabled(false);
    llCold.setSelected(true);
    llServer.setEnabled(false);
    llServer.setSelected(true);
    stopAllFlash();
    vBg.addLineAnimated(llServer, llHot, new Runnable() {
        @Override
        public void run() {
            DialogFragmentHDMSingularColdSeed.newInstance(words, qr, AddAddressHotHDMFragment
                    .this).show(getActivity().getSupportFragmentManager(),
                    DialogFragmentHDMSingularColdSeed.FragmentTag);
        }
    });
}
 
Example #21
Source File: QRCodeEnodeUtil.java    From bitherj with Apache License 2.0 6 votes vote down vote up
public static String getPublicKeyStrOfPrivateKey() {
    String content = "";
    List<Address> addresses = AddressManager.getInstance().getPrivKeyAddresses();
    for (int i = 0; i < addresses.size(); i++) {
        Address address = addresses.get(i);
        String pubStr = "";
        if (address.isFromXRandom()) {
            pubStr = QRCodeUtil.XRANDOM_FLAG;
        }
        pubStr = pubStr + Utils.bytesToHexString(address.getPubKey());
        content += pubStr;
        if (i < addresses.size() - 1) {
            content += QRCodeUtil.QR_CODE_SPLIT;
        }
    }
    content.toUpperCase(Locale.US);
    return content;
}
 
Example #22
Source File: SignMessageAddressListActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.slide_in_right, 0);
    setContentView(R.layout.activity_sign_message_select_address);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    hdAccount = AddressManager.getInstance().getHDAccountHot();
    hdAccountCold = AddressManager.getInstance().getHDAccountCold();
    bitpieHDAccountCold = AddressManager.getInstance().getBitpieHDAccountCold();
    signMessageTypeSelect = (SignMessageTypeSelect) getIntent().getSerializableExtra(SignMgsTypeSelect);
    isHot = (boolean) getIntent().getSerializableExtra(IsHdAccountHot);
    isShowAddress = getIntent().getBooleanExtra(IsShowAddress, false);
    tvTitle.setText(isShowAddress ? R.string.address_mine : R.string.sign_message_select_address);
    isSignHash = getIntent().getBooleanExtra(IsSignHash, false);
    if (signMessageTypeSelect != SignMessageTypeSelect.Hot) {
        String tempString = getIntent().getStringExtra(PassWord);
        password = tempString.subSequence(0, tempString.length());
    }
    initView();
}
 
Example #23
Source File: SplitBCCHDAccountMonitoredSendActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void validateValues() {
    boolean isValidAmounts = false;
        btcAmount = AddressManager.getInstance().getAmount(AbstractDb.
                hdAccountAddressProvider.getUnspentOutputByBlockNo(splitCoin.getForkBlockHeight(),AddressManager.getInstance()
                .getHDAccountMonitored().getHdSeedId()));
    if (btcAmount > 0) {
        isValidAmounts = true;
    }
    toAddress = etAddress.getText().toString().trim();
    boolean isValidAddress = Utils.validSplitBitCoinAddress(toAddress,splitCoin);
    boolean isValidPassword = true;
    if (etPassword.getVisibility() == View.VISIBLE) {
        SecureCharSequence password = new SecureCharSequence(etPassword.getText());
        isValidPassword = Utils.validPassword(password) && password.length() >= 6 &&
                password.length() <= getResources().getInteger(R.integer.password_length_max);
        password.wipe();
    }
    btnSend.setEnabled(isValidAddress && isValidAmounts && isValidPassword);
}
 
Example #24
Source File: EnterpriseHDMKeychainActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == AddCode || requestCode == AddAddressCode) {
        if (resultCode != RESULT_OK && requestCode == AddCode) {
            finish();
            return;
        }
        keychain = AddressManager.getInstance().getEnterpriseHDMKeychain();
        if (keychain == null) {
            finish();
            return;
        }
        return;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
Example #25
Source File: BCCAssetsDetectListActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.slide_in_right, 0);
    setContentView(R.layout.activity_sign_message_select_address);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    hdAccount = AddressManager.getInstance().getHDAccountHot();
    hdAccountMonitored = AddressManager.getInstance().getHDAccountMonitored();
    signMessageTypeSelect = (SignMessageTypeSelect) getIntent().getSerializableExtra(SignMgsTypeSelect);
    isHot = (boolean) getIntent().getSerializableExtra(IsHdAccountHot);
    isDetectBcc = (boolean) getIntent().getSerializableExtra(IsDetectBcc);
    isMonitored = (boolean) getIntent().getSerializableExtra(IsMonitored);
    if (!isDetectBcc) {
        tvTitle.setText(R.string.sign_message_select_address);
    } else {
        tvTitle.setText(R.string.detect_another_BCC_assets_select_address);
    }
    if (signMessageTypeSelect != SignMessageTypeSelect.Hot) {
        String tempString = getIntent().getStringExtra(PassWord);
        password = tempString.subSequence(0, tempString.length());
    }
    initView();
}
 
Example #26
Source File: ShowTransactionsForm.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private void initUI() {

        showTransactionHeaderForm = new ShowTransactionHeaderForm();
        JPanel panel = showTransactionHeaderForm.getPanel();
        JPanel btnTxPanel = createTxDetailButtonPanel();
        panelMain.add(panel, BorderLayout.NORTH);

        JPanel transactionsPanel = createTransactionsPanel();

        panelMain.add(transactionsPanel, BorderLayout.CENTER);

        panelMain.add(btnTxPanel, BorderLayout.SOUTH);

        if (AddressManager.getInstance().getAllAddresses().size() == 0 &&
                AddressManager.getInstance().getHdAccount() == null) {
            showTransactionHeaderForm.setVisible(false);
        } else {
            showTransactionHeaderForm.setVisible(true);
        }

    }
 
Example #27
Source File: OptionHotFragment.java    From bither-android with Apache License 2.0 6 votes vote down vote up
private void configureSwitchToCold() {
    final Runnable check = new Runnable() {
        @Override
        public void run() {
            if (AddressManager.getInstance().getAllAddresses().size() > 0 || AddressManager
                    .getInstance().getTrashAddresses().size() > 0 || AddressManager
                    .getInstance().getHdmKeychain() != null || AddressManager.getInstance()
                    .hasHDAccountHot() || AddressManager.getInstance().hasHDAccountMonitored()) {
                llSwitchToCold.setVisibility(View.GONE);
            } else {
                llSwitchToCold.setVisibility(View.VISIBLE);
            }
        }
    };
    if (AbstractApp.addressIsReady) {
        check.run();
    } else {
        new Thread() {
            @Override
            public void run() {
                AddressManager.getInstance().getAllAddresses();
                ThreadUtil.runOnMainThread(check);
            }
        }.start();
    }
}
 
Example #28
Source File: HDAccountColdUEntropyActivity.java    From bither-android with Apache License 2.0 6 votes vote down vote up
@Override
void didSuccess(Object obj) {
    final Intent intent = new Intent();
    ArrayList<String> addresses = new ArrayList<String>();
    addresses.add(HDAccount.HDAccountPlaceHolder);
    intent.putExtra(BitherSetting.INTENT_REF.ADDRESS_POSITION_PASS_VALUE_TAG, addresses);
    DialogFragmentHDMSingularColdSeed.newInstance(words, AddressManager.getInstance().getHDAccountCold()
            .getQRCodeFullEncryptPrivKey(), R.string
            .add_hd_account_show_seed_label, R.string.add_hd_account_show_seed_button, new
            DialogFragmentHDMSingularColdSeed.DialogFragmentHDMSingularColdSeedListener() {
        @Override
        public void HDMSingularColdSeedRemembered() {
            setResult(RESULT_OK, intent);
            finish();
            overridePendingTransition(0, R.anim.slide_out_bottom);
        }
    }).show(getSupportFragmentManager(), DialogFragmentHDMSingularColdSeed.FragmentTag);
}
 
Example #29
Source File: SendActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
protected void initAddress() {
    if (getIntent().getExtras().containsKey(BitherSetting.INTENT_REF
            .ADDRESS_POSITION_PASS_VALUE_TAG)) {
        addressPosition = getIntent().getExtras().getInt(BitherSetting.INTENT_REF
                .ADDRESS_POSITION_PASS_VALUE_TAG);
        if (addressPosition >= 0 && addressPosition < AddressManager.getInstance()
                .getPrivKeyAddresses().size()) {
            address = AddressManager.getInstance().getPrivKeyAddresses().get(addressPosition);
        }
    }
}
 
Example #30
Source File: HDMHotAddDesktop.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
public void xrandomResult() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (singular.isInSingularMode()) {
                        singular.xrandomFinished();
                    } else if (AddressManager.getInstance().getHdmKeychain() != null) {
                        if (delegate != null) {
                            delegate.moveToCold(true);
                        }
                    }

                }
            });
        }
    }).start();


}