|
@@ -1,8 +1,8 @@
|
|
|
package cn.muchinfo.rma.view.base.home.tjmd
|
|
package cn.muchinfo.rma.view.base.home.tjmd
|
|
|
|
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
|
import android.graphics.Rect
|
|
import android.graphics.Rect
|
|
|
-import android.graphics.Typeface
|
|
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
|
import android.text.TextUtils
|
|
import android.text.TextUtils
|
|
@@ -13,12 +13,7 @@ import android.view.ViewGroup
|
|
|
import android.widget.FrameLayout
|
|
import android.widget.FrameLayout
|
|
|
import android.widget.TextView
|
|
import android.widget.TextView
|
|
|
import android.widget.ViewFlipper
|
|
import android.widget.ViewFlipper
|
|
|
-import androidx.annotation.NonNull
|
|
|
|
|
-import androidx.annotation.Nullable
|
|
|
|
|
import androidx.cardview.widget.CardView
|
|
import androidx.cardview.widget.CardView
|
|
|
-import androidx.fragment.app.Fragment
|
|
|
|
|
-import androidx.fragment.app.FragmentPagerAdapter
|
|
|
|
|
-import androidx.recyclerview.widget.GridLayoutManager
|
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
|
@@ -28,10 +23,7 @@ import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.BannerData
|
|
import cn.muchinfo.rma.global.data.BannerData
|
|
|
import cn.muchinfo.rma.global.data.NoticeData
|
|
import cn.muchinfo.rma.global.data.NoticeData
|
|
|
-import cn.muchinfo.rma.global.data.WrGoodsPerformanceStepData
|
|
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
-import cn.muchinfo.rma.global.toShowTime
|
|
|
|
|
-import cn.muchinfo.rma.global.toShowTime3
|
|
|
|
|
import cn.muchinfo.rma.global.utils.TimeUtils
|
|
import cn.muchinfo.rma.global.utils.TimeUtils
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.lifecycle.getAppCompatActivity
|
|
import cn.muchinfo.rma.lifecycle.getAppCompatActivity
|
|
@@ -40,24 +32,15 @@ import cn.muchinfo.rma.view.base.BaseFragment
|
|
|
import cn.muchinfo.rma.view.base.WebActivity
|
|
import cn.muchinfo.rma.view.base.WebActivity
|
|
|
import cn.muchinfo.rma.view.base.app.Constant
|
|
import cn.muchinfo.rma.view.base.app.Constant
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
-import cn.muchinfo.rma.view.base.hnstmain.bookingwarehouse.BookingWarehouseActivity
|
|
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.performance.PerformanceInformationActivity
|
|
import cn.muchinfo.rma.view.base.hnstmain.performance.PerformanceInformationActivity
|
|
|
-import cn.muchinfo.rma.view.base.hnstmain.performancetemplate.PerformanceItemViewHolder
|
|
|
|
|
-import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
|
|
-import cn.muchinfo.rma.view.base.home.reference.ReferenceActivity
|
|
|
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrdzHomeFragment
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrdzHomeFragment
|
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrdzNoticeActivity
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrdzNoticeActivity
|
|
|
-import cn.muchinfo.rma.view.base.home.yrdz.market.IndexData
|
|
|
|
|
-import cn.muchinfo.rma.view.base.home.yrdz.market.IndexViewHolder
|
|
|
|
|
-import cn.muchinfo.rma.view.base.home.yrdz.market.YrdzMarketFragment
|
|
|
|
|
import cn.muchinfo.rma.view.eventbus.MainTabSelectMessageEvent
|
|
import cn.muchinfo.rma.view.eventbus.MainTabSelectMessageEvent
|
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
import com.blankj.utilcode.util.*
|
|
import com.blankj.utilcode.util.*
|
|
|
import com.facebook.drawee.view.SimpleDraweeView
|
|
import com.facebook.drawee.view.SimpleDraweeView
|
|
|
import com.github.aachartmodel.aainfographics.aachartcreator.*
|
|
import com.github.aachartmodel.aainfographics.aachartcreator.*
|
|
|
import com.github.aachartmodel.aainfographics.aaoptionsmodel.AAScrollablePlotArea
|
|
import com.github.aachartmodel.aainfographics.aaoptionsmodel.AAScrollablePlotArea
|
|
|
-import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
|
|
-import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
import kotlinx.coroutines.GlobalScope
|
|
@@ -69,11 +52,11 @@ import org.greenrobot.eventbus.Subscribe
|
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
|
import org.jetbrains.anko.*
|
|
import org.jetbrains.anko.*
|
|
|
import org.jetbrains.anko.support.v4.UI
|
|
import org.jetbrains.anko.support.v4.UI
|
|
|
-import org.jetbrains.anko.support.v4.viewPager
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 天津麦顿首页
|
|
* 天津麦顿首页
|
|
|
*/
|
|
*/
|
|
|
|
|
+@Suppress("DEPRECATION")
|
|
|
class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
|
|
|
|
|
|
|
|
|
@@ -141,13 +124,14 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
val goodsInfo = viewModel.dataList.value?.find { it.goodsInfo?.goodsid == goodid }
|
|
val goodsInfo = viewModel.dataList.value?.find { it.goodsInfo?.goodsid == goodid }
|
|
|
viewModel.dataList.value?.indexOf(goodsInfo)?.let {
|
|
viewModel.dataList.value?.indexOf(goodsInfo)?.let {
|
|
|
if (it != -1) {//刷新相应item
|
|
if (it != -1) {//刷新相应item
|
|
|
- tjmdHomeMarketViewHolder?.notifyItemChanged(it)
|
|
|
|
|
|
|
+ tjmdHomeMarketViewHolder.notifyItemChanged(it)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @SuppressLint("RtlHardcoded")
|
|
|
private fun initViewFlipper(notice: List<NoticeData>) {
|
|
private fun initViewFlipper(notice: List<NoticeData>) {
|
|
|
for (i in 0 until notice.size) {
|
|
for (i in 0 until notice.size) {
|
|
|
val view = TextView(context)
|
|
val view = TextView(context)
|
|
@@ -162,12 +146,12 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
view.ellipsize = TextUtils.TruncateAt.END
|
|
view.ellipsize = TextUtils.TruncateAt.END
|
|
|
view.setTextColor(context?.resources?.getColor(R.color.rma_black_33)!!)
|
|
view.setTextColor(context?.resources?.getColor(R.color.rma_black_33)!!)
|
|
|
view.textSize = 12f
|
|
view.textSize = 12f
|
|
|
- view.setOnClickListener(View.OnClickListener {
|
|
|
|
|
|
|
+ view.setOnClickListener {
|
|
|
val intent = Intent()
|
|
val intent = Intent()
|
|
|
- intent.putExtra("data",notice.get(i))
|
|
|
|
|
|
|
+ intent.putExtra("data", notice[i])
|
|
|
intent.setClass(context!!, MessageDetailsActivity::class.java)
|
|
intent.setClass(context!!, MessageDetailsActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
ActivityUtils.startActivity(intent)
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
noticeViewFlipper.addView(view)
|
|
noticeViewFlipper.addView(view)
|
|
|
}
|
|
}
|
|
|
//是否自动开始滚动
|
|
//是否自动开始滚动
|
|
@@ -190,7 +174,7 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
return UI {
|
|
return UI {
|
|
|
viewModel.getBanner()
|
|
viewModel.getBanner()
|
|
|
|
|
|
|
|
- viewModel.setDataList(thisTag){isCompleted, err ->
|
|
|
|
|
|
|
+ viewModel.setDataList(thisTag){ _, _ ->
|
|
|
GlobalScope.launch(Dispatchers.Main) {
|
|
GlobalScope.launch(Dispatchers.Main) {
|
|
|
// chartModel.yAxisMin(viewModel.wrAverageTradePriceMin)
|
|
// chartModel.yAxisMin(viewModel.wrAverageTradePriceMin)
|
|
|
// chartModel.yAxisMax(viewModel.wrAverageTradePriceMax)
|
|
// chartModel.yAxisMax(viewModel.wrAverageTradePriceMax)
|
|
@@ -261,7 +245,7 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
null
|
|
null
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- setDelegate { banner, itemView, model, position ->
|
|
|
|
|
|
|
+ setDelegate { _, _, model, _ ->
|
|
|
val data = model as BannerData
|
|
val data = model as BannerData
|
|
|
val intent = Intent()
|
|
val intent = Intent()
|
|
|
intent.putExtra("url",data.url)
|
|
intent.putExtra("url",data.url)
|
|
@@ -269,13 +253,6 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
intent.setClass(context, WebActivity::class.java)
|
|
intent.setClass(context, WebActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
ActivityUtils.startActivity(intent)
|
|
|
}
|
|
}
|
|
|
-// setDelegate(new BGABanner.Delegate() {
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onBannerItemClick(BGABanner banner, View itemView, @Nullable Object model, int position) {
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
setAdapter(object : BGABanner.Adapter<CardView, BannerData> {
|
|
setAdapter(object : BGABanner.Adapter<CardView, BannerData> {
|
|
|
override fun fillBannerItem(
|
|
override fun fillBannerItem(
|
|
@@ -292,9 +269,6 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
}else{
|
|
}else{
|
|
|
SPUtils.getInstance().getString(Constant.uploadUrl) + model?.imagepath?.substring(1)
|
|
SPUtils.getInstance().getString(Constant.uploadUrl) + model?.imagepath?.substring(1)
|
|
|
}))
|
|
}))
|
|
|
-// Uri.parse(
|
|
|
|
|
-// SPUtils.getInstance().getString(
|
|
|
|
|
-// Constant.uploadUrl) + model?.imagepath?.substring(1)))
|
|
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -520,11 +494,11 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
lastShow = linearLayoutManager.findLastVisibleItemPosition()//获取最后一个显示条目
|
|
lastShow = linearLayoutManager.findLastVisibleItemPosition()//获取最后一个显示条目
|
|
|
if (fistShow != -1 && lastShow != -1) {
|
|
if (fistShow != -1 && lastShow != -1) {
|
|
|
viewModel.queryQuoteDay(
|
|
viewModel.queryQuoteDay(
|
|
|
- tag = thisTag ?: "",
|
|
|
|
|
|
|
+ tag = thisTag,
|
|
|
first = fistShow,
|
|
first = fistShow,
|
|
|
last = lastShow,
|
|
last = lastShow,
|
|
|
list = viewModel.dataList.value ?: arrayListOf()
|
|
list = viewModel.dataList.value ?: arrayListOf()
|
|
|
- ) { isCompleted, err ->
|
|
|
|
|
|
|
+ ) { isCompleted, _ ->
|
|
|
if (isCompleted) {
|
|
if (isCompleted) {
|
|
|
dataRecyclerview.adapter?.notifyItemRangeChanged(fistShow, lastShow)
|
|
dataRecyclerview.adapter?.notifyItemRangeChanged(fistShow, lastShow)
|
|
|
}
|
|
}
|
|
@@ -586,7 +560,6 @@ class TjmdHomeFragment : BaseFragment<TjmdHomeViewModel>(){
|
|
|
|
|
|
|
|
}.lparams(matchParent, autoSize(380))
|
|
}.lparams(matchParent, autoSize(380))
|
|
|
|
|
|
|
|
-
|
|
|
|
|
recyclerView {
|
|
recyclerView {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
val staggeredGridLayoutManager = StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL)
|
|
val staggeredGridLayoutManager = StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL)
|