|
|
@@ -28,6 +28,7 @@ import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
|
|
|
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
import com.desfate.chart.util.LogUtils
|
|
|
import com.desfate.chart.util.MathUtil
|
|
|
@@ -35,6 +36,8 @@ import kotlinx.android.synthetic.main.list_head.view.*
|
|
|
import mtp.polymer.com.autowidget.dialog.creatAccountDataSheetDialog
|
|
|
import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
|
import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
|
+import org.greenrobot.eventbus.Subscribe
|
|
|
+import org.greenrobot.eventbus.ThreadMode
|
|
|
import org.jetbrains.anko.*
|
|
|
|
|
|
/**
|
|
|
@@ -117,6 +120,22 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
viewModel.resetAccountData()
|
|
|
}
|
|
|
|
|
|
+ //行情推送通知
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
|
|
|
+ /** 行情推送过来的goodsid **/
|
|
|
+ quoteMessageEvent.goodsid.forEach { goodid ->
|
|
|
+ //找到相应商品信息
|
|
|
+ val goodsInfo =
|
|
|
+ GlobalDataCollection.instance?.contractTradePositionDataArrayList?.find { it.goodsid?.toInt() == goodid }
|
|
|
+ if (goodsInfo?.goodsid.isNullOrEmpty().not()) {
|
|
|
+ // resolve bug #3429
|
|
|
+ viewModel.resetAccountData()
|
|
|
+// viewModel.getTaAccounts()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
@@ -586,7 +605,35 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
+ if (it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 > 0) {
|
|
|
+ val parmasvalue =
|
|
|
+ GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "113"
|
|
|
+ )
|
|
|
+ if (parmasvalue == "1") {
|
|
|
+ text = "可用资金"+NumberUtils.roundNum(
|
|
|
+ NumberUtils.doubleDistortion(
|
|
|
+ it?.canUserAmount?.plus(
|
|
|
+ it.valueOfposition_keep_watch_profit_and_loss
|
|
|
+ )?.toString()
|
|
|
+ ), 2
|
|
|
+ )
|
|
|
+ } else if (parmasvalue == "0") {
|
|
|
+ text = "可用资金"+ NumberUtils.roundNum(
|
|
|
+ NumberUtils.doubleDistortion(it?.canUserAmount?.toString()),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ text = "可用资金"+ NumberUtils.roundNum(
|
|
|
+ NumberUtils.doubleDistortion(
|
|
|
+ it?.canUserAmount?.plus(
|
|
|
+ it.valueOfposition_keep_watch_profit_and_loss
|
|
|
+ )?.toString()
|
|
|
+ ), 2
|
|
|
+ )
|
|
|
+ }
|
|
|
+// text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|