Search in sources :

Example 6 with BaseChain

use of wannabit.io.cosmostaion.base.BaseChain in project cosmostation-android by cosmostation.

the class ConnectWalletActivity method hasAccount.

private boolean hasAccount(String chainId) {
    BaseChain requestChain = WDp.getChainTypeByChainId(chainId);
    if (requestChain == null) {
        onShowNotSupportChain(chainId);
        return false;
    }
    ArrayList<Account> existAccount = getBaseDao().onSelectAllAccountsByChainWithKey(requestChain);
    if (existAccount.isEmpty()) {
        onShowNoAccountsForChain();
        return false;
    }
    return true;
}
Also used : WCCosmostationAccount(com.trustwallet.walletconnect.models.cosmostation.WCCosmostationAccount) Dialog_WC_Account(wannabit.io.cosmostaion.dialog.Dialog_WC_Account) WCAccount(com.trustwallet.walletconnect.models.WCAccount) Account(wannabit.io.cosmostaion.dao.Account) BaseChain(wannabit.io.cosmostaion.base.BaseChain)

Example 7 with BaseChain

use of wannabit.io.cosmostaion.base.BaseChain in project cosmostation-android by cosmostation.

the class WalletEditActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wallet_edit);
    mToolbar = findViewById(R.id.tool_bar);
    mBtnDone = findViewById(R.id.btn_done);
    mDisplayRecyclerView = findViewById(R.id.display_recycler);
    mHideRecyclerView = findViewById(R.id.hide_recycler);
    mEmptyChains = findViewById(R.id.empty_chains);
    mBtnDone.setOnClickListener(this);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mDisplayRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    mDisplayRecyclerView.setHasFixedSize(true);
    mDisplayListAdapter = new DisplayListAdapter();
    mDisplayRecyclerView.setAdapter(mDisplayListAdapter);
    mItemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback(mDisplayListAdapter));
    mItemTouchHelper.attachToRecyclerView(mDisplayRecyclerView);
    mHideRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    mHideRecyclerView.setHasFixedSize(true);
    mHideListAdapter = new HideListAdapter();
    mHideRecyclerView.setAdapter(mHideListAdapter);
    for (BaseChain baseChain : BaseChain.SUPPORT_CHAINS()) {
        if (!baseChain.equals(BaseChain.COSMOS_MAIN)) {
            mAllChains.add(baseChain);
        }
    }
    mDisplayChains = getBaseDao().userSortedChains();
    mHideChains = getBaseDao().userHideChains();
    if (mHideChains.size() <= 0) {
        mEmptyChains.setVisibility(View.VISIBLE);
        mHideRecyclerView.setVisibility(View.GONE);
    }
}
Also used : ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) BaseChain(wannabit.io.cosmostaion.base.BaseChain)

Example 8 with BaseChain

use of wannabit.io.cosmostaion.base.BaseChain in project cosmostation-android by cosmostation.

the class WalletMintHolder method onBindHolder.

public void onBindHolder(@NotNull MainActivity mainActivity) {
    final ChainParam.Params param = mainActivity.getBaseDao().mChainParam;
    final BaseChain baseChain = mainActivity.mBaseChain;
    if (param != null) {
        mInflation.setText(WDp.getPercentDp(param.getDpInflation(baseChain)));
        if (param.getDpApr(baseChain).equals(BigDecimal.ZERO)) {
            mAPR.setText("0.00%");
        } else {
            mAPR.setText(WDp.getPercentDp(param.getDpApr(baseChain)));
        }
    } else {
        mInflation.setText("-");
        mAPR.setText("-");
    }
    mAprCard.setOnClickListener(v -> {
        Spanned msg = null;
        String msg2;
        String msg3;
        if (param == null || param.getDpApr(baseChain).equals(BigDecimal.ZERO)) {
            msg2 = "0%";
        } else {
            msg2 = "" + WDp.getPercentDp(param.getDpApr(baseChain));
        }
        if (param == null || param.getDpRealApr(baseChain).equals(BigDecimal.ZERO)) {
            msg3 = "N/A";
        } else {
            msg3 = "" + WDp.getPercentDp(param.getDpRealApr(baseChain));
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            msg = Html.fromHtml("<b>" + mainActivity.getString(R.string.str_apr_help_onchain_msg) + "</b>" + "<br>" + "<font color=\"#7A7F88\">" + msg2 + "</font>" + "<p>" + "<br>" + "<b>" + mainActivity.getString(R.string.str_apr_help_real_msg) + "</b>" + "<br>" + "<font color=\"#7A7F88\">" + msg3 + "</font>", Html.FROM_HTML_MODE_LEGACY);
        }
        AlertDialogUtils.showSingleButtonDialog(mainActivity, msg, null, mainActivity.getString(R.string.str_ok), null);
    });
}
Also used : ChainParam(wannabit.io.cosmostaion.dao.ChainParam) BaseChain(wannabit.io.cosmostaion.base.BaseChain) Spanned(android.text.Spanned)

Example 9 with BaseChain

use of wannabit.io.cosmostaion.base.BaseChain in project cosmostation-android by cosmostation.

the class IBCSendStep0Fragment method onUpdateView.

private void onUpdateView() {
    if (getSActivity().mToIbcDenom.startsWith("ibc/")) {
        mToChainLayer.setClickable(false);
        mToChainLayer.setBackgroundResource(R.drawable.box_gray);
        mDialogImg.setVisibility(View.GONE);
    } else {
        mToChainLayer.setClickable(true);
        mToChainLayer.setBackgroundResource(R.drawable.btn_trans_with_border);
        mDialogImg.setVisibility(View.VISIBLE);
    }
    WDp.getChainImg(getSActivity(), getSActivity().mBaseChain, mFromChainImg);
    WDp.getChainTitle2(getSActivity(), getSActivity().mBaseChain, mFromChainTv);
    BaseChain toChain = WDp.getChainTypeByChainId(mIbcSelectedRelayer.chain_id);
    WDp.getChainImg(getSActivity(), toChain, mToChainImg);
    WDp.getChainTitle2(getSActivity(), toChain, mToChainTv);
    mRelayerTxt.setText(mIbcSelectedPath.channel_id);
    if (mIbcSelectedPath.auth == null) {
        mRelayerImg.setImageDrawable(getSActivity().getDrawable(R.drawable.unknown));
    } else if (mIbcSelectedPath.auth) {
        mRelayerImg.setImageDrawable(getSActivity().getDrawable(R.drawable.wellknown));
    }
}
Also used : BaseChain(wannabit.io.cosmostaion.base.BaseChain)

Aggregations

BaseChain (wannabit.io.cosmostaion.base.BaseChain)9 BigDecimal (java.math.BigDecimal)2 ChainAccounts (wannabit.io.cosmostaion.dao.ChainAccounts)2 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 Spanned (android.text.Spanned)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