|
@@ -18,9 +18,11 @@ import androidx.annotation.Nullable
|
|
|
import androidx.cardview.widget.CardView
|
|
import androidx.cardview.widget.CardView
|
|
|
import androidx.fragment.app.Fragment
|
|
import androidx.fragment.app.Fragment
|
|
|
import androidx.fragment.app.FragmentPagerAdapter
|
|
import androidx.fragment.app.FragmentPagerAdapter
|
|
|
|
|
+import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
import cn.bingoogolapple.bgabanner.BGABanner
|
|
import cn.bingoogolapple.bgabanner.BGABanner
|
|
|
import cn.muchinfo.rma.R
|
|
import cn.muchinfo.rma.R
|
|
|
|
|
+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.toShowTime3
|
|
import cn.muchinfo.rma.global.toShowTime3
|
|
@@ -34,6 +36,10 @@ 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.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.PerformanceTemplateActivity
|
|
import cn.muchinfo.rma.view.base.hnstmain.performancetemplate.PerformanceTemplateActivity
|
|
|
|
|
+import cn.muchinfo.rma.view.base.home.MessageUI
|
|
|
|
|
+import cn.muchinfo.rma.view.base.home.NewAnnouncementUI
|
|
|
|
|
+import cn.muchinfo.rma.view.base.home.NewInformationUI
|
|
|
|
|
+import cn.muchinfo.rma.view.base.home.NewResearchReportUI
|
|
|
import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
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.reference.ReferenceActivity
|
|
|
import cn.muchinfo.rma.view.base.home.set.SettingActivity
|
|
import cn.muchinfo.rma.view.base.home.set.SettingActivity
|
|
@@ -70,68 +76,79 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
lateinit var segment1: QMUITabSegment
|
|
lateinit var segment1: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
private lateinit var viewPager: ViewPager
|
|
|
|
|
+ lateinit var noticeViewFlipper : ViewFlipper
|
|
|
|
|
|
|
|
|
|
+ private val yrdzIndexUI : YrdzIndexUI by lazy { YrdzIndexUI(this,viewModel) }
|
|
|
|
|
|
|
|
- //viewpager的适配器
|
|
|
|
|
- private var newPagerAdapter: FragmentPagerAdapter? = null
|
|
|
|
|
|
|
+ private val yrAnnouncementUI: YrAnnouncementUI by lazy {
|
|
|
|
|
+ YrAnnouncementUI(
|
|
|
|
|
+ this,
|
|
|
|
|
+ viewModel
|
|
|
|
|
+ )
|
|
|
|
|
+ }//公告
|
|
|
|
|
|
|
|
- //tabSegment标题
|
|
|
|
|
- private val newTabsArray: ArrayList<String> = arrayListOf()
|
|
|
|
|
|
|
+ private val yrdzInformationUI: YrdzInformationUI by lazy {
|
|
|
|
|
+ YrdzInformationUI(
|
|
|
|
|
+ this,
|
|
|
|
|
+ viewModel
|
|
|
|
|
+ )
|
|
|
|
|
+ }//咨讯
|
|
|
|
|
+ private val yrMessageUI: YrMessageUI by lazy {
|
|
|
|
|
+ YrMessageUI(
|
|
|
|
|
+ this,
|
|
|
|
|
+ viewModel
|
|
|
|
|
+ )
|
|
|
|
|
+ }//消息
|
|
|
|
|
|
|
|
- //viewpager绑定的页面集合
|
|
|
|
|
- private val newTabFragment: ArrayList<Fragment> = arrayListOf()
|
|
|
|
|
|
|
|
|
|
- lateinit var noticeViewFlipper : ViewFlipper
|
|
|
|
|
|
|
|
|
|
- val indexAdapter: BaseAdapter<IndexData, IndexViewHolder> =
|
|
|
|
|
- BaseAdapter { _, _ ->
|
|
|
|
|
- IndexViewHolder(
|
|
|
|
|
- this
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //viewpager的适配器
|
|
|
|
|
+ private var pagerAdapter : PagerAdapter? = null
|
|
|
|
|
|
|
|
- fun initMenuData() {
|
|
|
|
|
- newTabsArray.add("通用塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("通用塑料"))
|
|
|
|
|
|
|
+ //tabSegment标题
|
|
|
|
|
+ private val tabsArray : ArrayList<String> = arrayListOf()
|
|
|
|
|
|
|
|
- newTabsArray.add("工程塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("工程塑料"))
|
|
|
|
|
|
|
+ //暂存的页面组
|
|
|
|
|
+ private val uiMessageList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
|
|
|
|
|
- newTabsArray.add("特种工程塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("特种工程塑料"))
|
|
|
|
|
|
|
|
|
|
- newTabsArray.add("合金塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("合金塑料"))
|
|
|
|
|
|
|
|
|
|
- newTabsArray.add("热塑弹性体")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("热塑弹性体"))
|
|
|
|
|
|
|
+ fun initMessageMenuData(){
|
|
|
|
|
+ tabsArray.add("资讯")
|
|
|
|
|
+ uiMessageList.add(yrdzInformationUI.root)
|
|
|
|
|
+ tabsArray.add("公告")
|
|
|
|
|
+ uiMessageList.add(yrAnnouncementUI.root)
|
|
|
|
|
+ tabsArray.add("消息")
|
|
|
|
|
+ uiMessageList.add(yrMessageUI.root)
|
|
|
|
|
+ tabsArray.add("消息")
|
|
|
|
|
+ uiMessageList.add(yrdzIndexUI.root)
|
|
|
|
|
|
|
|
- newTabsArray.add("降解塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("降解塑料"))
|
|
|
|
|
|
|
+ pagerAdapter = object : PagerAdapter() {
|
|
|
|
|
|
|
|
- newTabsArray.add("热固性塑料")
|
|
|
|
|
- newTabFragment.add(YrdzMarketFragment.getInstance("降解塑料"))
|
|
|
|
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
|
|
|
|
|
|
|
|
- newPagerAdapter = object : FragmentPagerAdapter(
|
|
|
|
|
- getAppCompatActivity().supportFragmentManager,
|
|
|
|
|
- BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
|
|
|
|
- ) {
|
|
|
|
|
- @NonNull
|
|
|
|
|
- override fun getItem(position: Int): Fragment {
|
|
|
|
|
- return newTabFragment[position]
|
|
|
|
|
|
|
+ override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
|
|
+ return uiMessageList.get(position).apply {
|
|
|
|
|
+ container.addView(
|
|
|
|
|
+ this,
|
|
|
|
|
+ ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- override fun getCount(): Int {
|
|
|
|
|
- return newTabFragment.size
|
|
|
|
|
|
|
+ override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
|
|
|
+ (`object` as? View)?.let { container.removeView(it) }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Nullable
|
|
|
|
|
- override fun getPageTitle(position: Int): CharSequence? {
|
|
|
|
|
- return newTabsArray[position]
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
|
|
|
|
|
+
|
|
|
|
|
+ override fun getCount(): Int = tabsArray.size
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
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)
|
|
@@ -172,7 +189,7 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
savedInstanceState: Bundle?
|
|
savedInstanceState: Bundle?
|
|
|
): View? {
|
|
): View? {
|
|
|
return UI {
|
|
return UI {
|
|
|
- initMenuData()
|
|
|
|
|
|
|
+ initMessageMenuData()
|
|
|
viewModel.getBanner()
|
|
viewModel.getBanner()
|
|
|
viewModel.setDataList()
|
|
viewModel.setDataList()
|
|
|
viewModel.queryNotice()
|
|
viewModel.queryNotice()
|
|
@@ -194,6 +211,7 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
imageView {
|
|
imageView {
|
|
|
|
|
+ visibility = View.GONE
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
val intent = Intent()
|
|
val intent = Intent()
|
|
|
intent.setClass(context, YrdzNoticeActivity::class.java)
|
|
intent.setClass(context, YrdzNoticeActivity::class.java)
|
|
@@ -275,6 +293,7 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
itemView()
|
|
itemView()
|
|
|
|
|
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
|
|
+ visibility = View.GONE
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
imageView {
|
|
imageView {
|
|
|
imageResource = R.mipmap.yrdz_nctice_icon
|
|
imageResource = R.mipmap.yrdz_nctice_icon
|
|
@@ -480,7 +499,7 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
selectedTabIndex = index
|
|
selectedTabIndex = index
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- mode = QMUITabSegment.MODE_SCROLLABLE
|
|
|
|
|
|
|
+ mode = QMUITabSegment.MODE_FIXED
|
|
|
setIndicator(
|
|
setIndicator(
|
|
|
QMUITabIndicator(
|
|
QMUITabIndicator(
|
|
|
QMUIDisplayHelper.dp2px(context, 2),
|
|
QMUIDisplayHelper.dp2px(context, 2),
|
|
@@ -502,127 +521,13 @@ class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
marginEnd = autoSize(32)
|
|
marginEnd = autoSize(32)
|
|
|
}
|
|
}
|
|
|
viewPager {
|
|
viewPager {
|
|
|
- id = R.id.view_pager
|
|
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
viewPager = this
|
|
viewPager = this
|
|
|
- adapter = newPagerAdapter
|
|
|
|
|
- }.lparams(matchParent, autoSize(150))
|
|
|
|
|
|
|
+ adapter = pagerAdapter
|
|
|
|
|
+ }.lparams(matchParent, autoSize(800))
|
|
|
|
|
|
|
|
segment.setupWithViewPager(viewPager)
|
|
segment.setupWithViewPager(viewPager)
|
|
|
segment.selectTab(selectedTabIndex)
|
|
segment.selectTab(selectedTabIndex)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
-
|
|
|
|
|
- view {
|
|
|
|
|
- background = resources.getDrawable(R.color.rma_blue_color)
|
|
|
|
|
- }.lparams(autoSize(12), autoSize(43))
|
|
|
|
|
-
|
|
|
|
|
- textView {
|
|
|
|
|
- text = "云融指数"
|
|
|
|
|
- textSizeAuto = 34
|
|
|
|
|
- textColorInt = R.color.rma_black_33
|
|
|
|
|
- typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
|
|
|
|
- }.lparams(wrapContent, wrapContent) {
|
|
|
|
|
- marginStart = autoSize(36)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- emptyView()
|
|
|
|
|
-
|
|
|
|
|
- imageView {
|
|
|
|
|
- imageResource = R.mipmap.yrdz_chart_icon
|
|
|
|
|
- }.lparams(autoSize(36), autoSize(36)) {
|
|
|
|
|
- marginEnd = autoSize(36)
|
|
|
|
|
- }
|
|
|
|
|
- }.lparams(matchParent, autoSize(80))
|
|
|
|
|
-
|
|
|
|
|
- frameLayout {
|
|
|
|
|
- verticalLayout {
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- linearLayout {
|
|
|
|
|
-
|
|
|
|
|
- }.lparams(0, autoSize(70), 1f)
|
|
|
|
|
-
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- gravity = Gravity.CENTER
|
|
|
|
|
- textView {
|
|
|
|
|
- text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(86400))
|
|
|
|
|
- ?.toShowTime3("dd") + "日"
|
|
|
|
|
- textSizeAuto = 29
|
|
|
|
|
- textColorInt = R.color.hint_text_color
|
|
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
|
|
- }.lparams(0, autoSize(70), 1f)
|
|
|
|
|
-
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- gravity = Gravity.CENTER
|
|
|
|
|
- textView {
|
|
|
|
|
- text = TimeUtils.millis2String(TimeUtils.getNowMills().minus(172800))
|
|
|
|
|
- ?.toShowTime3("dd") + "日"
|
|
|
|
|
- textSizeAuto = 29
|
|
|
|
|
- textColorInt = R.color.hint_text_color
|
|
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
|
|
- }.lparams(0, autoSize(70), 1f)
|
|
|
|
|
-
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- gravity = Gravity.CENTER
|
|
|
|
|
- textView {
|
|
|
|
|
- text = "涨跌"
|
|
|
|
|
- textSizeAuto = 29
|
|
|
|
|
- textColorInt = R.color.hint_text_color
|
|
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
|
|
- }.lparams(0, autoSize(70), 1f)
|
|
|
|
|
-
|
|
|
|
|
- linearLayout {
|
|
|
|
|
- gravity = Gravity.CENTER
|
|
|
|
|
- textView {
|
|
|
|
|
- text = "涨幅"
|
|
|
|
|
- textSizeAuto = 29
|
|
|
|
|
- textColorInt = R.color.hint_text_color
|
|
|
|
|
- }.lparams(wrapContent, wrapContent)
|
|
|
|
|
- }.lparams(0, autoSize(70), 1f)
|
|
|
|
|
- }.lparams(matchParent, autoSize(70))
|
|
|
|
|
-
|
|
|
|
|
- statusLayout(contentBlock = {
|
|
|
|
|
- statusLayout = this
|
|
|
|
|
-// bindTaskStatus(viewModule.status)
|
|
|
|
|
- setRetryAction {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- swipeToLoadLayout {
|
|
|
|
|
- swipeToLayout = this
|
|
|
|
|
- setEnableRefresh(false)
|
|
|
|
|
- setEnableLoadMore(false)
|
|
|
|
|
- setOnRefreshListener {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- setEnableScrollContentWhenLoaded(false)
|
|
|
|
|
- setEnableLoadMoreWhenContentNotFull(false)
|
|
|
|
|
-
|
|
|
|
|
- // 未提交列表
|
|
|
|
|
- recyclerView {
|
|
|
|
|
- background = resources.getDrawable(R.color.white)
|
|
|
|
|
- adapter = indexAdapter
|
|
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
|
|
- }
|
|
|
|
|
- }, emptyBlock = {
|
|
|
|
|
- emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
|
|
- }).lparams(matchParent, matchParent)
|
|
|
|
|
-
|
|
|
|
|
- viewModel.dataList.bindOptional(context) {
|
|
|
|
|
- if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
|
|
- statusLayout.showEmpty()
|
|
|
|
|
- } else {
|
|
|
|
|
- if (swipeToLayout.getIsRefreshing()) {
|
|
|
|
|
- swipeToLayout.finishRefresh()
|
|
|
|
|
- }
|
|
|
|
|
- statusLayout.showSuccess()
|
|
|
|
|
- indexAdapter.setNewData(it)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}.lparams(matchParent, matchParent)
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
|
|