use of wannabit.io.cosmostaion.dao.Assets 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));
}
}
use of wannabit.io.cosmostaion.dao.Assets in project cosmostation-android by cosmostation.
the class BridgeTokenGrpcActivity method onUpdateView.
private void onUpdateView() {
mBtnAddressPopup.setCardBackgroundColor(WDp.getChainBgColor(BridgeTokenGrpcActivity.this, mBaseChain));
final Assets assets = getBaseDao().getAsset(mBridgeDenom);
Picasso.get().load(ASSET_IMG_URL + assets.logo).fit().placeholder(R.drawable.token_ic).error(R.drawable.token_ic).into(mToolbarSymbolImg);
mToolbarSymbol.setText(assets.origin_symbol);
mToolbarSymbol.setTextColor(getResources().getColor(R.color.colorWhite));
mTotalAmount = getBaseDao().getAvailable(mBridgeDenom);
mItemPerPrice.setText(WDp.dpPerUserCurrencyValue(getBaseDao(), assets.origin_symbol));
mItemUpDownPrice.setText(WDp.dpValueChange(getBaseDao(), assets.origin_symbol));
final BigDecimal lastUpDown = WDp.valueChange(getBaseDao(), assets.origin_symbol);
if (lastUpDown.compareTo(BigDecimal.ZERO) > 0) {
mItemUpDownImg.setVisibility(View.VISIBLE);
mItemUpDownImg.setImageDrawable(getResources().getDrawable(R.drawable.ic_price_up));
} else if (lastUpDown.compareTo(BigDecimal.ZERO) < 0) {
mItemUpDownImg.setVisibility(View.VISIBLE);
mItemUpDownImg.setImageDrawable(getResources().getDrawable(R.drawable.ic_price_down));
} else {
mItemUpDownImg.setVisibility(View.INVISIBLE);
}
mAddress.setText(mAccount.address);
mKeyState.setColorFilter(ContextCompat.getColor(getBaseContext(), R.color.colorGray0), android.graphics.PorterDuff.Mode.SRC_IN);
if (mAccount.hasPrivateKey) {
mKeyState.setColorFilter(WDp.getChainColor(getBaseContext(), mBaseChain), android.graphics.PorterDuff.Mode.SRC_IN);
}
mTotalValue.setText(WDp.dpUserCurrencyValue(getBaseDao(), assets.origin_symbol, mTotalAmount, assets.decimal));
mSwipeRefreshLayout.setRefreshing(false);
}
Aggregations