use of wannabit.io.cosmostaion.dialog.Dialog_ChangeNickName 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);
}
}
Aggregations