use of wannabit.io.cosmostaion.model.type.Coin in project cosmostation-android by cosmostation.
the class OKStakingFragmentStep0 method isValidateDepositAmount.
private boolean isValidateDepositAmount() {
try {
if (getSActivity().mBaseChain.equals(OKEX_MAIN) || getSActivity().mBaseChain.equals(OK_TEST)) {
BigDecimal depositTemp = new BigDecimal(mAmountInput.getText().toString().trim());
if (depositTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (depositTemp.compareTo(mMaxAvailable) > 0)
return false;
Coin token = new Coin(TOKEN_OK, depositTemp.setScale(mDpDecimal).toPlainString());
getSActivity().mToDepositCoin = token;
return true;
}
return false;
} catch (Exception e) {
getSActivity().mToDepositCoin = null;
return false;
}
}
use of wannabit.io.cosmostaion.model.type.Coin in project cosmostation-android by cosmostation.
the class HtlcSendStep2Fragment method isValidateAmount.
private boolean isValidateAmount() {
mToSendCoins.clear();
try {
if (getSActivity().mBaseChain.equals(BaseChain.BNB_MAIN)) {
BigDecimal sendTemp = new BigDecimal(mAmountInput.getText().toString().trim());
if (sendTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (sendTemp.compareTo(mMinAvailable) <= 0)
return false;
if (sendTemp.compareTo(mMaxAvailable) > 0)
return false;
Coin token = new Coin(getSActivity().mToSwapDenom, sendTemp.toPlainString());
mToSendCoins.add(token);
return true;
} else if (getSActivity().mBaseChain.equals(BaseChain.KAVA_MAIN)) {
BigDecimal sendTemp = new BigDecimal(mAmountInput.getText().toString().trim()).movePointRight(mDecimal);
if (sendTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (sendTemp.compareTo(mMinAvailable) <= 0)
return false;
if (sendTemp.compareTo(mMaxAvailable) > 0)
return false;
Coin token = new Coin(getSActivity().mToSwapDenom.toLowerCase(), sendTemp.toPlainString());
mToSendCoins.add(token);
}
if (mToSendCoins.size() <= 0) {
return false;
}
} catch (Exception e) {
mToSendCoins.clear();
return false;
}
return true;
}
use of wannabit.io.cosmostaion.model.type.Coin in project cosmostation-android by cosmostation.
the class DepositPoolStep0Fragment method isValidateJoinPool.
private boolean isValidateJoinPool() {
try {
BigDecimal InputAmountTemp = new BigDecimal(mJoinPoolInput0.getText().toString().trim());
if (InputAmountTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (InputAmountTemp.compareTo(mAvailable0MaxAmount.movePointLeft(mCoin0Decimal).setScale(mCoin0Decimal, RoundingMode.CEILING)) > 0)
return false;
BigDecimal OutputAmountTemp = new BigDecimal(mJoinPoolInput1.getText().toString().trim());
if (OutputAmountTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (OutputAmountTemp.compareTo(mAvailable1MaxAmount.movePointLeft(mCoin1Decimal).setScale(mCoin1Decimal, RoundingMode.CEILING)) > 0)
return false;
getSActivity().mKavaPoolTokenA = new Coin(mCoin0Denom, InputAmountTemp.movePointRight(mCoin0Decimal).toPlainString());
getSActivity().mKavaPoolTokenB = new Coin(mCoin1Denom, OutputAmountTemp.movePointRight(mCoin1Decimal).toPlainString());
return true;
} catch (Exception e) {
return false;
}
}
use of wannabit.io.cosmostaion.model.type.Coin in project cosmostation-android by cosmostation.
the class KavaSwapStep0Fragment method isValidateSwapInputAmount.
private boolean isValidateSwapInputAmount() {
try {
BigDecimal InputAmountTemp = new BigDecimal(mSwapInputAmount.getText().toString().trim());
BigDecimal OutAmountTemp = new BigDecimal(mSwapOutputAmount.getText().toString().trim());
if (InputAmountTemp.compareTo(BigDecimal.ZERO) <= 0)
return false;
if (InputAmountTemp.compareTo(mAvailableMaxAmount.movePointLeft(mInputCoinDecimal).setScale(mInputCoinDecimal, RoundingMode.CEILING)) > 0)
return false;
getSActivity().mKavaSwapIn = new Coin(getSActivity().mInputDenom, InputAmountTemp.movePointRight(mInputCoinDecimal).setScale(0).toPlainString());
getSActivity().mKavaSwapOut = new Coin(getSActivity().mOutputDenom, OutAmountTemp.movePointRight(mOutputCoinDecimal).setScale(0).toPlainString());
return true;
} catch (Exception e) {
getSActivity().mKavaSwapIn = null;
getSActivity().mKavaSwapOut = null;
return false;
}
}
use of wannabit.io.cosmostaion.model.type.Coin in project cosmostation-android by cosmostation.
the class MainTokensFragment method onBindGravityDexToken.
// with Cosmos Gravity Dex gRPC
private void onBindGravityDexToken(TokensAdapter.AssetHolder holder, int position) {
final Coin coin = mGravityDexGrpc.get(position);
Picasso.get().load(COSMOS_COIN_IMG_URL + "gravitydex.png").fit().placeholder(R.drawable.token_ic).error(R.drawable.token_ic).into(holder.itemImg);
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.itemInnerSymbol.setText("");
Liquidity.Pool poolInfo = getBaseDao().getGravityPoolByDenom(coin.denom);
if (poolInfo != null) {
holder.itemSymbol.setText("GDEX-" + poolInfo.getId());
holder.itemSymbol.setTextColor(getResources().getColor(R.color.colorWhite));
holder.itemFullName.setText("pool/" + poolInfo.getId());
}
holder.itemRoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getMainActivity(), POOLTokenDetailActivity.class);
intent.putExtra("denom", coin.denom);
startActivity(intent);
}
});
}
Aggregations