use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.
the class MainTokensFragment method onBindIbcUnknownToken.
// with Unknown IBC gRPC
private void onBindIbcUnknownToken(TokensAdapter.AssetHolder holder, int position) {
final Coin coin = mIbcUnknownGrpc.get(position);
final IbcToken ibcToken = getBaseDao().getIbcToken(coin.denom);
if (ibcToken == null) {
holder.itemSymbol.setText("Unknown");
holder.itemInnerSymbol.setText("");
holder.itemFullName.setText("");
holder.itemImg.setImageDrawable(getResources().getDrawable(R.drawable.token_default_ibc));
holder.itemBalance.setText(WDp.getDpAmount2(getContext(), new BigDecimal(coin.amount), 6, 6));
holder.itemValue.setText(WDp.dpUserCurrencyValue(getBaseDao(), coin.denom, BigDecimal.ZERO, 6));
} else {
holder.itemSymbol.setText("Unknown");
holder.itemInnerSymbol.setText("");
holder.itemFullName.setText(ibcToken.channel_id);
holder.itemImg.setImageDrawable(getResources().getDrawable(R.drawable.token_default_ibc));
holder.itemBalance.setText(WDp.getDpAmount2(getContext(), new BigDecimal(coin.amount), 6, 6));
holder.itemValue.setText(WDp.dpUserCurrencyValue(getBaseDao(), coin.denom, new BigDecimal(coin.amount), 6));
}
holder.itemRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getMainActivity(), IBCTokenDetailActivity.class);
intent.putExtra("denom", coin.denom);
startActivity(intent);
}
});
}
use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.
the class MainTokensFragment method onBindIbcAuthToken.
// with Authed IBC gRPC
private void onBindIbcAuthToken(TokensAdapter.AssetHolder holder, int position) {
final Coin coin = mIbcAuthedGrpc.get(position);
final IbcToken ibcToken = getBaseDao().getIbcToken(coin.denom);
holder.itemSymbol.setTextColor(getResources().getColor(R.color.colorWhite));
holder.itemFullName.setEllipsize(TextUtils.TruncateAt.MIDDLE);
if (ibcToken == null) {
holder.itemSymbol.setText("Unknown");
holder.itemInnerSymbol.setText("");
holder.itemFullName.setText("");
holder.itemImg.setImageDrawable(getResources().getDrawable(R.drawable.token_default_ibc));
holder.itemBalance.setText(WDp.getDpAmount2(getContext(), new BigDecimal(coin.amount), 6, 6));
holder.itemValue.setText(WDp.dpUserCurrencyValue(getBaseDao(), coin.denom, BigDecimal.ZERO, 6));
} else {
holder.itemSymbol.setText(ibcToken.display_denom.toUpperCase());
holder.itemInnerSymbol.setText("");
holder.itemFullName.setText(ibcToken.channel_id);
holder.itemBalance.setText(WDp.getDpAmount2(getContext(), new BigDecimal(coin.amount), ibcToken.decimal, 6));
holder.itemValue.setText(WDp.dpUserCurrencyValue(getBaseDao(), getBaseDao().getBaseDenom(coin.denom), new BigDecimal(coin.amount), ibcToken.decimal));
try {
Picasso.get().load(ibcToken.moniker).fit().placeholder(R.drawable.token_default_ibc).error(R.drawable.token_default_ibc).into(holder.itemImg);
} catch (Exception e) {
}
}
holder.itemRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getMainActivity(), IBCTokenDetailActivity.class);
intent.putExtra("denom", coin.denom);
startActivity(intent);
}
});
}
use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.
the class BaseData method getIbcRollbackChannel.
public ArrayList<IbcPath.Path> getIbcRollbackChannel(String denom, ArrayList<IbcPath.Path> paths) {
ArrayList<IbcPath.Path> result = new ArrayList<>();
IbcToken ibcToken = getIbcToken(denom);
if (paths != null && paths.size() > 0) {
for (IbcPath.Path path : paths) {
if (path.auth != null && path.auth && path.channel_id.equalsIgnoreCase(ibcToken.channel_id)) {
result.add(path);
}
}
}
return result;
}
use of wannabit.io.cosmostaion.dao.IbcToken in project cosmostation-android by cosmostation.
the class BaseData method getIbcRollbackRelayer.
public ArrayList<IbcPath> getIbcRollbackRelayer(String denom) {
ArrayList<IbcPath> result = new ArrayList<>();
IbcToken ibcToken = getIbcToken(denom.replaceAll("ibc/", ""));
if (mIbcPaths != null && mIbcPaths.size() > 0) {
for (IbcPath ibcPath : mIbcPaths) {
for (IbcPath.Path path : ibcPath.paths) {
if (path.channel_id != null && path.channel_id.equalsIgnoreCase(ibcToken.channel_id)) {
result.add(ibcPath);
}
}
}
}
return result;
}
Aggregations