|
|
@@ -1,9 +1,8 @@
|
|
|
package cn.muchinfo.rma.view.base.hnstmain
|
|
|
|
|
|
-import android.Manifest
|
|
|
+
|
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Intent
|
|
|
-import android.content.pm.PackageManager
|
|
|
import android.os.Bundle
|
|
|
import android.os.CountDownTimer
|
|
|
import android.text.TextUtils
|
|
|
@@ -13,18 +12,13 @@ import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import android.widget.TextView
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
-import androidx.core.app.ActivityCompat
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.BankAccountSignData
|
|
|
-import cn.muchinfo.rma.global.data.BrokerApplyData
|
|
|
-import cn.muchinfo.rma.global.data.ContractTradePositionData
|
|
|
-import cn.muchinfo.rma.global.data.OrderQuoteData
|
|
|
import cn.muchinfo.rma.global.toPercentage
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
-import cn.muchinfo.rma.view.autoWidget.utils.CopyButtonLibrary
|
|
|
import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.base.BaseFragment
|
|
|
import cn.muchinfo.rma.view.base.app.Constant
|
|
|
@@ -32,7 +26,6 @@ import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.account.RydzAccountActivity
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.bookingwarehouse.BookingWarehouseActivity
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.contractorders.ContractOrdersActivity
|
|
|
-import cn.muchinfo.rma.view.base.hnstmain.contractorders.delivery.DeliveryActivity
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.finance.FinanceManagementActivity
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.friend.MainFriendActivity
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.performance.PerformanceInformationActivity
|
|
|
@@ -42,18 +35,10 @@ import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
import cn.muchinfo.rma.view.base.home.set.ChangePasswordActivity
|
|
|
import cn.muchinfo.rma.view.base.main.about.AboutActivity
|
|
|
import cn.muchinfo.rma.view.base.main.addressmanagement.MyAddressManagementActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.castsurely.MyCastSurelyActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.integral.MyIntegralActivity
|
|
|
import cn.muchinfo.rma.view.base.main.invoice.InvoiceInformationActivity
|
|
|
import cn.muchinfo.rma.view.base.main.phonebinding.PhoneBindingActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.pickup.PickUpGoodsSearchActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.promotioncode.ApplyPromotionCodeActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.reward.MyRewardActivity
|
|
|
-import cn.muchinfo.rma.view.base.main.team.MyTeamActivity
|
|
|
import cn.muchinfo.rma.view.base.main.withdrawmanagement.WithDrawManagementActivity
|
|
|
import cn.muchinfo.rma.view.base.main.withdrawmanagement.WithdrawalActivity
|
|
|
-import cn.muchinfo.rma.view.base.platinumtreasure.trade.PlatinumTradeActivity
|
|
|
-import cn.muchinfo.rma.view.base.warehousereceipt.BusinessHallActivity
|
|
|
import cn.muchinfo.rma.view.eventbus.EventConstent
|
|
|
import cn.muchinfo.rma.view.eventbus.MessageEvent
|
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
@@ -70,6 +55,7 @@ import org.jetbrains.anko.support.v4.UI
|
|
|
/**
|
|
|
* 华南顺通 - 我的页面fragment
|
|
|
*/
|
|
|
+@Suppress("DEPRECATION")
|
|
|
class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
|
|
|
lateinit var phone_num: TextView
|
|
|
@@ -116,7 +102,7 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @SuppressLint("MissingPermission")
|
|
|
+ @SuppressLint("MissingPermission", "RtlHardcoded", "SetTextI18n")
|
|
|
override fun onCreateView(
|
|
|
inflater: LayoutInflater,
|
|
|
container: ViewGroup?,
|
|
|
@@ -203,27 +189,35 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
textView {
|
|
|
//////交易状态 - 1:正常 2:受限 3:冻结 4:禁止建仓(人工受限) 5:禁止交易(人工冻结) 6:待激活 7:已注销
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- if (it?.tradestatus?.toInt() == 1) {
|
|
|
- text = "正常"
|
|
|
- textColorInt = R.color.rma_green_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 2) {
|
|
|
- text = "受限"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 3) {
|
|
|
- text = "冻结"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 4) {
|
|
|
- text = "禁止建仓"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 5) {
|
|
|
- text = "禁止交易"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 6) {
|
|
|
- text = "待激活"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
- } else if (it?.tradestatus?.toInt() == 7) {
|
|
|
- text = "已注销"
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
+ when {
|
|
|
+ it?.tradestatus?.toInt() == 1 -> {
|
|
|
+ text = "正常"
|
|
|
+ textColorInt = R.color.rma_green_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 2 -> {
|
|
|
+ text = "受限"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 3 -> {
|
|
|
+ text = "冻结"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 4 -> {
|
|
|
+ text = "禁止建仓"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 5 -> {
|
|
|
+ text = "禁止交易"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 6 -> {
|
|
|
+ text = "待激活"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
+ it?.tradestatus?.toInt() == 7 -> {
|
|
|
+ text = "已注销"
|
|
|
+ textColorInt = R.color.rma_red_color
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
textSizeAuto = 27
|
|
|
@@ -239,10 +233,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
viewModel.resetAccountData()
|
|
|
}
|
|
|
isOpenEye.bindOptional(context) {
|
|
|
- if (it == true) {
|
|
|
- imageResource = R.mipmap.yrdz_open_eye
|
|
|
+ imageResource = if (it == true) {
|
|
|
+ R.mipmap.yrdz_open_eye
|
|
|
} else {
|
|
|
- imageResource = R.mipmap.yrdz_close_eye
|
|
|
+ R.mipmap.yrdz_close_eye
|
|
|
}
|
|
|
}
|
|
|
imageResource = R.mipmap.yrdz_close_eye
|
|
|
@@ -282,10 +276,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
}.lparams(matchParent, autoSize(360))
|
|
|
|
|
|
linearLayout {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
- visibility = View.GONE
|
|
|
+ visibility = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
+ View.GONE
|
|
|
} else {
|
|
|
- visibility = View.VISIBLE
|
|
|
+ View.VISIBLE
|
|
|
}
|
|
|
verticalLayout {
|
|
|
onThrottleFirstClick {
|
|
|
@@ -308,13 +302,13 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
* 金额=总市值-融资额+余额;
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- if (isOpenEye.value == true) {
|
|
|
- text = NumberUtils.roundNum(
|
|
|
+ text = if (isOpenEye.value == true) {
|
|
|
+ NumberUtils.roundNum(
|
|
|
it?.currentbalance?.toString(),
|
|
|
2
|
|
|
)
|
|
|
} else {
|
|
|
- text = "****"
|
|
|
+ "****"
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -387,10 +381,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
verticalLayout {
|
|
|
gravity = Gravity.LEFT
|
|
|
textView {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
- text = "净值"
|
|
|
+ text = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
+ "净值"
|
|
|
} else {
|
|
|
- text = "总市值"
|
|
|
+ "总市值"
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorStr = "#A1B1C5"
|
|
|
@@ -456,19 +450,19 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
|
|
|
//狗屎一样的设计,,,,,fuck
|
|
|
linearLayout {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
- visibility = View.VISIBLE
|
|
|
+ visibility = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
+ View.VISIBLE
|
|
|
} else {
|
|
|
- visibility = View.GONE
|
|
|
+ View.GONE
|
|
|
}
|
|
|
|
|
|
verticalLayout {
|
|
|
gravity = Gravity.LEFT
|
|
|
textView {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
- text = "净值"
|
|
|
+ text = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
+ "净值"
|
|
|
} else {
|
|
|
- text = "总市值"
|
|
|
+ "总市值"
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorStr = "#A1B1C5"
|
|
|
@@ -554,13 +548,13 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
* 金额=总市值-融资额+余额;
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- if (isOpenEye.value == true) {
|
|
|
- text = NumberUtils.roundNum(
|
|
|
+ text = if (isOpenEye.value == true) {
|
|
|
+ NumberUtils.roundNum(
|
|
|
it?.currentbalance?.toString(),
|
|
|
2
|
|
|
)
|
|
|
} else {
|
|
|
- text = "****"
|
|
|
+ "****"
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -634,10 +628,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
}.lparams(matchParent, autoSize(200))
|
|
|
|
|
|
linearLayout {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
- visibility = View.VISIBLE
|
|
|
+ visibility = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd") {
|
|
|
+ View.VISIBLE
|
|
|
} else {
|
|
|
- visibility = View.GONE
|
|
|
+ View.GONE
|
|
|
}
|
|
|
verticalLayout {
|
|
|
onThrottleFirstClick {
|
|
|
@@ -660,14 +654,14 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
* 占用-usedmargin
|
|
|
*/
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- if (isOpenEye.value == true) {
|
|
|
- text = NumberUtils.roundNum(
|
|
|
+ text = if (isOpenEye.value == true) {
|
|
|
+ NumberUtils.roundNum(
|
|
|
NumberUtils.doubleDistortion(
|
|
|
it?.usedmargin.toString()
|
|
|
), 2
|
|
|
)
|
|
|
} else {
|
|
|
- text = "****"
|
|
|
+ "****"
|
|
|
}
|
|
|
}
|
|
|
textSizeAuto = 34
|
|
|
@@ -698,15 +692,15 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
NumberUtils.doubleDistortion(it?.valueOfposition_keep_watch_profit_and_loss?.toString()),
|
|
|
2
|
|
|
)
|
|
|
- when {
|
|
|
+ textColorInt = when {
|
|
|
it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 > 0.0 -> {
|
|
|
- textColorInt = R.color.rma_red_color
|
|
|
+ R.color.rma_red_color
|
|
|
}
|
|
|
- it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 > 0.0 -> {
|
|
|
- textColorInt = R.color.rma_green_color
|
|
|
+ it?.valueOfposition_keep_watch_profit_and_loss ?: 0.0 < 0.0 -> {
|
|
|
+ R.color.rma_green_color
|
|
|
}
|
|
|
else -> {
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
+ R.color.rma_black_33
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -741,36 +735,25 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
"087"
|
|
|
)
|
|
|
- var worth = 0.0
|
|
|
- if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
- worth = it?.currentbalance?.plus(
|
|
|
- it.valueOfposition
|
|
|
- )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
- ?.minus(it.otherfreezemargin)
|
|
|
- ?.minus(it.outamountfreeze) ?: 0.0
|
|
|
+ val worth: Double
|
|
|
+ worth = if (parmasvalue == "1") {//1.风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
+ it?.currentbalance?.plus(
|
|
|
+ it.valueOfposition
|
|
|
+ )?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
+ ?.minus(it.otherfreezemargin)
|
|
|
+ ?.minus(it.outamountfreeze) ?: 0.0
|
|
|
|
|
|
|
|
|
} else {//0.净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
|
|
|
- worth = it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
- ?.minus(it.otherfreezemargin ?: 0.0)
|
|
|
- ?.minus(it.outamountfreeze ?: 0.0) ?: 1.0
|
|
|
+ it?.currentbalance?.plus(it.valueOfposition_keep_watch_profit_and_loss)
|
|
|
+ ?.minus(it.otherfreezemargin)
|
|
|
+ ?.minus(it.outamountfreeze) ?: 1.0
|
|
|
}
|
|
|
|
|
|
var risk = 0.0
|
|
|
if (it?.valueOfposition != 0.0) {
|
|
|
risk = it?.usedmargin?.div(worth) ?: 0.0
|
|
|
}
|
|
|
-// if (parmasvalue == "0"){
|
|
|
-//
|
|
|
-//
|
|
|
-// }else if (parmasvalue == "1"){
|
|
|
-// if (it?.usedmargin != 0.0){
|
|
|
-// risk = (it?.currentbalance?.plus(
|
|
|
-// it.valueOfposition_keep_watch_profit_and_loss
|
|
|
-// )?.minus(it.otherfreezemargin)?.minus(it.outamountfreeze))?.div(it.usedmargin) ?: 0.0
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
text = NumberUtils.roundNum(
|
|
|
NumberUtils.doubleDistortion(risk.toString()), 4
|
|
|
).toPercentage()
|
|
|
@@ -1279,10 +1262,10 @@ class HnstMainFragment : BaseFragment<HnstMainViewmodel>() {
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
- if (SPUtils.getInstance().getString(Constant.oem) == "tjmd"){
|
|
|
- visibility = View.VISIBLE
|
|
|
+ visibility = if (SPUtils.getInstance().getString(Constant.oem) == "tjmd"){
|
|
|
+ View.VISIBLE
|
|
|
}else{
|
|
|
- visibility = View.GONE
|
|
|
+ View.GONE
|
|
|
}
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|