|
|
@@ -14,6 +14,7 @@ import android.widget.FrameLayout
|
|
|
import android.widget.TextView
|
|
|
import android.widget.ViewFlipper
|
|
|
import androidx.cardview.widget.CardView
|
|
|
+import androidx.fragment.app.Fragment
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
@@ -22,6 +23,7 @@ import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.BannerData
|
|
|
import cn.muchinfo.rma.global.data.NoticeData
|
|
|
+import cn.muchinfo.rma.global.data.SiteColumnDetailData
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.base.BaseFragment
|
|
|
@@ -29,8 +31,11 @@ import cn.muchinfo.rma.view.base.WebActivity
|
|
|
import cn.muchinfo.rma.view.base.app.Constant
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.performance.PerformanceInformationActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.HomeViewModel
|
|
|
+import cn.muchinfo.rma.view.base.home.NewInformationUI
|
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrAnnouncementUI
|
|
|
import cn.muchinfo.rma.view.base.home.yrdz.YrdzNoticeActivity
|
|
|
+import cn.muchinfo.rma.view.base.qhjhome.QhjInformationViewHolder
|
|
|
import cn.muchinfo.rma.view.eventbus.MainTabSelectMessageEvent
|
|
|
import com.blankj.utilcode.util.ActivityUtils
|
|
|
import com.blankj.utilcode.util.ConvertUtils
|
|
|
@@ -43,6 +48,7 @@ import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
import kotlinx.coroutines.launch
|
|
|
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
|
|
|
import mtp.polymer.com.information_management.hnstocks.message.MessageDetailsActivity
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
import org.jetbrains.anko.*
|
|
|
@@ -79,6 +85,7 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
|
|
|
viewModel
|
|
|
)
|
|
|
}//公告
|
|
|
+ private val informationUI: XhcpInformationUI by lazy { XhcpInformationUI(this, viewModel) }//咨讯
|
|
|
|
|
|
val thisTag by lazy {
|
|
|
"XhcpHomeFragment"
|
|
|
@@ -94,6 +101,8 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
|
|
|
private val uiMessageList: ArrayList<_FrameLayout> = arrayListOf()
|
|
|
|
|
|
fun initMessageMenuData() {
|
|
|
+ tabsArray.add("资讯")
|
|
|
+ uiMessageList.add(informationUI.root)
|
|
|
tabsArray.add("公告")
|
|
|
uiMessageList.add(xhcpAnnouncementUI.root)
|
|
|
|
|
|
@@ -256,126 +265,6 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
|
|
|
|
|
|
itemView()
|
|
|
|
|
|
- linearLayout {
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
- imageView {
|
|
|
- imageResource = R.mipmap.yrdz_nctice_icon
|
|
|
- }.lparams(autoSize(36), autoSize(36)){
|
|
|
- marginStart = autoSize(36)
|
|
|
- }
|
|
|
-
|
|
|
- viewFlipper {
|
|
|
- noticeViewFlipper = this
|
|
|
- viewModel.noticeDataList.bindOptional(context){
|
|
|
- if (it?.size ?: 0 > 0){
|
|
|
- val newDataList = arrayListOf<NoticeData>()
|
|
|
- newDataList.add(it?.get(0) ?: NoticeData())
|
|
|
- initViewFlipper(newDataList)
|
|
|
- }
|
|
|
- }
|
|
|
- }.lparams(matchParent, autoSize(72)){
|
|
|
- marginStart = autoSize(36)
|
|
|
- }
|
|
|
-
|
|
|
- }.lparams(matchParent, autoSize(72))
|
|
|
-
|
|
|
- itemView()
|
|
|
-
|
|
|
- linearLayout {
|
|
|
- val tjmdMarketList = GlobalDataCollection.instance?.getTjmdShowMarketSectionList()
|
|
|
- tjmdMarketList?.forEach { data ->
|
|
|
- relativeLayout {
|
|
|
- verticalLayout {
|
|
|
- onThrottleFirstClick {
|
|
|
- EventBus.getDefault().post(MainTabSelectMessageEvent(tjmdMarketList.indexOf(data).plus(1)))
|
|
|
- }
|
|
|
-
|
|
|
- imageView {
|
|
|
- if (data.pictureurl != null && data.pictureurl.isNotEmpty()) {
|
|
|
- showImage(
|
|
|
- SPUtils.getInstance().getString(
|
|
|
- Constant.uploadUrl).replace("/upload","") + data.pictureurl.substring(1))
|
|
|
- }
|
|
|
- }.lparams(autoSize(72), autoSize(72)) {
|
|
|
- gravity = Gravity.CENTER_HORIZONTAL
|
|
|
- }
|
|
|
-
|
|
|
- textView {
|
|
|
- text = data.marketsectionname
|
|
|
- textColorInt = R.color.black
|
|
|
- textSizeAuto = 26
|
|
|
- }.lparams(wrapContent, wrapContent) {
|
|
|
- topMargin = autoSize(20)
|
|
|
- gravity = Gravity.CENTER_HORIZONTAL
|
|
|
- }
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
-
|
|
|
- textView {
|
|
|
- visibility = View.GONE
|
|
|
- textColorInt = R.color.p_global_write_color
|
|
|
- textSizeAuto = 15
|
|
|
- setPadding(
|
|
|
- autoSize(10),
|
|
|
- autoSize(6),
|
|
|
- autoSize(10),
|
|
|
- autoSize(6)
|
|
|
- )
|
|
|
- backgroundDrawable =
|
|
|
- createRoundRectDrawable("#fe671a", 45)
|
|
|
- }.lparams(wrapContent, wrapContent) {
|
|
|
- marginStart = autoSize(130)
|
|
|
- }
|
|
|
- }.lparams(autoSize(225), matchParent)
|
|
|
- }
|
|
|
- //参考行情
|
|
|
-
|
|
|
- relativeLayout {
|
|
|
- verticalLayout {
|
|
|
- onThrottleFirstClick {
|
|
|
- val intent = Intent()
|
|
|
- intent.setClass(
|
|
|
- context,
|
|
|
- PerformanceInformationActivity::class.java
|
|
|
- )
|
|
|
- ActivityUtils.startActivity(intent)
|
|
|
- }
|
|
|
- imageView {
|
|
|
- imageResource = R.mipmap.main_business_5
|
|
|
- }.lparams(autoSize(72), autoSize(72)) {
|
|
|
- gravity = Gravity.CENTER_HORIZONTAL
|
|
|
- }
|
|
|
-
|
|
|
- textView {
|
|
|
- text = "履约管理"
|
|
|
- textColorInt = R.color.black
|
|
|
- textSizeAuto = 26
|
|
|
- }.lparams(wrapContent, wrapContent) {
|
|
|
- topMargin = autoSize(20)
|
|
|
- gravity = Gravity.CENTER_HORIZONTAL
|
|
|
- }
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
-
|
|
|
- textView {
|
|
|
- visibility = View.GONE
|
|
|
- textColorInt = R.color.p_global_write_color
|
|
|
- textSizeAuto = 15
|
|
|
- setPadding(
|
|
|
- autoSize(10),
|
|
|
- autoSize(6),
|
|
|
- autoSize(10),
|
|
|
- autoSize(6)
|
|
|
- )
|
|
|
- backgroundDrawable =
|
|
|
- createRoundRectDrawable("#fe671a", 45)
|
|
|
- }.lparams(wrapContent, wrapContent) {
|
|
|
- marginStart = autoSize(130)
|
|
|
- }
|
|
|
- }.lparams(autoSize(225), matchParent)
|
|
|
-
|
|
|
- }.lparams(matchParent, autoSize(140)) {
|
|
|
- topMargin = autoSize(40)
|
|
|
- }
|
|
|
-
|
|
|
view {
|
|
|
background = resources.getDrawable(R.color.rma_hint_line_color_eee)
|
|
|
}.lparams(matchParent, autoSize(20))
|
|
|
@@ -427,4 +316,46 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
|
|
|
}
|
|
|
}.view
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 咨讯
|
|
|
+ */
|
|
|
+class XhcpInformationUI(private val baseFragment: Fragment, private val viewModule: XhcpHomeViewModel) {
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ private val informationAdapter: BaseAdapter<SiteColumnDetailData, XhcpInformationViewHolder> =
|
|
|
+ BaseAdapter { _, _ -> XhcpInformationViewHolder(baseFragment, viewModule) }
|
|
|
+ val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
+ verticalLayout {
|
|
|
+ viewModule.querySiteColumnDetail()
|
|
|
+ statusLayout(contentBlock = {
|
|
|
+ statusLayout = this
|
|
|
+// bindTaskStatus(viewModule.status)
|
|
|
+ swipeToLoadLayout {
|
|
|
+ swipeToLayout = this
|
|
|
+ setEnableRefresh(false)
|
|
|
+ setEnableLoadMore(false)
|
|
|
+ setEnableScrollContentWhenLoaded(false)
|
|
|
+ setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = informationAdapter
|
|
|
+ isNestedScrollingEnabled = false
|
|
|
+ }.lparams(matchParent, matchParent) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(20)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, emptyBlock = {
|
|
|
+ emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
+ }).lparams(matchParent, matchParent)
|
|
|
+ viewModule.SiteColumnDetailList.bindOptional(context) {
|
|
|
+ informationAdapter.setNewData(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|