|
|
@@ -48,10 +48,10 @@ class ExposureFragment : BaseFragment<ExposureViewModel>() {
|
|
|
/** 实时敞口 **/
|
|
|
private val realTimeExposureUI by lazy { RealTimeExposureUI(this, viewModel) }
|
|
|
|
|
|
- /** 现货数量 **/
|
|
|
+ /** 现货头寸 **/
|
|
|
private val numberSpotUI by lazy { NumberSpotUI(this, viewModel) }
|
|
|
|
|
|
- /** 期货数量 **/
|
|
|
+ /** 期货头寸 **/
|
|
|
private val numberFutureUI by lazy { NumberFutureUI(this, viewModel) }
|
|
|
|
|
|
/** 历史敞口 **/
|
|
|
@@ -139,6 +139,7 @@ class ExposureFragment : BaseFragment<ExposureViewModel>() {
|
|
|
override fun onTabUnselected(index: Int) {}
|
|
|
override fun onTabSelected(index: Int) {
|
|
|
selectedTabIndex = index
|
|
|
+ reFreshByIndex(index = index)
|
|
|
}
|
|
|
})
|
|
|
setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
|
|
|
@@ -163,6 +164,27 @@ class ExposureFragment : BaseFragment<ExposureViewModel>() {
|
|
|
|
|
|
}.view
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面tab切换时进行相应页面数据请求
|
|
|
+ * @param index Int
|
|
|
+ */
|
|
|
+ fun reFreshByIndex(index : Int){
|
|
|
+ when (index) {
|
|
|
+ 0 -> {
|
|
|
+ realTimeExposureUI.reFresh()
|
|
|
+ }
|
|
|
+ 1 -> {
|
|
|
+ numberSpotUI.reFresh()
|
|
|
+ }
|
|
|
+ 2 -> {
|
|
|
+ numberFutureUI.reFresh()
|
|
|
+ }
|
|
|
+ 3 -> {
|
|
|
+ historyExposureUI.reFresh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -330,6 +352,13 @@ class NumberSpotUI(
|
|
|
viewModule.queryExposureSpot()
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用于外部调用主动刷新
|
|
|
+ */
|
|
|
+ fun reFresh(){
|
|
|
+ viewModule.queryExposureSpot()
|
|
|
+ }
|
|
|
+
|
|
|
val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
verticalLayout {
|
|
|
linearLayout {
|
|
|
@@ -412,6 +441,7 @@ class NumberSpotUI(
|
|
|
if (swipeToLayout.getIsRefreshing()){
|
|
|
swipeToLayout.finishRefresh()
|
|
|
}
|
|
|
+ statusLayout.showSuccess()
|
|
|
numberSpotAdapter.setNewData(it)
|
|
|
}
|
|
|
}
|
|
|
@@ -441,6 +471,13 @@ class NumberFutureUI(
|
|
|
viewModule.queryExposureHedgePosition()
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用于外部调用主动刷新
|
|
|
+ */
|
|
|
+ fun reFresh(){
|
|
|
+ viewModule.queryExposureHedgePosition()
|
|
|
+ }
|
|
|
+
|
|
|
val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
verticalLayout {
|
|
|
linearLayout {
|
|
|
@@ -522,6 +559,7 @@ class NumberFutureUI(
|
|
|
if (swipeToLayout.getIsRefreshing()){
|
|
|
swipeToLayout.finishRefresh()
|
|
|
}
|
|
|
+ statusLayout.showSuccess()
|
|
|
numberFutureAdapter.setNewData(it)
|
|
|
}
|
|
|
}
|
|
|
@@ -546,10 +584,20 @@ class HistoryExposureUI(
|
|
|
|
|
|
private val numberFutureAdapter: BaseAdapter<ExposureHistoryData, HistoryExposureViewholder> = BaseAdapter { _, _ -> HistoryExposureViewholder(baseFragment, viewModule) }
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化请求
|
|
|
+ */
|
|
|
init {
|
|
|
viewModule.queryHisExposure()
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用于外部调用主动刷新
|
|
|
+ */
|
|
|
+ fun reFresh(){
|
|
|
+ viewModule.queryHisExposure()
|
|
|
+ }
|
|
|
+
|
|
|
val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
verticalLayout {
|
|
|
statusLayout(contentBlock = {
|
|
|
@@ -580,6 +628,7 @@ class HistoryExposureUI(
|
|
|
if (swipeToLayout.getIsRefreshing()){
|
|
|
swipeToLayout.finishRefresh()
|
|
|
}
|
|
|
+ statusLayout.showSuccess()
|
|
|
numberFutureAdapter.setNewData(it)
|
|
|
}
|
|
|
}
|