コード例 #1
0
 private void initViews() {
   if (assetPair.getInverted()) {
     accurancy = assetPair.getInvertedAccuracy();
     mainName = assetPair.getQuotingAssetId();
     subName = assetPair.getBaseAssetId();
   } else {
     accurancy = assetPair.getAccuracy();
     mainName = assetPair.getBaseAssetId();
     subName = assetPair.getQuotingAssetId();
   }
   actionBar.setTitle(mainName + "/" + subName);
   btnBuy.setText(
       String.format(getString(R.string.buy_rate), mainName, subName)
           + " "
           + LykkeUtils.getStriped(accurancy, price));
   btnSell.setText(
       String.format(getString(R.string.sell_at_price), mainName, subName)
           + " "
           + LykkeUtils.getStriped(accurancy, bid));
 }
コード例 #2
0
  @AfterViews
  public void afterViews() {
    assetPair = (AssetPair) getArguments().getSerializable(Constants.EXTRA_ASSET_PAIR);
    price = BigDecimal.valueOf(getArguments().getDouble(Constants.EXTRA_RATE_PRICE));

    if (assetPair != null) {
      if (assetPair.getInverted()) {
        accurancy = assetPair.getInvertedAccuracy();
        if (price.compareTo(BigDecimal.ZERO) != 0) {
          price = BigDecimal.ONE.divide(price, accurancy, RoundingMode.HALF_EVEN);
        }
        mainName = assetPair.getQuotingAssetId();
        subName = assetPair.getBaseAssetId();
      } else {
        accurancy = assetPair.getAccuracy();
        mainName = assetPair.getBaseAssetId();
        subName = assetPair.getQuotingAssetId();
      }
    }
    actionBar.setTitle(mainName + "/" + subName);
    if (getArguments().getSerializable(Constants.EXTRA_DESCRIPTION) != null) {
      if (getArguments().getSerializable(Constants.EXTRA_RATE_PRICE) != null) {
        price = (BigDecimal) getArguments().getSerializable(Constants.EXTRA_RATE_PRICE);
        btnBuy.setText(
            String.format(getString(R.string.buy_rate), mainName, subName)
                + " "
                + LykkeUtils.getStriped(accurancy, price));
        btnSell.setText(
            String.format(getString(R.string.sell_at_price), mainName, subName)
                + " "
                + LykkeUtils.getStriped(accurancy, price));
      }
      onSuccess(getArguments().getSerializable(Constants.EXTRA_DESCRIPTION));
    } else {
      setUpVisibility(View.VISIBLE, View.GONE);
      btnBuy.setVisibility(View.GONE);
      btnSell.setVisibility(View.GONE);
      getInfoFromServer();
    }
  }