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;
}
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);
}
}
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);
});
}
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));
}
}
Aggregations