|
@@ -28,6 +28,7 @@ import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.lifecycle.getAppCompatActivity
|
|
import cn.muchinfo.rma.lifecycle.getAppCompatActivity
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.base.BaseFragment
|
|
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.app.Constant
|
|
|
import cn.muchinfo.rma.view.base.future.trade.GoodsTradeActivity
|
|
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.accountmanager.AccountManagerActivity
|
|
@@ -83,6 +84,7 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
private val announcementUI: NewAnnouncementUI by lazy { NewAnnouncementUI(this, viewModel) }//公告
|
|
private val announcementUI: NewAnnouncementUI by lazy { NewAnnouncementUI(this, viewModel) }//公告
|
|
|
private val researchReportUI: NewResearchReportUI by lazy { NewResearchReportUI(this, viewModel) }//研报
|
|
private val researchReportUI: NewResearchReportUI by lazy { NewResearchReportUI(this, viewModel) }//研报
|
|
|
private val informationUI: NewInformationUI by lazy { NewInformationUI(this, viewModel) }//咨讯
|
|
private val informationUI: NewInformationUI by lazy { NewInformationUI(this, viewModel) }//咨讯
|
|
|
|
|
+ private val messageUI: MessageUI by lazy { MessageUI(this, viewModel) }//消息
|
|
|
|
|
|
|
|
|
|
|
|
|
val menuTab: MutableLiveData<Int> = MutableLiveData<Int>().apply { value = 0 }//用于控制菜单页切换后的点点显示
|
|
val menuTab: MutableLiveData<Int> = MutableLiveData<Int>().apply { value = 0 }//用于控制菜单页切换后的点点显示
|
|
@@ -142,28 +144,46 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
}
|
|
}
|
|
|
lateinit var userImage: ImageView
|
|
lateinit var userImage: ImageView
|
|
|
|
|
|
|
|
- private val tabsArray: List<String> by lazy { arrayListOf("公告", "研报", "资讯") }
|
|
|
|
|
|
|
|
|
|
- private val pagerAdapter: PagerAdapter by lazy {
|
|
|
|
|
- object : PagerAdapter() {
|
|
|
|
|
|
|
+ //viewpager的适配器
|
|
|
|
|
+ private var pagerAdapter : PagerAdapter? = null
|
|
|
|
|
+
|
|
|
|
|
+ //tabSegment标题
|
|
|
|
|
+ private val tabsArray : ArrayList<String> = arrayListOf()
|
|
|
|
|
+
|
|
|
|
|
+ //暂存的页面组
|
|
|
|
|
+ private val uiMessageList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ fun initMessageMenuData(){
|
|
|
|
|
+ if (GlobalDataCollection.instance?.getFirstLevelMenu("client_qhjbjb") == true){
|
|
|
|
|
+ tabsArray.add("资讯")
|
|
|
|
|
+ uiMessageList.add(informationUI.root)
|
|
|
|
|
+ tabsArray.add("公告")
|
|
|
|
|
+ uiMessageList.add(announcementUI.root)
|
|
|
|
|
+ tabsArray.add("消息")
|
|
|
|
|
+ uiMessageList.add(messageUI.root)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ tabsArray.add("公告")
|
|
|
|
|
+ uiMessageList.add(announcementUI.root)
|
|
|
|
|
+ tabsArray.add("资讯")
|
|
|
|
|
+ uiMessageList.add(informationUI.root)
|
|
|
|
|
+ tabsArray.add("研报")
|
|
|
|
|
+ uiMessageList.add(researchReportUI.root)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ pagerAdapter = object : PagerAdapter() {
|
|
|
|
|
|
|
|
override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
|
|
override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
|
|
|
|
|
|
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
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 uiMessageList.get(position).apply {
|
|
|
|
|
+ container.addView(
|
|
|
|
|
+ this,
|
|
|
|
|
+ ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
- return super.instantiateItem(container, position)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
@@ -175,6 +195,7 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
override fun getCount(): Int = tabsArray.size
|
|
override fun getCount(): Int = tabsArray.size
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onResume() {
|
|
override fun onResume() {
|
|
@@ -215,9 +236,8 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
savedInstanceState: Bundle?
|
|
savedInstanceState: Bundle?
|
|
|
): View? {
|
|
): View? {
|
|
|
return UI {
|
|
return UI {
|
|
|
- // FIXME: - test
|
|
|
|
|
-// viewModel.login()
|
|
|
|
|
initDataMenuTab()
|
|
initDataMenuTab()
|
|
|
|
|
+ initMessageMenuData()
|
|
|
viewModel.homeMenuTabList.postValue(GlobalDataCollection.instance?.homeMenuTabName)
|
|
viewModel.homeMenuTabList.postValue(GlobalDataCollection.instance?.homeMenuTabName)
|
|
|
viewModel.getBanner()
|
|
viewModel.getBanner()
|
|
|
|
|
|
|
@@ -243,7 +263,11 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
}
|
|
}
|
|
|
textView {
|
|
textView {
|
|
|
viewModel.loginQueryData.bindOptional(context) {
|
|
viewModel.loginQueryData.bindOptional(context) {
|
|
|
- text = it?.username + "(" + it?.loginAccount?.logincode + ")"
|
|
|
|
|
|
|
+ if (Constant.IS_QHJ){
|
|
|
|
|
+ text = "(" + it?.userInfo?.customername + ")"
|
|
|
|
|
+ }else{
|
|
|
|
|
+ text = it?.username + "(" + it?.loginAccount?.logincode + ")"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
textColorStr = "#AED6F0"
|
|
textColorStr = "#AED6F0"
|
|
|
textSizeAuto = 29
|
|
textSizeAuto = 29
|
|
@@ -309,7 +333,11 @@ class NewHomeFragment : BaseFragment<HomeViewModel>() {
|
|
|
}
|
|
}
|
|
|
setDelegate { banner, itemView, model, position ->
|
|
setDelegate { banner, itemView, model, position ->
|
|
|
val data = model as BannerData
|
|
val data = model as BannerData
|
|
|
- ToastUtils.showLong(data.url + "2-----")
|
|
|
|
|
|
|
+ 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() {
|
|
// setDelegate(new BGABanner.Delegate() {
|
|
|
// @Override
|
|
// @Override
|
|
@@ -531,6 +559,52 @@ class NewAnnouncementUI(private val baseFragment: Fragment, private val viewModu
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 消息
|
|
|
|
|
+ */
|
|
|
|
|
+class MessageUI(
|
|
|
|
|
+ private val baseFragment: Fragment,
|
|
|
|
|
+ private val viewModule: HomeViewModel
|
|
|
|
|
+){
|
|
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
|
|
+
|
|
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
|
|
+
|
|
|
|
|
+ private val announcementAdapter: BaseAdapter<NoticeData, AnnouncementViewHolder> =
|
|
|
|
|
+ BaseAdapter { _, _ -> AnnouncementViewHolder(baseFragment, viewModule) }
|
|
|
|
|
+
|
|
|
|
|
+ val root = _FrameLayout(baseFragment.context!!).apply {
|
|
|
|
|
+ verticalLayout {
|
|
|
|
|
+ viewModule.queryMessage()
|
|
|
|
|
+ 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.messageDataList.bindOptional(context) {
|
|
|
|
|
+ announcementAdapter.setNewData(it)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 研报
|
|
* 研报
|