|
@@ -63,6 +63,9 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
|
|
|
lateinit var idFutureTab : QMUITabSegment
|
|
lateinit var idFutureTab : QMUITabSegment
|
|
|
lateinit var idMarketPager : ViewPager
|
|
lateinit var idMarketPager : ViewPager
|
|
|
|
|
|
|
|
|
|
+ var chatTypes: Int = 1 // 当前类型 1:分时图 2:k线
|
|
|
|
|
+ var saveTab :String = "";
|
|
|
|
|
+
|
|
|
val goodsId by lazy { intent.getStringExtra("goodsId") }
|
|
val goodsId by lazy { intent.getStringExtra("goodsId") }
|
|
|
|
|
|
|
|
val goodsCode by lazy { intent.getStringExtra("goodsCode") }
|
|
val goodsCode by lazy { intent.getStringExtra("goodsCode") }
|
|
@@ -347,15 +350,18 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
|
|
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
|
|
when(tab?.tag){
|
|
when(tab?.tag){
|
|
|
10086 -> {
|
|
10086 -> {
|
|
|
|
|
+ chatTypes = 1
|
|
|
kChartView.visibility = View.INVISIBLE
|
|
kChartView.visibility = View.INVISIBLE
|
|
|
timeChartView.visibility = View.VISIBLE
|
|
timeChartView.visibility = View.VISIBLE
|
|
|
viewModel.queryTimeChart()
|
|
viewModel.queryTimeChart()
|
|
|
progressBar.visibility = View.VISIBLE
|
|
progressBar.visibility = View.VISIBLE
|
|
|
}
|
|
}
|
|
|
1,2,3,11,12,13,14,4,240 -> {
|
|
1,2,3,11,12,13,14,4,240 -> {
|
|
|
|
|
+ chatTypes = 2
|
|
|
kChartView.visibility = View.VISIBLE
|
|
kChartView.visibility = View.VISIBLE
|
|
|
timeChartView.visibility = View.INVISIBLE
|
|
timeChartView.visibility = View.INVISIBLE
|
|
|
viewModel.queryKChart( tab.tag.toString())
|
|
viewModel.queryKChart( tab.tag.toString())
|
|
|
|
|
+ saveTab = tab.tag.toString();
|
|
|
progressBar.visibility = View.VISIBLE
|
|
progressBar.visibility = View.VISIBLE
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -370,8 +376,18 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
|
|
|
requestTime = TimeUtils.getNowMills()
|
|
requestTime = TimeUtils.getNowMills()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ kChartView.setKChartListener {
|
|
|
|
|
+ if(TimeUtils.getNowMills() - requestTime > 3500) {
|
|
|
|
|
+ if(saveTab != "") {
|
|
|
|
|
+ viewModel.queryKChart(saveTab)
|
|
|
|
|
+ requestKTime = TimeUtils.getNowMills()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
var requestTime = TimeUtils.getNowMills()
|
|
var requestTime = TimeUtils.getNowMills()
|
|
|
|
|
+ var requestKTime = TimeUtils.getNowMills()
|
|
|
|
|
|
|
|
override fun onClick(v: View?) {
|
|
override fun onClick(v: View?) {
|
|
|
when(v?.id){
|
|
when(v?.id){
|
|
@@ -398,10 +414,17 @@ class YrdzChartActivity : BaseActivity<YrdzChartViewModel>() , View.OnClickListe
|
|
|
if (quote != null){
|
|
if (quote != null){
|
|
|
viewModel.quoteDayData.postValue(quote)
|
|
viewModel.quoteDayData.postValue(quote)
|
|
|
}
|
|
}
|
|
|
- // 这里把当前最新价转化为历史
|
|
|
|
|
- timeChartView.refreshDate(ChartDataAdapter().getHisTikData(viewModel.outGoodsCode))
|
|
|
|
|
- // 这里更新最新价
|
|
|
|
|
- viewModel.refreshTimePrice(timeChartView)
|
|
|
|
|
|
|
+ if (chatTypes == 1){
|
|
|
|
|
+ // 这里把当前最新价转化为历史
|
|
|
|
|
+ timeChartView.refreshDate(ChartDataAdapter().getHisTikData(viewModel.outGoodsCode))
|
|
|
|
|
+ // 这里更新最新价
|
|
|
|
|
+ viewModel.refreshTimePrice(timeChartView)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ kChartView.refreshDate(ChartDataAdapter().getHisTikData(viewModel.outGoodsCode))
|
|
|
|
|
+ viewModel.refreshKPrice(kChartView)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|