|
|
@@ -0,0 +1,663 @@
|
|
|
+package cn.muchinfo.rma.view.base.home.yrdz
|
|
|
+
|
|
|
+import android.content.Intent
|
|
|
+import android.graphics.Rect
|
|
|
+import android.graphics.Typeface
|
|
|
+import android.net.Uri
|
|
|
+import android.os.Bundle
|
|
|
+import android.text.TextUtils
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.LayoutInflater
|
|
|
+import android.view.View
|
|
|
+import android.view.ViewGroup
|
|
|
+import android.widget.FrameLayout
|
|
|
+import android.widget.TextView
|
|
|
+import android.widget.ViewFlipper
|
|
|
+import androidx.annotation.NonNull
|
|
|
+import androidx.annotation.Nullable
|
|
|
+import androidx.cardview.widget.CardView
|
|
|
+import androidx.fragment.app.Fragment
|
|
|
+import androidx.fragment.app.FragmentPagerAdapter
|
|
|
+import androidx.viewpager.widget.ViewPager
|
|
|
+import cn.bingoogolapple.bgabanner.BGABanner
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.data.BannerData
|
|
|
+import cn.muchinfo.rma.global.data.NoticeData
|
|
|
+import cn.muchinfo.rma.global.toShowTime3
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.base.BaseFragment
|
|
|
+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.bookingwarehouse.BookingWarehouseActivity
|
|
|
+import cn.muchinfo.rma.view.base.hnstmain.performancetemplate.PerformanceTemplateActivity
|
|
|
+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.set.SettingActivity
|
|
|
+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 com.blankj.utilcode.util.*
|
|
|
+import com.facebook.drawee.view.SimpleDraweeView
|
|
|
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
+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.*
|
|
|
+import org.jetbrains.anko.support.v4.UI
|
|
|
+import org.jetbrains.anko.support.v4.viewPager
|
|
|
+
|
|
|
+/**
|
|
|
+ * 云融大宗的首页
|
|
|
+ */
|
|
|
+class YrdzHomeFragment : BaseFragment<YrdzHomeViewModel>(){
|
|
|
+
|
|
|
+ companion object {
|
|
|
+ fun newInstance() = YrdzHomeFragment()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下拉刷新
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+
|
|
|
+ lateinit var segment: QMUITabSegment
|
|
|
+ lateinit var segment1: QMUITabSegment
|
|
|
+ var selectedTabIndex: Int = 0
|
|
|
+ private lateinit var viewPager: ViewPager
|
|
|
+
|
|
|
+
|
|
|
+ //viewpager的适配器
|
|
|
+ private var newPagerAdapter: FragmentPagerAdapter? = null
|
|
|
+
|
|
|
+ //tabSegment标题
|
|
|
+ private val newTabsArray: ArrayList<String> = arrayListOf()
|
|
|
+
|
|
|
+ //viewpager绑定的页面集合
|
|
|
+ private val newTabFragment: ArrayList<Fragment> = arrayListOf()
|
|
|
+
|
|
|
+ lateinit var noticeViewFlipper : ViewFlipper
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //
|
|
|
+ val indexAdapter: BaseAdapter<IndexData, IndexViewHolder> =
|
|
|
+ BaseAdapter { _, _ ->
|
|
|
+ IndexViewHolder(
|
|
|
+ this
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ fun initMenuData() {
|
|
|
+ newTabsArray.add("通用塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("通用塑料"))
|
|
|
+
|
|
|
+ newTabsArray.add("工程塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("工程塑料"))
|
|
|
+
|
|
|
+ newTabsArray.add("特种工程塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("特种工程塑料"))
|
|
|
+
|
|
|
+ newTabsArray.add("合金塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("合金塑料"))
|
|
|
+
|
|
|
+ newTabsArray.add("热塑弹性体")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("热塑弹性体"))
|
|
|
+
|
|
|
+ newTabsArray.add("降解塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("降解塑料"))
|
|
|
+
|
|
|
+ newTabsArray.add("热固性塑料")
|
|
|
+ newTabFragment.add(YrdzMarketFragment.getInstance("降解塑料"))
|
|
|
+
|
|
|
+ newPagerAdapter = object : FragmentPagerAdapter(
|
|
|
+ getAppCompatActivity().supportFragmentManager,
|
|
|
+ BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
|
|
+ ) {
|
|
|
+ @NonNull
|
|
|
+ override fun getItem(position: Int): Fragment {
|
|
|
+ return newTabFragment[position]
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun getCount(): Int {
|
|
|
+ return newTabFragment.size
|
|
|
+ }
|
|
|
+
|
|
|
+ @Nullable
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? {
|
|
|
+ return newTabsArray[position]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun initViewFlipper(notice: List<NoticeData>) {
|
|
|
+ for (i in 0 until notice.size) {
|
|
|
+ val view = TextView(context)
|
|
|
+ val params = FrameLayout.LayoutParams(
|
|
|
+ ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
|
+ ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
+ )
|
|
|
+ params.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ view.layoutParams = params
|
|
|
+ view.text = notice[i].title
|
|
|
+ view.maxLines = 1
|
|
|
+ view.ellipsize = TextUtils.TruncateAt.END
|
|
|
+ view.setTextColor(context?.resources?.getColor(R.color.rma_black_33)!!)
|
|
|
+ view.textSize = 12f
|
|
|
+ view.setOnClickListener(View.OnClickListener {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.putExtra("data",notice.get(i))
|
|
|
+ intent.setClass(context!!, MessageDetailsActivity::class.java)
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ })
|
|
|
+ noticeViewFlipper.addView(view)
|
|
|
+ }
|
|
|
+ //是否自动开始滚动
|
|
|
+ noticeViewFlipper.isAutoStart = true
|
|
|
+ //滚动时间
|
|
|
+ noticeViewFlipper.flipInterval = 3000
|
|
|
+ //开始滚动
|
|
|
+ noticeViewFlipper.startFlipping()
|
|
|
+ //出入动画
|
|
|
+ noticeViewFlipper.setOutAnimation(context, R.anim.slide_out_right)
|
|
|
+ noticeViewFlipper.setInAnimation(context, R.anim.slide_in_left)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ override fun onCreateView(
|
|
|
+ inflater: LayoutInflater,
|
|
|
+ container: ViewGroup?,
|
|
|
+ savedInstanceState: Bundle?
|
|
|
+ ): View? {
|
|
|
+ return UI {
|
|
|
+ initMenuData()
|
|
|
+ viewModel.getBanner()
|
|
|
+ viewModel.setDataList()
|
|
|
+ viewModel.queryNotice()
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.main_title_bg_color)
|
|
|
+ verticalLayout {
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ textView {
|
|
|
+ text = "云融"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 36
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(autoSize(620), autoSize(90)) {
|
|
|
+ marginStart = autoSize(140)
|
|
|
+ }
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(context, YrdzNoticeActivity::class.java)
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ }
|
|
|
+ imageResource = R.mipmap.yrdz_topright_icon
|
|
|
+ }.lparams(autoSize(45), autoSize(45)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(120))
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+ nestedScrollView{
|
|
|
+ setOnScrollChangeListener(object : View.OnScrollChangeListener {
|
|
|
+ override fun onScrollChange(
|
|
|
+ p0: View?,
|
|
|
+ p1: Int,
|
|
|
+ p2: Int,
|
|
|
+ p3: Int,
|
|
|
+ p4: Int
|
|
|
+ ) {
|
|
|
+ val scrollRect = Rect()
|
|
|
+ getHitRect(scrollRect)
|
|
|
+ LogUtils.eTag("adakhsfkjahsfa", "x = " + p1 + "y = " + p2)
|
|
|
+ if (p2 > 1000) {
|
|
|
+ segment1.visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ segment1.visibility = View.INVISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ verticalLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ inflateLayout<BGABanner>(R.layout.banner) {
|
|
|
+ // TODO 目前没有banner
|
|
|
+ viewModel.bannerList.bindOptional(context) {
|
|
|
+ setData(
|
|
|
+ R.layout.item_fresco,
|
|
|
+ it,
|
|
|
+ null
|
|
|
+ )
|
|
|
+ }
|
|
|
+ setDelegate { banner, itemView, model, position ->
|
|
|
+ val data = model as BannerData
|
|
|
+ val intent = Intent()
|
|
|
+ intent.putExtra("url",data.url)
|
|
|
+ intent.putExtra("title",data.title)
|
|
|
+ intent.setClass(context, WebActivity::class.java)
|
|
|
+ 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> {
|
|
|
+ override fun fillBannerItem(
|
|
|
+ banner: BGABanner?,
|
|
|
+ itemView: CardView?,
|
|
|
+ model: BannerData?,
|
|
|
+ position: Int
|
|
|
+ ) {
|
|
|
+ val simpleDraweeView: SimpleDraweeView =
|
|
|
+ itemView!!.findViewById(R.id.sdv_item_fresco_content)
|
|
|
+ simpleDraweeView.setImageURI(
|
|
|
+ Uri.parse(
|
|
|
+ SPUtils.getInstance().getString(
|
|
|
+ Constant.openApiUrl) + model?.imagepath?.substring(1)))
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(400))
|
|
|
+
|
|
|
+ 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){
|
|
|
+ initViewFlipper(it ?: arrayListOf())
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(72)){
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(72))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ //参考行情
|
|
|
+ relativeLayout {
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(
|
|
|
+ context,
|
|
|
+ ReferenceActivity::class.java
|
|
|
+ )
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.yrdz_reference_prices
|
|
|
+ }.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)
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ EventBus.getDefault().post(MainTabSelectMessageEvent(1))// 黄老板说的要跳去仓单贸易
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.yrdz_home_wymh_icon
|
|
|
+ }.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)
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(
|
|
|
+ context,
|
|
|
+ BookingWarehouseActivity::class.java
|
|
|
+ )
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.yrdz_home_wyys_icon
|
|
|
+ }.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)
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(
|
|
|
+ context,
|
|
|
+ PerformanceTemplateActivity::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)
|
|
|
+ }
|
|
|
+
|
|
|
+ tabSegment {
|
|
|
+ segment = this
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ addOnTabSelectedListener(object :
|
|
|
+ QMUITabSegment.OnTabSelectedListener {
|
|
|
+ override fun onDoubleTap(index: Int) {}
|
|
|
+ override fun onTabReselected(index: Int) {}
|
|
|
+ override fun onTabUnselected(index: Int) {}
|
|
|
+ override fun onTabSelected(index: Int) {
|
|
|
+ selectedTabIndex = index
|
|
|
+ }
|
|
|
+ })
|
|
|
+ mode = QMUITabSegment.MODE_SCROLLABLE
|
|
|
+ setIndicator(
|
|
|
+ QMUITabIndicator(
|
|
|
+ QMUIDisplayHelper.dp2px(context, 2),
|
|
|
+ false,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ )
|
|
|
+ setDefaultTextSize(
|
|
|
+ ConvertUtils.sp2px(16f),
|
|
|
+ ConvertUtils.sp2px(18f)
|
|
|
+ )
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
+ }.lparams(matchParent, autoSize(1)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ viewPager {
|
|
|
+ id = R.id.view_pager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ viewPager = this
|
|
|
+ adapter = newPagerAdapter
|
|
|
+ }.lparams(matchParent, autoSize(150))
|
|
|
+
|
|
|
+ segment.setupWithViewPager(viewPager)
|
|
|
+ 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))
|
|
|
+
|
|
|
+ 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)
|
|
|
+
|
|
|
+ tabSegment {
|
|
|
+ visibility = View.GONE
|
|
|
+ segment1 = this
|
|
|
+ visibility = View.INVISIBLE
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ addOnTabSelectedListener(object : QMUITabSegment.OnTabSelectedListener {
|
|
|
+ override fun onDoubleTap(index: Int) {}
|
|
|
+ override fun onTabReselected(index: Int) {}
|
|
|
+ override fun onTabUnselected(index: Int) {}
|
|
|
+ override fun onTabSelected(index: Int) {
|
|
|
+ selectedTabIndex = index
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setIndicator(
|
|
|
+ QMUITabIndicator(
|
|
|
+ QMUIDisplayHelper.dp2px(context, 2),
|
|
|
+ false,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ )
|
|
|
+ setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
|
|
|
+// setHasIndicator(true)
|
|
|
+// setDefaultNormalColor(Color.parseColor("#000000"))
|
|
|
+// setDefaultSelectedColor(Color.parseColor("#60a1e3"))
|
|
|
+// setTabTextSize(ConvertUtils.sp2px(16f))
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ segment1.setupWithViewPager(viewPager)
|
|
|
+ segment1.selectTab(selectedTabIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.view
|
|
|
+ }
|
|
|
+
|
|
|
+}
|