@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); flowProfitView.setTextColor( getResources().getColor(TradeUtil.getTextColorOfFloatProfitLoss(holdOrderInfo.oProfit))); flowProfitView.setText( TradeUtil.format(holdOrderInfo.oProfit, TradeConstants.AMOUNT_SCALE) + ""); holdView.setText( goodsInfo == null ? (holdOrderInfo.hpPrice + "") : TradeUtil.formatExchangePrice(holdOrderInfo.hpPrice, goodsInfo.minPriceUnit)); closeView.setText( goodsInfo == null ? (holdOrderInfo.cPrice + "") : TradeUtil.formatExchangePrice(holdOrderInfo.cPrice, goodsInfo.minPriceUnit)); if (goodsInfo != null) { nameView.setText(goodsInfo.name); } orderIdView.setText(holdOrderInfo.hpid); rangeView.setText("手数范围1-" + holdOrderInfo.qty); numberTextView.setText(holdOrderInfo.qty + ""); if (getActivity() != null && getActivity().getCurrentFocus() == numberEditView) { numberEditView.setSelection(numberEditView.getText().length()); } }
private void setFlowProfit() { if (quote == null || goodsInfo == null) { return; } double flowProfit = 0; if (holdOrderInfo.dir == 1) { // 做多 flowProfit = (quote.sell - holdOrderInfo.hpPrice) * holdOrderInfo.qty * goodsInfo.agreeUnit; } else { // 做空 flowProfit = (holdOrderInfo.hpPrice - quote.buy) * holdOrderInfo.qty * goodsInfo.agreeUnit; } flowProfitView.setTextColor( getResources().getColor(TradeUtil.getTextColorOfFloatProfitLoss(flowProfit))); flowProfitView.setText(TradeUtil.format(flowProfit, TradeConstants.AMOUNT_SCALE) + ""); }