@Override public void bindData( CustomerBrokerNegotiationInformation negotiationInformation, ClauseInformation clause, int clausePosition) { super.bindData(negotiationInformation, clause, clausePosition); final Map<ClauseType, ClauseInformation> clauses = negotiationInformation.getClauses(); final ClauseInformation currencyToBuy = clauses.get(ClauseType.CUSTOMER_CURRENCY); final ClauseInformation currencyToPay = clauses.get(ClauseType.BROKER_CURRENCY); double marketRate = 212.48; // TODO cambiar por valor que devuelve el proveedor asociado a la wallet para este // par de monedas String formattedMarketRate = NumberFormat.getInstance().format(marketRate); markerRateReference.setText( String.format( "1 %1$s / %2$s %3$s", currencyToBuy.getValue(), formattedMarketRate, currencyToPay.getValue())); yourExchangeRateValueLeftSide.setText(String.format("1 %1$s /", currencyToBuy.getValue())); yourExchangeRateValue.setText(clause.getValue()); yourExchangeRateValueRightSide.setText(String.format("%1$s", currencyToPay.getValue())); }
@Override public void bindData( CustomerBrokerNegotiationInformation data, ClauseInformation clause, int position) { super.bindData(data, clause, position); final Map<ClauseType, ClauseInformation> clauses = data.getClauses(); ClauseType currencyType = ClauseType.CUSTOMER_CURRENCY; int buyingTextValue = R.string.buying_text; if (!paymentBuy) { currencyType = ClauseType.BROKER_CURRENCY; buyingTextValue = R.string.paying_text; } final ClauseInformation currencyToBuy = clauses.get(currencyType); currencyToBuyTextValue.setText(currencyToBuy.getValue()); buyingText.setText(buyingTextValue); if (clause.getValue().equals("0.0") || clause.getValue().equals("0") || clause.getValue().equals("0,0")) { buyingValue.setText(defaultValue()); } else { buyingValue.setText(fixFormat(clause.getValue())); } }
private List<ClauseInformation> buildListOfItems() { final int TOTAL_STEPS = 5; Map<ClauseType, ClauseInformation> clauses = negotiationInformation.getClauses(); final ClauseInformation[] data = new ClauseInformation[TOTAL_STEPS]; data[0] = clauses.get(ClauseType.CUSTOMER_CURRENCY_QUANTITY); data[1] = clauses.get(ClauseType.EXCHANGE_RATE); data[2] = clauses.get(ClauseType.BROKER_CURRENCY); data[3] = clauses.get(ClauseType.CUSTOMER_PAYMENT_METHOD); data[4] = clauses.get(ClauseType.BROKER_PAYMENT_METHOD); return Arrays.asList(data); }