Search in sources :

Example 6 with IbcToken

use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.

the class WUtil method dpCosmosTokenName.

public static String dpCosmosTokenName(Context c, BaseData baseData, TextView textView, String denom) {
    if (denom.equals(TOKEN_ATOM)) {
        textView.setTextColor(c.getResources().getColor(R.color.colorAtom));
        textView.setText("ATOM");
    } else if (denom.startsWith("pool")) {
        textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
        Liquidity.Pool poolInfo = baseData.getGravityPoolByDenom(denom);
        if (poolInfo != null) {
            textView.setText("GDEX-" + poolInfo.getId());
        } else {
            textView.setText("UnKnown");
        }
    } else if (denom.startsWith("ibc/")) {
        textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
        IbcToken ibcToken = baseData.getIbcToken(denom.replaceAll("ibc/", ""));
        if (ibcToken != null && ibcToken.auth) {
            if (ibcToken.base_denom.startsWith("cw20:")) {
                String cAddress = ibcToken.base_denom.replaceAll("cw20:", "");
                for (Cw20Assets assets : baseData.mCw20Assets) {
                    if (assets.contract_address.equalsIgnoreCase(cAddress)) {
                        textView.setText(assets.denom.toUpperCase());
                    }
                }
            } else {
                textView.setText(ibcToken.display_denom.toUpperCase());
            }
        } else {
            textView.setText("UnKnown");
        }
    } else {
        textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
        textView.setText("UnKnown");
    }
    return denom;
}
Also used : IbcToken(wannabit.io.cosmostaion.dao.IbcToken) Cw20Assets(wannabit.io.cosmostaion.dao.Cw20Assets) BalancerPool(osmosis.gamm.poolmodels.balancer.BalancerPool) SpannableString(android.text.SpannableString)

Example 7 with IbcToken

use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.

the class WUtil method dpSifTokenName.

public static String dpSifTokenName(Context c, BaseData baseData, TextView textView, String denom) {
    if (denom != null) {
        if (denom.equals(TOKEN_SIF)) {
            textView.setTextColor(c.getResources().getColor(R.color.colorSif));
            textView.setText("ROWAN");
        } else if (denom.startsWith("c")) {
            textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
            textView.setText(denom.substring(1).toUpperCase());
        } else if (denom.startsWith("ibc/")) {
            textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
            IbcToken ibcToken = baseData.getIbcToken(denom.replaceAll("ibc/", ""));
            if (ibcToken != null && ibcToken.auth) {
                if (ibcToken.base_denom.startsWith("cw20:")) {
                    String cAddress = ibcToken.base_denom.replaceAll("cw20:", "");
                    for (Cw20Assets assets : baseData.mCw20Assets) {
                        if (assets.contract_address.equalsIgnoreCase(cAddress)) {
                            textView.setText(assets.denom.toUpperCase());
                        }
                    }
                } else {
                    textView.setText(ibcToken.display_denom.toUpperCase());
                }
            } else {
                textView.setText("UnKnown");
            }
        } else {
            textView.setTextColor(c.getResources().getColor(R.color.colorWhite));
            textView.setText("UnKnown");
        }
    }
    return denom;
}
Also used : IbcToken(wannabit.io.cosmostaion.dao.IbcToken) Cw20Assets(wannabit.io.cosmostaion.dao.Cw20Assets) SpannableString(android.text.SpannableString)

Example 8 with IbcToken

use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.

the class WUtil method DpCosmosTokenImg.

/**
 * Token Img
 */
