|
|
@@ -0,0 +1,667 @@
|
|
|
+package cn.muchinfo.rma.view.base.qhjhome
|
|
|
+
|
|
|
+import android.annotation.SuppressLint
|
|
|
+import android.content.Intent
|
|
|
+import android.graphics.Rect
|
|
|
+import android.net.Uri
|
|
|
+import android.os.Bundle
|
|
|
+import android.view.*
|
|
|
+import android.widget.ImageView
|
|
|
+import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.cardview.widget.CardView
|
|
|
+import androidx.fragment.app.Fragment
|
|
|
+import androidx.lifecycle.MutableLiveData
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
+import androidx.viewpager.widget.PagerAdapter
|
|
|
+import androidx.viewpager.widget.ViewPager
|
|
|
+import cn.bingoogolapple.bgabanner.BGABanner
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
+import cn.muchinfo.rma.global.data.NoticeData
|
|
|
+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.future.trade.GoodsTradeActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.accountmanager.AccountManagerActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.business.BusinessManagementActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.commodity.CommodityInformationActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.ContractActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import cn.muchinfo.rma.view.base.home.customerdata.CustomerDataActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.financial.FinancialActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.hedge.HedgePlanActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.InventoryAuditActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.inventory.inventorymanager.InventoryManagerActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.reportquery.ReportQueryActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.set.SettingActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.spotmarket.SpotMarketPriceActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.tradingquery.TradingQueryActivity
|
|
|
+import cn.muchinfo.rma.view.base.home.warehouse.WarehouseInformationActivity
|
|
|
+import cn.muchinfo.rma.view.eventbus.EventConstent
|
|
|
+import cn.muchinfo.rma.view.eventbus.MessageEvent
|
|
|
+import com.blankj.utilcode.util.ActivityUtils
|
|
|
+import com.blankj.utilcode.util.ConvertUtils
|
|
|
+import com.blankj.utilcode.util.LogUtils
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+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.autowidget.dialog.creatSelectAccountDialog
|
|
|
+import org.greenrobot.eventbus.EventBus
|
|
|
+import org.greenrobot.eventbus.Subscribe
|
|
|
+import org.greenrobot.eventbus.ThreadMode
|
|
|
+
|
|
|
+import org.jetbrains.anko.*
|
|
|
+import org.jetbrains.anko.support.v4.UI
|
|
|
+import org.jetbrains.anko.support.v4.viewPager
|
|
|
+import q.rorbin.badgeview.QBadgeView
|
|
|
+
|
|
|
+/**
|
|
|
+ * 千海金首页(虽说和企业风管首页极为相似,但是防止设计乱改,还是copy出来一份为好)
|
|
|
+ * @property statusLayout StatusLayout
|
|
|
+ * @property segment QMUITabSegment
|
|
|
+ * @property segment1 QMUITabSegment
|
|
|
+ * @property selectedTabIndex Int
|
|
|
+ * @property viewPager ViewPager
|
|
|
+ * @property announcementUI AnnouncementUI
|
|
|
+ * @property researchReportUI ResearchReportUI
|
|
|
+ * @property informationUI InformationUI
|
|
|
+ * @property menuTab MutableLiveData<Int>
|
|
|
+ * @property segment2 QMUITabSegment
|
|
|
+ * @property selectedTabIndex1 Int
|
|
|
+ * @property viewPager1 ViewPager
|
|
|
+ * @property firstTabUI FirstTabUI
|
|
|
+ * @property secondTabUI SecondTabUI
|
|
|
+ * @property tabsArray1 List<String>
|
|
|
+ * @property pagerAdapter1 PagerAdapter
|
|
|
+ * @property userqBadgeView QBadgeView
|
|
|
+ * @property userImage ImageView
|
|
|
+ * @property tabsArray List<String>
|
|
|
+ * @property pagerAdapter PagerAdapter
|
|
|
+ */
|
|
|
+class QhjHomeFragment : BaseFragment<QhjHomeViewModel>() {
|
|
|
+
|
|
|
+ companion object {
|
|
|
+ fun newInstance() = QhjHomeFragment()
|
|
|
+ }
|
|
|
+
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var segment: QMUITabSegment
|
|
|
+ lateinit var segment1: QMUITabSegment
|
|
|
+ var selectedTabIndex: Int = 0
|
|
|
+ private lateinit var viewPager: ViewPager
|
|
|
+ private val announcementUI: QhjAnnouncementUI by lazy { QhjAnnouncementUI(this, viewModel) }//公告
|
|
|
+ private val researchReportUI: QhjResearchReportUI by lazy { QhjResearchReportUI(this, viewModel) }//研报
|
|
|
+ private val informationUI: QhjInformationUI by lazy { QhjInformationUI(this, viewModel) }//咨讯
|
|
|
+
|
|
|
+
|
|
|
+ val menuTab: MutableLiveData<Int> = MutableLiveData<Int>().apply { value = 0 }//用于控制菜单页切换后的点点显示
|
|
|
+ lateinit var segment2: QMUITabSegment//用于菜单的tab
|
|
|
+ var selectedTabIndex1: Int = 0//用于菜单的selectedTabIndex
|
|
|
+ private lateinit var viewPager1: ViewPager//用于菜单的viewpager
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户未读标识
|
|
|
+ */
|
|
|
+ private val userqBadgeView: QBadgeView by lazy {
|
|
|
+ QBadgeView(getAppCompatActivity())
|
|
|
+ }
|
|
|
+ lateinit var userImage: ImageView
|
|
|
+
|
|
|
+ private val tabsArray: List<String> by lazy { arrayListOf("公告", "研报", "资讯") }
|
|
|
+
|
|
|
+ private val pagerAdapter: PagerAdapter by lazy {
|
|
|
+ object : PagerAdapter() {
|
|
|
+
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
|
|
|
+
|
|
|
+ override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
+ if (position == 0) {
|
|
|
+ return announcementUI.root.apply {
|
|
|
+ container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
|
|
|
+ }
|
|
|
+ } else if (position == 1) {
|
|
|
+ return researchReportUI.root.apply {
|
|
|
+ container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
|
|
|
+ }
|
|
|
+ } else if (position == 2) {
|
|
|
+ return informationUI.root.apply {
|
|
|
+ container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return super.instantiateItem(container, position)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
|
+ (`object` as? View)?.let { container.removeView(it) }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
|
|
|
+
|
|
|
+ override fun getCount(): Int = tabsArray.size
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResume() {
|
|
|
+ super.onResume()
|
|
|
+ viewModel.queryPendingAuditInfo()
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ EventBus.getDefault().register(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onDestroy() {
|
|
|
+ super.onDestroy()
|
|
|
+ EventBus.getDefault().unregister(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ fun onMessageEvent(messageEvent: MessageEvent) {
|
|
|
+ if (messageEvent.messageType == EventConstent.USERACCOUNTCHANGE) {
|
|
|
+ viewModel.initAccountData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用于切换首页tab时刷新资金账户信息
|
|
|
+ */
|
|
|
+ fun refrashAccount() {
|
|
|
+ viewModel.initAccountData()//初始化页面时进行一次资金账号的拿取
|
|
|
+ viewModel.queryPendingAuditInfo()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
+ override fun onCreateView(
|
|
|
+ inflater: LayoutInflater,
|
|
|
+ container: ViewGroup?,
|
|
|
+ savedInstanceState: Bundle?
|
|
|
+ ): View? {
|
|
|
+ return UI {
|
|
|
+ // FIXME: - test
|
|
|
+// viewModel.login()
|
|
|
+ viewModel.getBanner()
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.main_title_bg_color)
|
|
|
+ verticalLayout {
|
|
|
+ /** 资金账户选择 s首页不能进行资金选择**/
|
|
|
+ onThrottleFirstClick {
|
|
|
+// (context as AppCompatActivity).creatSelectAccountDialog{
|
|
|
+// EventBus.getDefault().post(MessageEvent(EventConstent.USERACCOUNTCHANGE))
|
|
|
+// }.show()
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ viewModel.userAccount.bindOptional(context) {
|
|
|
+ text = it?.accountname
|
|
|
+ }
|
|
|
+ text = GlobalDataCollection.instance?.loginRsp?.userID.toString()
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 36
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ viewModel.loginQueryData.bindOptional(context) {
|
|
|
+ text = it?.username + "(" + it?.loginAccount?.logincode + ")"
|
|
|
+ }
|
|
|
+ textColorStr = "#AED6F0"
|
|
|
+ textSizeAuto = 29
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(620), autoSize(90)) {
|
|
|
+ marginStart = autoSize(140)
|
|
|
+ }
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(context, SettingActivity::class.java)
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ }
|
|
|
+ imageResource = R.mipmap.rma_set
|
|
|
+ }.lparams(autoSize(45), autoSize(45)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(120))
|
|
|
+
|
|
|
+// inflateLayout<NestedScrollView>(R.layout.view_home_scrollview) {
|
|
|
+ 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)
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
+ imageResource = R.mipmap.banner
|
|
|
+ }.lparams(matchParent, autoSize(400))
|
|
|
+
|
|
|
+ inflateLayout<BGABanner>(R.layout.banner) {
|
|
|
+ visibility = View.GONE
|
|
|
+ // TODO 目前没有banner
|
|
|
+// viewModel.bannerList.bindOptional(context) {
|
|
|
+// setData(
|
|
|
+// R.layout.item_fresco,
|
|
|
+// it,
|
|
|
+// null
|
|
|
+// )
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ setAdapter(object : BGABanner.Adapter<CardView, String> {
|
|
|
+ override fun fillBannerItem(
|
|
|
+ banner: BGABanner?,
|
|
|
+ itemView: CardView?,
|
|
|
+ model: String?,
|
|
|
+ position: Int
|
|
|
+ ) {
|
|
|
+ val simpleDraweeView: SimpleDraweeView =
|
|
|
+ itemView!!.findViewById(R.id.sdv_item_fresco_content)
|
|
|
+ simpleDraweeView.setImageURI(Uri.parse(model))
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(400))
|
|
|
+
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ relativeLayout {
|
|
|
+// if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_customer") == true) {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// } else {
|
|
|
+// visibility = View.GONE
|
|
|
+// }
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.qhj_trading_query
|
|
|
+ }.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
|
|
|
+// viewModel.pendingAudit.bindOptional(context) {
|
|
|
+// if (it?.userqty?.toInt() ?: 0 > 99) {
|
|
|
+// text = "99+"
|
|
|
+// } else {
|
|
|
+// text = it?.userqty.toString()
|
|
|
+// }
|
|
|
+// if (it?.userqty?.toInt() == 0) {
|
|
|
+// visibility = View.GONE
|
|
|
+// } else {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// }
|
|
|
+// }
|
|
|
+ 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(0, matchParent, 1f)
|
|
|
+
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+// if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_deliverygoods") == true) {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// } else {
|
|
|
+// visibility = View.GONE
|
|
|
+// }
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.qhj_cast_surely_management
|
|
|
+ }.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(0, matchParent, 1f)
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+// if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_spotcontract") == true) {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// } else {
|
|
|
+// visibility = View.GONE
|
|
|
+// }
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.qhj_money_information
|
|
|
+ }.lparams(autoSize(72), autoSize(72)) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "资金信息"
|
|
|
+ textColorInt = R.color.black
|
|
|
+ textSizeAuto = 26
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ visibility = View.GONE
|
|
|
+// viewModel.pendingAudit.bindOptional(context) {
|
|
|
+// if (it?.spotcontractqty?.toInt() ?: 0 > 99) {
|
|
|
+// text = "99+"
|
|
|
+// } else {
|
|
|
+// text = it?.spotcontractqty.toString()
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (it?.spotcontractqty?.toInt() == 0) {
|
|
|
+// visibility = View.GONE
|
|
|
+// } else {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// }
|
|
|
+// }
|
|
|
+ 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(0, matchParent, 1f)
|
|
|
+
|
|
|
+ relativeLayout {
|
|
|
+// if (GlobalDataCollection.instance?.getFirstLevelMenu(code = "client_hedgeplan") == true) {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// } else {
|
|
|
+// visibility = View.GONE
|
|
|
+// }
|
|
|
+ verticalLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+
|
|
|
+ }
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.qhj_withdrawal
|
|
|
+ }.lparams(autoSize(72), autoSize(72)) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "充值提现"
|
|
|
+ textColorInt = R.color.black
|
|
|
+ textSizeAuto = 26
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ gravity = Gravity.CENTER_HORIZONTAL
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ visibility = View.GONE
|
|
|
+// viewModel.pendingAudit.bindOptional(context) {
|
|
|
+//
|
|
|
+// if (it?.hedgeplanqty?.toInt() ?: 0 > 99) {
|
|
|
+// text = "99+"
|
|
|
+// } else {
|
|
|
+// text = it?.hedgeplanqty.toString()
|
|
|
+// }
|
|
|
+// if (it?.hedgeplanqty?.toInt() == 0) {
|
|
|
+// visibility = View.GONE
|
|
|
+// } else {
|
|
|
+// visibility = View.VISIBLE
|
|
|
+// }
|
|
|
+// }
|
|
|
+ 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(0, matchParent, 1f)
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(140)) {
|
|
|
+ topMargin = autoSize(40)
|
|
|
+ }
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
+ }.lparams(matchParent, autoSize(24)) {
|
|
|
+ topMargin = autoSize(34)
|
|
|
+ }
|
|
|
+
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setIndicator(
|
|
|
+ QMUITabIndicator(
|
|
|
+ QMUIDisplayHelper.dp2px(context, 2),
|
|
|
+ false,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ )
|
|
|
+ setDefaultTextSize(
|
|
|
+ ConvertUtils.sp2px(16f),
|
|
|
+ ConvertUtils.sp2px(16f)
|
|
|
+ )
|
|
|
+
|
|
|
+ }.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 {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ viewPager = this
|
|
|
+ adapter = pagerAdapter
|
|
|
+ }.lparams(matchParent, autoSize(2000))
|
|
|
+
|
|
|
+ segment.setupWithViewPager(viewPager)
|
|
|
+ segment.selectTab(selectedTabIndex)
|
|
|
+ }
|
|
|
+ }.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)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// }.lparams(matchParent, matchParent)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.view
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 公告
|
|
|
+ */
|
|
|
+class QhjAnnouncementUI(private val baseFragment: Fragment, private val viewModule: QhjHomeViewModel) {
|
|
|
+
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ private val announcementAdapter: BaseAdapter<NoticeData, QhjAnnouncementViewHolder> =
|
|
|
+ BaseAdapter { _, _ -> QhjAnnouncementViewHolder(baseFragment, viewModule) }
|
|
|
+
|
|
|
+ val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
+ verticalLayout {
|
|
|
+ viewModule.queryNotice()
|
|
|
+ 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 = announcementAdapter
|
|
|
+ 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.noticeDataList.bindOptional(context) {
|
|
|
+ announcementAdapter.setNewData(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 研报
|
|
|
+ */
|
|
|
+class QhjResearchReportUI(
|
|
|
+ private val baseFragment: Fragment,
|
|
|
+ private val viewModule: QhjHomeViewModel
|
|
|
+) {
|
|
|
+ val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
+ verticalLayout {
|
|
|
+ textView {
|
|
|
+ text = "研报"
|
|
|
+ textColorInt = R.color.black
|
|
|
+ textSizeAuto = 100
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
+ topMargin = autoSize(200)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 咨讯
|
|
|
+ */
|
|
|
+
|
|
|
+class QhjInformationUI(private val baseFragment: Fragment, private val viewModule: QhjHomeViewModel) {
|
|
|
+ val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
+ verticalLayout {
|
|
|
+ textView {
|
|
|
+ text = "资讯"
|
|
|
+ textColorInt = R.color.black
|
|
|
+ textSizeAuto = 100
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
+ topMargin = autoSize(200)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|