use of wannabit.io.cosmostaion.dialog.Dialog_AccountShow in project cosmostation-android by cosmostation.
the class MainActivity method onAddressDialog.
public void onAddressDialog() {
Bundle bundle = new Bundle();
bundle.putString("address", mAccount.address);
if (TextUtils.isEmpty(mAccount.nickName))
bundle.putString("title", getString(R.string.str_my_wallet) + mAccount.id);
else
bundle.putString("title", mAccount.nickName);
Dialog_AccountShow show = Dialog_AccountShow.newInstance(bundle);
show.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(show, "dialog").commitNowAllowingStateLoss();
}
use of wannabit.io.cosmostaion.dialog.Dialog_AccountShow in project cosmostation-android by cosmostation.
the class AccountDetailActivity method onClick.
@Override
public void onClick(View v) {
if (v.equals(mBtnCheck)) {
if (mAccount.hasPrivateKey) {
Intent intent = new Intent(AccountDetailActivity.this, PasswordCheckActivity.class);
intent.putExtra(BaseConstant.CONST_PW_PURPOSE, BaseConstant.CONST_PW_CHECK_MNEMONIC);
intent.putExtra("checkid", mAccount.id);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
} else {
Intent restoreIntent = new Intent(AccountDetailActivity.this, RestoreActivity.class);
restoreIntent.putExtra("chain", mBaseChain.getChain());
startActivity(restoreIntent);
}
} else if (v.equals(mBtnCheckKey)) {
if (mAccount.hasPrivateKey) {
Intent intent = new Intent(AccountDetailActivity.this, PasswordCheckActivity.class);
intent.putExtra(BaseConstant.CONST_PW_PURPOSE, BaseConstant.CONST_PW_CHECK_PRIVATE_KEY);
intent.putExtra("checkid", mAccount.id);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
} else {
Intent restoreIntent = new Intent(AccountDetailActivity.this, RestoreKeyActivity.class);
restoreIntent.putExtra("chain", mBaseChain.getChain());
startActivity(restoreIntent);
}
} else if (v.equals(mBtnDelete)) {
int accountSum = 0;
for (BaseChain baseChain : getBaseDao().dpSortedChains()) {
accountSum = accountSum + getBaseDao().onSelectAccountsByChain(baseChain).size();
}
if (accountSum <= 1) {
Toast.makeText(AccountDetailActivity.this, getString(R.string.error_reserve_1_account), Toast.LENGTH_SHORT).show();
return;
}
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_delete_title), getString(R.string.str_delete_msg), AlertDialogUtils.highlightingText(getString(R.string.str_delete)), view -> onStartDeleteUser(), getString(R.string.str_close), null);
} else if (v.equals(mNameEditImg)) {
Bundle bundle = new Bundle();
bundle.putLong("id", mAccount.id);
bundle.putString("name", mAccount.nickName);
Dialog_ChangeNickName delete = Dialog_ChangeNickName.newInstance(bundle);
delete.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(delete, "dialog").commitNowAllowingStateLoss();
} else if (v.equals(mBtnQr)) {
Bundle bundle = new Bundle();
bundle.putString("address", mAccount.address);
bundle.putString("title", mAccountName.getText().toString());
Dialog_AccountShow show = Dialog_AccountShow.newInstance(bundle);
show.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(show, "dialog").commitNowAllowingStateLoss();
} else if (v.equals(mBtnRewardAddressChange)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
if (TextUtils.isEmpty(mRewardAddress.getText().toString())) {
Toast.makeText(getBaseContext(), R.string.error_network_error, Toast.LENGTH_SHORT).show();
return;
}
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_reward_address_change_title), Html.fromHtml(getString(R.string.str_reward_address_change_msg) + "<br/><br/><font color=\"#ff0000\">" + AlertDialogUtils.highlightingText(getString(R.string.str_reward_address_change_market_no) + "</font>")), AlertDialogUtils.highlightingText(getString(R.string.str_cancel)), null, getString(R.string.str_continue), view -> onStartChangeRewardAddress(), true);
}
}
use of wannabit.io.cosmostaion.dialog.Dialog_AccountShow in project cosmostation-android by cosmostation.
the class NativeTokenGrpcActivity method onClick.
@Override
public void onClick(View v) {
if (v.equals(mBtnAddressPopup)) {
Bundle bundle = new Bundle();
bundle.putString("address", mAccount.address);
if (TextUtils.isEmpty(mAccount.nickName)) {
bundle.putString("title", getString(R.string.str_my_wallet) + mAccount.id);
} else {
bundle.putString("title", mAccount.nickName);
}
Dialog_AccountShow show = Dialog_AccountShow.newInstance(bundle);
show.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(show, "dialog").commitNowAllowingStateLoss();
} else if (v.equals(mBtnIbcSend)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
final BigDecimal feeAmount = WUtil.getEstimateGasFeeAmount(this, mBaseChain, CONST_PW_TX_IBC_TRANSFER, 0);
List<String> availableFeeDenomList = Lists.newArrayList();
for (String denom : WDp.getGasDenomList(mBaseChain)) {
if (getBaseDao().getAvailable(denom).compareTo(feeAmount) >= 0) {
availableFeeDenomList.add(denom);
}
}
if (availableFeeDenomList.isEmpty()) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_budget, Toast.LENGTH_SHORT).show();
return;
}
AlertDialogUtils.showSingleButtonDialog(this, getString(R.string.str_ibc_warning_c), Html.fromHtml(getString(R.string.str_ibc_warning_msg1) + "<br><br>" + getString(R.string.str_ibc_warning_msg2)), Html.fromHtml("<font color=\"#007AFF\">" + getString(R.string.str_ibc_continue_c) + "</font>"), view -> onCheckIbcTransfer(mNativeGrpcDenom));
} else if (v.equals(mBtnSend)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
Intent intent = new Intent(getBaseContext(), SendActivity.class);
BigDecimal feeAmount = WUtil.getEstimateGasFeeAmount(getBaseContext(), mBaseChain, CONST_PW_TX_SIMPLE_SEND, 0);
List<String> availableFeeDenomList = Lists.newArrayList();
for (String denom : WDp.getGasDenomList(mBaseChain)) {
if (getBaseDao().getAvailable(denom).compareTo(feeAmount) >= 0) {
availableFeeDenomList.add(denom);
}
}
if (availableFeeDenomList.isEmpty()) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_budget, Toast.LENGTH_SHORT).show();
return;
}
intent.putExtra("sendTokenDenom", mNativeGrpcDenom);
startActivity(intent);
} else if (v.equals(mBtnBep3Send)) {
onStartHTLCSendActivity(mNativeGrpcDenom);
}
}
use of wannabit.io.cosmostaion.dialog.Dialog_AccountShow in project cosmostation-android by cosmostation.
the class StakingTokenDetailActivity method onClick.
@Override
public void onClick(View v) {
if (v.equals(mBtnAddressPopup)) {
Bundle bundle = new Bundle();
bundle.putString("address", mAccount.address);
if (TextUtils.isEmpty(mAccount.nickName)) {
bundle.putString("title", getString(R.string.str_my_wallet) + mAccount.id);
} else {
bundle.putString("title", mAccount.nickName);
}
Dialog_AccountShow show = Dialog_AccountShow.newInstance(bundle);
show.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(show, "dialog").commitNowAllowingStateLoss();
} else if (v.equals(mBtnBep3Send)) {
onStartHTLCSendActivity(WDp.mainDenom(mBaseChain));
} else if (v.equals(mBtnSend)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
Intent intent = new Intent(getBaseContext(), SendActivity.class);
BigDecimal mainAvailable = getBaseDao().availableAmount(WDp.mainDenom(mBaseChain));
BigDecimal feeAmount = WUtil.getEstimateGasFeeAmount(getBaseContext(), mBaseChain, CONST_PW_TX_SIMPLE_SEND, 0);
if (mainAvailable.compareTo(feeAmount) < 0) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_fee, Toast.LENGTH_SHORT).show();
return;
}
intent.putExtra("sendTokenDenom", mMainDenom);
startActivity(intent);
}
}
use of wannabit.io.cosmostaion.dialog.Dialog_AccountShow in project cosmostation-android by cosmostation.
the class StakingTokenGrpcActivity method onClick.
@Override
public void onClick(View v) {
if (v.equals(mBtnAddressPopup)) {
Bundle bundle = new Bundle();
bundle.putString("address", mAccount.address);
if (TextUtils.isEmpty(mAccount.nickName)) {
bundle.putString("title", getString(R.string.str_my_wallet) + mAccount.id);
} else {
bundle.putString("title", mAccount.nickName);
}
Dialog_AccountShow show = Dialog_AccountShow.newInstance(bundle);
show.setCancelable(true);
getSupportFragmentManager().beginTransaction().add(show, "dialog").commitNowAllowingStateLoss();
} else if (v.equals(mBtnIbcSend)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
BigDecimal mainAvailable = getBaseDao().getAvailable(WDp.mainDenom(mBaseChain));
BigDecimal feeAmount = WUtil.getEstimateGasFeeAmount(this, mBaseChain, CONST_PW_TX_IBC_TRANSFER, 0);
if (mainAvailable.compareTo(feeAmount) < 0) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_budget, Toast.LENGTH_SHORT).show();
return;
}
List<String> availableFeeDenomList = Lists.newArrayList();
for (String denom : WDp.getGasDenomList(mBaseChain)) {
if (getBaseDao().getAvailable(denom).compareTo(feeAmount) >= 0) {
availableFeeDenomList.add(denom);
}
}
if (availableFeeDenomList.isEmpty()) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_budget, Toast.LENGTH_SHORT).show();
return;
}
AlertDialogUtils.showSingleButtonDialog(this, getString(R.string.str_ibc_warning_c), Html.fromHtml(getString(R.string.str_ibc_warning_msg1) + "<br><br>" + getString(R.string.str_ibc_warning_msg2)), Html.fromHtml("<font color=\"#007AFF\">" + getString(R.string.str_ibc_continue_c) + "</font>"), view -> onCheckIbcTransfer(mMainDenom));
} else if (v.equals(mBtnSend)) {
if (!mAccount.hasPrivateKey) {
AlertDialogUtils.showDoubleButtonDialog(this, getString(R.string.str_only_observe_title), getString(R.string.str_only_observe_msg), Html.fromHtml("<font color=\"#9C6CFF\">" + getString(R.string.str_add_mnemonics) + "</font>"), view -> onAddMnemonicForAccount(), getString(R.string.str_close), null);
return;
}
Intent intent = new Intent(getBaseContext(), SendActivity.class);
BigDecimal mainAvailable = getBaseDao().getAvailable(WDp.mainDenom(mBaseChain));
BigDecimal feeAmount = WUtil.getEstimateGasFeeAmount(getBaseContext(), mBaseChain, CONST_PW_TX_SIMPLE_SEND, 0);
if (mainAvailable.compareTo(feeAmount) < 0) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_fee, Toast.LENGTH_SHORT).show();
return;
}
List<String> availableFeeDenomList = Lists.newArrayList();
for (String denom : WDp.getGasDenomList(mBaseChain)) {
if (getBaseDao().getAvailable(denom).compareTo(feeAmount) >= 0) {
availableFeeDenomList.add(denom);
}
}
if (availableFeeDenomList.isEmpty()) {
Toast.makeText(getBaseContext(), R.string.error_not_enough_fee, Toast.LENGTH_SHORT).show();
return;
}
intent.putExtra("sendTokenDenom", mMainDenom);
startActivity(intent);
}
}
Aggregations