Search in sources :

Example 1 with Dialog_ChangeNickName

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);
    }
}
Also used : WLog(wannabit.io.cosmostaion.utils.WLog) TASK_FETCH_NODE_INFO(wannabit.io.cosmostaion.base.BaseConstant.TASK_FETCH_NODE_INFO) Bundle(android.os.Bundle) CONST_PW_TX_SIMPLE_CHANGE_REWARD_ADDRESS(wannabit.io.cosmostaion.base.BaseConstant.CONST_PW_TX_SIMPLE_CHANGE_REWARD_ADDRESS) ImageView(android.widget.ImageView) Intent(android.content.Intent) WDp(wannabit.io.cosmostaion.utils.WDp) MenuItem(android.view.MenuItem) PushUpdateTask(wannabit.io.cosmostaion.task.FetchTask.PushUpdateTask) BigDecimal(java.math.BigDecimal) Lists(com.google.common.collect.Lists) WUtil(wannabit.io.cosmostaion.utils.WUtil) NodeInfo(wannabit.io.cosmostaion.model.NodeInfo) Handler(android.os.Handler) Looper(android.os.Looper) Toast(android.widget.Toast) TaskResult(wannabit.io.cosmostaion.task.TaskResult) View(android.view.View) Button(android.widget.Button) Dialog_ChangeNickName(wannabit.io.cosmostaion.dialog.Dialog_ChangeNickName) WithdrawAddressGrpcTask(wannabit.io.cosmostaion.task.gRpcTask.WithdrawAddressGrpcTask) OKEX_MAIN(wannabit.io.cosmostaion.base.BaseChain.OKEX_MAIN) CardView(androidx.cardview.widget.CardView) BaseConstant(wannabit.io.cosmostaion.base.BaseConstant) TaskListener(wannabit.io.cosmostaion.task.TaskListener) SwitchCompat(androidx.appcompat.widget.SwitchCompat) AsyncTask(android.os.AsyncTask) CompoundButton(android.widget.CompoundButton) Dialog_AccountShow(wannabit.io.cosmostaion.dialog.Dialog_AccountShow) TextUtils(android.text.TextUtils) R(wannabit.io.cosmostaion.R) BaseChain(wannabit.io.cosmostaion.base.BaseChain) AlertDialogUtils(wannabit.io.cosmostaion.dialog.AlertDialogUtils) List(java.util.List) TextView(android.widget.TextView) TASK_GRPC_FETCH_WITHDRAW_ADDRESS(wannabit.io.cosmostaion.base.BaseConstant.TASK_GRPC_FETCH_WITHDRAW_ADDRESS) Html(android.text.Html) RelativeLayout(android.widget.RelativeLayout) Toolbar(androidx.appcompat.widget.Toolbar) BaseActivity(wannabit.io.cosmostaion.base.BaseActivity) NodeInfoGrpcTask(wannabit.io.cosmostaion.task.gRpcTask.NodeInfoGrpcTask) BaseChain.isGRPC(wannabit.io.cosmostaion.base.BaseChain.isGRPC) NodeInfoTask(wannabit.io.cosmostaion.task.FetchTask.NodeInfoTask) TASK_GRPC_FETCH_NODE_INFO(wannabit.io.cosmostaion.base.BaseConstant.TASK_GRPC_FETCH_NODE_INFO) Bundle(android.os.Bundle) Dialog_AccountShow(wannabit.io.cosmostaion.dialog.Dialog_AccountShow) Intent(android.content.Intent) BaseChain(wannabit.io.cosmostaion.base.BaseChain) Dialog_ChangeNickName(wannabit.io.cosmostaion.dialog.Dialog_ChangeNickName)

Aggregations

Intent (android.content.Intent)1 AsyncTask (android.os.AsyncTask)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Looper (android.os.Looper)1 Html (android.text.Html)1 TextUtils (android.text.TextUtils)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 Toast (android.widget.Toast)1 SwitchCompat (androidx.appcompat.widget.SwitchCompat)1 Toolbar (androidx.appcompat.widget.Toolbar)1 CardView (androidx.cardview.widget.CardView)1 Lists (com.google.common.collect.Lists)1 BigDecimal (java.math.BigDecimal)1