|
|
@@ -18,6 +18,7 @@ import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.autoSize
|
|
|
import cn.muchinfo.rma.view.autoWidget.textColorInt
|
|
|
import cn.muchinfo.rma.view.autoWidget.textSizeAuto
|
|
|
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.base.BaseFragment
|
|
|
import cn.muchinfo.rma.view.base.future.deals.DealData
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
@@ -40,13 +41,14 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
private var accountData : AccountData? = null
|
|
|
var currencyName : TextView? = null
|
|
|
|
|
|
- val userAccountData : MutableLiveData<AccountShowData> = MutableLiveData()
|
|
|
+ val userAccountData : MutableLiveData<AccountData> = MutableLiveData()
|
|
|
|
|
|
fun initData(){
|
|
|
accountData = GlobalDataCollection.instance?.accountData
|
|
|
+ accountData?.setNormalData()
|
|
|
val showAccountData = AccountShowData()
|
|
|
// showAccountData.setNormalData()
|
|
|
- userAccountData.postValue(showAccountData)
|
|
|
+ userAccountData.postValue(accountData)
|
|
|
if (currencyName != null){
|
|
|
//暂时写死人民币
|
|
|
// currencyName?.text = accountData?.currencyid.toString()
|
|
|
@@ -102,7 +104,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.currentbalance?.plus(it?.keep_watch_profit_and_loss?.toDouble() ?: 0.0).toString()
|
|
|
+ text = NumberUtils.roundNum(it?.rightsAndInterests?.toString(),2)
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -126,7 +128,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.currentbalance?.minus(accountData?.usedmargin ?: 0.0)?.minus(accountData?.freezecharge ?: 0.0)?.minus(accountData?.freezemargin ?: 0.0)?.minus(accountData?.otherfreezemargin ?: 0.0)?.toString()
|
|
|
+ text = NumberUtils.roundNum(it?.canUserAmount?.toString(),2)
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -151,7 +153,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
textView {
|
|
|
/** 直接去占用保证金 **/
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.usedmargin.toString()
|
|
|
+ text = NumberUtils.roundNum(it?.usedmargin.toString(),2)
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -176,7 +178,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.freezemargin?.plus(accountData?.freezecharge ?: 0.0).toString()
|
|
|
+ text = it?.freezemargin?.plus(it.freezecharge ?: 0.0)?.plus(it.outamountfreeze ?:0.0).toString()
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -201,7 +203,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = it?.close_watch_profit_and_loss
|
|
|
+ text = it?.close_watch_profit_and_loss?.toString()
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -225,7 +227,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = it?.keep_watch_profit_and_loss
|
|
|
+ text = it?.keep_watch_profit_and_loss?.toString()
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -249,7 +251,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.inamount.toString()
|
|
|
+ text = it?.inamount.toString()
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -273,7 +275,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
userAccountData.bindOptional(context){
|
|
|
- text = accountData?.outamount.toString()
|
|
|
+ text = it?.outamount.toString()
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -284,6 +286,7 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
+ visibility = View.GONE
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
text = "资金使用率"
|