public static void DpCosmosTokenImg(BaseData baseData, ImageView imageView, String denom) {
    if (denom.equalsIgnoreCase(TOKEN_ATOM)) {
        Picasso.get().cancelRequest(imageView);
        imageView.setImageResource(R.drawable.atom_ic);
    } else if (denom.startsWith("pool")) {
        Liquidity.Pool poolInfo = baseData.getGravityPoolByDenom(denom);
        if (poolInfo != null) {
            imageView.setImageResource(R.drawable.token_gravitydex);
        }
    } else if (denom.startsWith("ibc/")) {
        IbcToken ibcToken = baseData.getIbcToken(denom.replaceAll("ibc/", ""));
        try {
            Picasso.get().load(ibcToken.moniker).fit().placeholder(R.drawable.token_default_ibc).error(R.drawable.token_default_ibc).into(imageView);
        } catch (Exception e) {
        }
    }
}
Also used : IbcToken(wannabit.io.cosmostaion.dao.IbcToken) BalancerPool(osmosis.gamm.poolmodels.balancer.BalancerPool) JSONException(org.json.JSONException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) CertificateException(java.security.cert.CertificateException)

Example 9 with IbcToken

use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.

the class WDp method allAssetToUserCurrency.

public static BigDecimal allAssetToUserCurrency(BaseChain baseChain, BaseData baseData) {
    BigDecimal totalValue = BigDecimal.ZERO;
    if (isGRPC(baseChain)) {
        for (Coin coin : baseData.mGrpcBalance) {
            if (coin.denom.equals(mainDenom(baseChain))) {
                BigDecimal amount = baseData.getAllMainAsset(mainDenom(baseChain));
                BigDecimal assetValue = userCurrencyValue(baseData, coin.denom, amount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(COSMOS_MAIN) && coin.denom.startsWith("pool")) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                BigDecimal assetValue = userCurrencyValue(baseData, coin.denom, amount, 6);
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(OSMOSIS_MAIN) && coin.denom.equals(TOKEN_ION) || baseChain.equals(CRESCENT_MAIN) && coin.denom.equals(TOKEN_BCRE) || baseChain.equals(NYX_MAIN) && coin.denom.equals(TOKEN_NYM)) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                BigDecimal assetValue = userCurrencyValue(baseData, coin.denom, amount, 6);
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(OSMOSIS_MAIN) && coin.denom.contains("gamm/pool")) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                BigDecimal assetValue = userCurrencyValue(baseData, coin.denom, amount, 18);
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(SIF_MAIN) && coin.denom.startsWith("c")) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                int decimal = WUtil.getSifCoinDecimal(baseData, coin.denom);
                BigDecimal assetValue = userCurrencyValue(baseData, coin.denom.substring(1), amount, decimal);
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(EMONEY_MAIN) || coin.denom.startsWith("e")) {
                BigDecimal available = baseData.getAvailable(coin.denom);
                totalValue = totalValue.add(userCurrencyValue(baseData, coin.denom, available, 6));
            } else if (baseChain.equals(KAVA_MAIN) && !coin.isIbc()) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                amount = amount.add(baseData.getVesting(coin.denom));
                String kavaDenom = WDp.getKavaBaseDenom(coin.denom);
                int kavaDecimal = WUtil.getKavaCoinDecimal(baseData, coin.denom);
                BigDecimal assetValue = userCurrencyValue(baseData, kavaDenom, amount, kavaDecimal);
                totalValue = totalValue.add(assetValue);
            } else if (baseChain.equals(GRABRIDGE_MAIN) && coin.denom.startsWith("gravity")) {
                Assets assets = baseData.getAsset(coin.denom);
                BigDecimal available = baseData.getAvailable(assets.denom);
                totalValue = totalValue.add(userCurrencyValue(baseData, assets.origin_symbol, available, assets.decimal));
            } else if (baseChain.equals(INJ_MAIN) && coin.denom.startsWith("peggy")) {
                Assets assets = baseData.getAsset(coin.denom);
                BigDecimal available = baseData.getAvailable(assets.denom);
                totalValue = totalValue.add(userCurrencyValue(baseData, assets.origin_symbol, available, assets.decimal));
            } else if (coin.isIbc()) {
                BigDecimal amount = baseData.getAvailable(coin.denom);
                IbcToken ibcToken = baseData.getIbcToken(coin.denom);
                if (ibcToken != null && ibcToken.auth) {
                    BigDecimal assetValue = userCurrencyValue(baseData, ibcToken.base_denom, amount, ibcToken.decimal);
                    totalValue = totalValue.add(assetValue);
                }
            }
        }
        if (baseData.getCw20sGrpc(baseChain).size() > 0) {
            for (Cw20Assets assets : baseData.getCw20sGrpc(baseChain)) {
                BigDecimal amount = assets.getAmount();
                totalValue = totalValue.add(userCurrencyValue(baseData, assets.denom, amount, assets.decimal));
            }
        }
    } else if (baseChain.equals(BNB_MAIN)) {
        for (Balance balance : baseData.mBalances) {
            if (balance.symbol.equals(mainDenom(baseChain))) {
                BigDecimal amount = baseData.getAllBnbTokenAmount(balance.symbol);
                BigDecimal assetValue = userCurrencyValue(baseData, TOKEN_BNB, amount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            } else {
                BigDecimal amount = baseData.getAllBnbTokenAmount(balance.symbol);
                BigDecimal convertAmount = WUtil.getBnbConvertAmount(baseData, balance.symbol, amount);
                BigDecimal assetValue = userCurrencyValue(baseData, TOKEN_BNB, convertAmount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            }
        }
    } else if (baseChain.equals(OKEX_MAIN)) {
        for (Balance balance : baseData.mBalances) {
            if (balance.symbol.equals(mainDenom(baseChain))) {
                BigDecimal amount = baseData.getAllExToken(balance.symbol);
                BigDecimal assetValue = userCurrencyValue(baseData, TOKEN_OK, amount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            } else {
                BigDecimal convertAmount = convertTokenToOkt(baseData, balance.symbol);
                BigDecimal assetValue = userCurrencyValue(baseData, TOKEN_OK, convertAmount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            }
        }
    } else {
        for (Balance balance : baseData.mBalances) {
            if (balance.symbol.equals(mainDenom(baseChain))) {
                BigDecimal amount = baseData.getAllMainAssetOld(balance.symbol);
                BigDecimal assetValue = userCurrencyValue(baseData, balance.symbol, amount, mainDivideDecimal(baseChain));
                totalValue = totalValue.add(assetValue);
            } else {
            }
        }
    }
    return totalValue;
}
Also used : Coin(wannabit.io.cosmostaion.model.type.Coin) IbcToken(wannabit.io.cosmostaion.dao.IbcToken) Assets(wannabit.io.cosmostaion.dao.Assets) Cw20Assets(wannabit.io.cosmostaion.dao.Cw20Assets) Cw20Assets(wannabit.io.cosmostaion.dao.Cw20Assets) SpannableString(android.text.SpannableString) Balance(wannabit.io.cosmostaion.dao.Balance) BigDecimal(java.math.BigDecimal)

Example 10 with IbcToken

use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.

the class WDp method showCoinDp.

public static void showCoinDp(Context c, BaseData baseData, String symbol, String amount, TextView denomTv, TextView amountTv, BaseChain chain) {
    if (isGRPC(chain) && symbol.startsWith("ibc")) {
        IbcToken ibcToken = baseData.getIbcToken(symbol.replaceAll("ibc/", ""));
        if (ibcToken != null && ibcToken.auth) {
            denomTv.setText(ibcToken.display_denom.toUpperCase());
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), ibcToken.decimal, ibcToken.decimal));
        } else {
            denomTv.setText("Unknown");
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
        }
        denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
    } else if (chain.equals(COSMOS_MAIN)) {
        if (symbol.equals(TOKEN_ATOM)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            denomTv.setText(symbol.toUpperCase());
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(IRIS_MAIN)) {
        if (symbol.equals(TOKEN_IRIS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            denomTv.setText(symbol.toUpperCase());
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(KAVA_MAIN)) {
        if (symbol.equals(TOKEN_KAVA)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else if (symbol.equals(TOKEN_HARD)) {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorHard));
        } else if (symbol.equals(TOKEN_USDX)) {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorUsdx));
        } else if (symbol.equals(TOKEN_SWP)) {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorSwp));
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        if (amountTv != null)
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), WUtil.getKavaCoinDecimal(baseData, symbol), WUtil.getKavaCoinDecimal(baseData, symbol)));
    } else if (chain.equals(IOV_MAIN)) {
        if (symbol.equals(TOKEN_IOV)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            denomTv.setText(symbol.toUpperCase());
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(BNB_MAIN)) {
        if (symbol.equals(TOKEN_BNB)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 0, 8));
    } else if (chain.equals(BAND_MAIN)) {
        DpMainDenom(c, chain.getChain(), denomTv);
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(OKEX_MAIN)) {
        if (symbol.equals(TOKEN_OK)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 0, 18));
    } else if (chain.equals(CERTIK_MAIN)) {
        if (symbol.equals(TOKEN_CERTIK)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(SECRET_MAIN)) {
        if (symbol.equals(TOKEN_SECRET)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(AKASH_MAIN)) {
        if (symbol.equals(TOKEN_AKASH)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(PERSIS_MAIN)) {
        if (symbol.equals(TOKEN_XPRT)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(SENTINEL_MAIN)) {
        if (symbol.equals(TOKEN_DVPN)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(FETCHAI_MAIN)) {
        if (symbol.equals(TOKEN_FET)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
    } else if (chain.equals(CRYPTO_MAIN)) {
        if (symbol.equals(TOKEN_CRO)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 8, 8));
    } else if (chain.equals(SIF_MAIN)) {
        int decimal = WUtil.getSifCoinDecimal(symbol);
        if (symbol.equals(TOKEN_SIF)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else if (symbol.startsWith("c")) {
            denomTv.setText(symbol.substring(1).toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), decimal, decimal));
    } else if (chain.equals(KI_MAIN)) {
        if (symbol.equals(TOKEN_KI)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(OSMOSIS_MAIN)) {
        if (symbol.equals(TOKEN_OSMOSIS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
        } else if (symbol.equals(TOKEN_ION)) {
            denomTv.setText("ION");
            denomTv.setTextColor(c.getResources().getColor(R.color.colorIon));
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
        } else if (symbol.startsWith("gamm/pool/")) {
            String[] value = symbol.split("/");
            denomTv.setText("GAMM-" + value[value.length - 1]);
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
        }
    } else if (chain.equals(MEDI_MAIN)) {
        if (symbol.equals(TOKEN_MEDI)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(EMONEY_MAIN)) {
        if (symbol.equalsIgnoreCase(TOKEN_NGM)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(RIZON_MAIN)) {
        if (symbol.equals(TOKEN_RIZON)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(JUNO_MAIN)) {
        if (symbol.equals(TOKEN_JUNO)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(REGEN_MAIN)) {
        if (symbol.equals(TOKEN_REGEN)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(BITCANNA_MAIN)) {
        if (symbol.equals(TOKEN_BITCANNA)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(ALTHEA_MAIN)) {
        if (symbol.equals(TOKEN_ALTHEA)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(STARGAZE_MAIN)) {
        if (symbol.equals(TOKEN_STARGAZE)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(GRABRIDGE_MAIN)) {
        int decimal = WUtil.getGBridgeCoinDecimal(baseData, symbol);
        if (symbol.equals(TOKEN_GRABRIDGE)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else if (symbol.startsWith("gravity")) {
            final Assets assets = baseData.getAsset(symbol);
            if (assets != null) {
                denomTv.setText(assets.origin_symbol);
                denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            }
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), decimal, decimal));
    } else if (chain.equals(COMDEX_MAIN)) {
        if (symbol.equals(TOKEN_COMDEX)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(INJ_MAIN)) {
        if (symbol.equals(TOKEN_INJ)) {
            DpMainDenom(c, chain.getChain(), denomTv);
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
        } else if (symbol.startsWith("peggy")) {
            final Assets assets = baseData.getAsset(symbol);
            if (assets != null) {
                denomTv.setText(assets.origin_symbol);
                denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
                amountTv.setText(getDpAmount2(c, new BigDecimal(amount), assets.decimal, assets.decimal));
            }
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
            amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
        }
    } else if (chain.equals(BITSONG_MAIN)) {
        if (symbol.equals(TOKEN_BITSONG)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(DESMOS_MAIN)) {
        if (symbol.equals(TOKEN_DESMOS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(LUM_MAIN)) {
        if (symbol.equals(TOKEN_LUM)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(CHIHUAHUA_MAIN)) {
        if (symbol.equals(TOKEN_CHIHUAHUA)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(AXELAR_MAIN)) {
        if (symbol.equals(TOKEN_AXELAR)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(KONSTELL_MAIN)) {
        if (symbol.equals(TOKEN_DARC)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(UMEE_MAIN)) {
        if (symbol.equals(TOKEN_UMEE)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(EVMOS_MAIN)) {
        if (symbol.equals(TOKEN_EVMOS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
    } else if (chain.equals(CUDOS_MAIN)) {
        if (symbol.equals(TOKEN_CUDOS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 18, 18));
    } else if (chain.equals(PROVENANCE_MAIN)) {
        if (symbol.equals(TOKEN_HASH)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 9, 9));
    } else if (chain.equals(CERBERUS_MAIN)) {
        if (symbol.equals(TOKEN_CRBRUS)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(OMNIFLIX_MAIN)) {
        if (symbol.equals(TOKEN_FLIX)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(CRESCENT_MAIN)) {
        if (symbol.equals(TOKEN_CRE)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else if (symbol.equals(TOKEN_BCRE)) {
            denomTv.setText(R.string.str_bcre_c);
            denomTv.setTextColor(c.getResources().getColor(R.color.colorCrescent2));
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(ASSETMANTLE_MAIN)) {
        if (symbol.equals(TOKEN_MANTLE)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(NYX_MAIN)) {
        if (symbol.equals(TOKEN_NYX)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else if (symbol.equals(TOKEN_NYM)) {
            denomTv.setText(R.string.str_nym_c);
            denomTv.setTextColor(c.getResources().getColor(R.color.colorNym));
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(STATION_TEST)) {
        if (symbol.equals(TOKEN_STATION)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        }
    } else if (chain.equals(COSMOS_TEST)) {
        if (symbol.equals(TOKEN_COSMOS_TEST)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(IRIS_TEST)) {
        if (symbol.equals(TOKEN_IRIS_TEST)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    } else if (chain.equals(CRESCENT_TEST)) {
        if (symbol.equals(TOKEN_CRESCENT_TEST)) {
            DpMainDenom(c, chain.getChain(), denomTv);
        } else {
            denomTv.setText(symbol.toUpperCase());
            denomTv.setTextColor(c.getResources().getColor(R.color.colorWhite));
        }
        amountTv.setText(getDpAmount2(c, new BigDecimal(amount), 6, 6));
    }
}
Also used : IbcToken(wannabit.io.cosmostaion.dao.IbcToken) Assets(wannabit.io.cosmostaion.dao.Assets) Cw20Assets(wannabit.io.cosmostaion.dao.Cw20Assets) BigDecimal(java.math.BigDecimal)

Aggregations

IbcToken (wannabit.io.cosmostaion.dao.IbcToken)14 Cw20Assets (wannabit.io.cosmostaion.dao.Cw20Assets)7 BigDecimal (java.math.BigDecimal)6 Coin (wannabit.io.cosmostaion.model.type.Coin)5 SpannableString (android.text.SpannableString)4 Assets (wannabit.io.cosmostaion.dao.Assets)4 Balance (wannabit.io.cosmostaion.dao.Balance)3 Intent (android.content.Intent)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 CardView (androidx.cardview.widget.CardView)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 CertificateException (java.security.cert.CertificateException)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 BalancerPool (osmosis.gamm.poolmodels.balancer.BalancerPool)2 IBCTokenDetailActivity (wannabit.io.cosmostaion.activities.tokenDetail.IBCTokenDetailActivity)2 IbcPath (wannabit.io.cosmostaion.dao.IbcPath)2