|
|
@@ -13,6 +13,7 @@ import android.view.ViewGroup
|
|
|
import android.widget.TextView
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
+import androidx.lifecycle.Observer
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.BankAccountSignData
|
|
|
@@ -74,7 +75,6 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
|
|
|
// viewModel.resetAccountData()
|
|
|
viewModel.queryContractTradePosition("2")
|
|
|
-
|
|
|
}
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
@@ -106,13 +106,14 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
val goodsInfo =
|
|
|
GlobalDataCollection.instance?.contractTradePositionDataArrayList?.find { it.goodsid?.toInt() == goodid }
|
|
|
if (goodsInfo?.goodsid.isNullOrEmpty().not()) {
|
|
|
- viewModel.getUserAccount()
|
|
|
+
|
|
|
// resolve bug #3429
|
|
|
// 减少频率
|
|
|
-// if(TimeUtils.getNowMills() - requestTime > 300){
|
|
|
+ if(TimeUtils.getNowMills() - requestTime > 1500){
|
|
|
+ viewModel.getUserAccount()
|
|
|
viewModel.resetAccountData()
|
|
|
-// requestTime = TimeUtils.getNowMills()
|
|
|
-// }
|
|
|
+ requestTime = TimeUtils.getNowMills()
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|
|
|
@@ -748,25 +749,39 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
if (isOpenEye.value == true) {
|
|
|
// if (it!!.valueOfposition_keep_watch_profit_and_loss!! != 0.0){
|
|
|
- if(it?.canUserValueOfPosition!!) {
|
|
|
- text = NumberUtils.roundNum(
|
|
|
- NumberUtils.doubleDistortion(it?.valueOfposition_keep_watch_profit_and_loss?.toString()),
|
|
|
- 2
|
|
|
- )
|
|
|
+// if(it?.canUserValueOfPosition!!) {
|
|
|
+// text = NumberUtils.roundNum(
|
|
|
+// NumberUtils.doubleDistortion(it?.valueOfposition_keep_watch_profit_and_loss?.toString()),
|
|
|
+// 2
|
|
|
+// )
|
|
|
+// }
|
|
|
+
|
|
|
+ var lastprice: Double? = 0.0
|
|
|
+
|
|
|
+ it!!.postValueOfPosition.bindOptional(context){ its ->
|
|
|
+ if(its != lastprice){
|
|
|
+ lastprice = its
|
|
|
+ text = NumberUtils.roundNum(
|
|
|
+ NumberUtils.doubleDistortion(its?.toString()),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+
|
|
|
+ textColorInt = when {
|
|
|
+ its ?: 0.0 > 0.0 -> {
|
|
|
+ R.color.rma_red_color
|
|
|
+ }
|
|
|
+ its ?: 0.0 < 0.0 -> {
|
|
|
+ R.color.rma_green_color
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ R.color.rma_black_33
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// }
|
|
|
|
|
|
- textColorInt = when {
|
|
|
- it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 > 0.0 -> {
|
|
|
- R.color.rma_red_color
|
|
|
- }
|
|
|
- it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 < 0.0 -> {
|
|
|
- R.color.rma_green_color
|
|
|
- }
|
|
|
- else -> {
|
|
|
- R.color.rma_black_33
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
} else {
|
|
|
text = "****"
|
|
|
}
|