|
|
@@ -1,13 +1,17 @@
|
|
|
package cn.muchinfo.rma.view.base.home.contract
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.content.Intent
|
|
|
import android.content.res.Configuration
|
|
|
import android.content.res.Configuration.ORIENTATION_LANDSCAPE
|
|
|
import android.os.Bundle
|
|
|
import android.view.Gravity
|
|
|
+import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
import cn.muchinfo.rma.R
|
|
|
@@ -16,8 +20,13 @@ import cn.muchinfo.rma.global.data.ContractData
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
+import cn.muchinfo.rma.view.base.app.Constant
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.adapter.ContractAdapter
|
|
|
+import cn.muchinfo.rma.view.base.procurement.ContentAdapter
|
|
|
+import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
|
|
|
import com.blankj.utilcode.util.ActivityUtils
|
|
|
import com.blankj.utilcode.util.ConvertUtils
|
|
|
+import com.blankj.utilcode.util.SizeUtils
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
@@ -253,56 +262,144 @@ class ContractActivity : BaseActivity<ContractViewModel>() {
|
|
|
class UnSubmitUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: ContractViewModel
|
|
|
-) {
|
|
|
-
|
|
|
+) : ContractAdapter.OnContentScrollListener {
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
|
|
|
- private val unSubmitAdapter: BaseAdapter<ContractData, ContractDataViewHolder> = BaseAdapter { _, _ -> ContractDataViewHolder(activity, viewModel,"1") }
|
|
|
+ val contractAdapter by lazy {
|
|
|
+ ContractAdapter(activity,"1",viewModel)
|
|
|
+ }
|
|
|
|
|
|
+ @SuppressLint("RtlHardcoded")
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
- viewModel.queryContract(QueryType = "1")
|
|
|
- creatContractHeadUI()
|
|
|
-
|
|
|
- view {
|
|
|
- background = resources.getDrawable(R.color.line_hint_color)
|
|
|
- }.lparams(matchParent, autoSize(1))
|
|
|
+ viewModel.queryTitle(Constant.table_mobile_spotcontract,"1")
|
|
|
+ contractAdapter.setOnContentScrollListener(this@UnSubmitUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.unSubmitTitle.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ contractAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.unSubmitTitle.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
statusLayout(contentBlock = {
|
|
|
statusLayout = this
|
|
|
+ setRetryAction {
|
|
|
+ viewModel.queryContract("1")
|
|
|
+ }
|
|
|
// bindTaskStatus(viewModule.status)
|
|
|
swipeToLoadLayout {
|
|
|
swipeToLayout = this
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContract(QueryType = "1")
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ * contracttype 1-采购, -1-销售
|
|
|
+ * type 1-全部 2-待点价 3-履约结算
|
|
|
+ */
|
|
|
+ viewModel.queryContract("1")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
recyclerView {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
- adapter = unSubmitAdapter
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
+ adapter = contractAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ contractAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}, emptyBlock = {
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- viewModel.unSubmitList.bindOptional(context){
|
|
|
- if (it?.isEmpty() == true || it?.size == 0){
|
|
|
+ viewModel.unSubmitList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
statusLayout.showEmpty()
|
|
|
- }else {
|
|
|
- if (swipeToLayout.getIsRefreshing()){
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
swipeToLayout.finishRefresh()
|
|
|
+// mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
|
|
|
}
|
|
|
statusLayout.showSuccess()
|
|
|
- unSubmitAdapter.setNewData(it)
|
|
|
+ contractAdapter.setDatas(it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -312,56 +409,142 @@ class UnSubmitUI(
|
|
|
class ToAuditUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: ContractViewModel
|
|
|
-) {
|
|
|
-
|
|
|
+) : ContractAdapter.OnContentScrollListener {
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
|
|
|
- private val unSubmitAdapter: BaseAdapter<ContractData, ContractDataViewHolder> = BaseAdapter { _, _ -> ContractDataViewHolder(activity, viewModel,"2") }
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val contractAdapter by lazy {
|
|
|
+ ContractAdapter(activity,"1",viewModel)
|
|
|
+ }
|
|
|
|
|
|
+ @SuppressLint("RtlHardcoded")
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
- viewModel.queryContract(QueryType = "2")
|
|
|
- creatContractHeadUI()
|
|
|
-
|
|
|
- view {
|
|
|
- background = resources.getDrawable(R.color.line_hint_color)
|
|
|
- }.lparams(matchParent, autoSize(1))
|
|
|
+ viewModel.queryTitle(Constant.table_mobile_spotcontract,"2")
|
|
|
+ contractAdapter.setOnContentScrollListener(this@ToAuditUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.toAuditTitle.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ contractAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.toAuditTitle.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
statusLayout(contentBlock = {
|
|
|
statusLayout = this
|
|
|
+ setRetryAction {
|
|
|
+ viewModel.queryContract("2")
|
|
|
+ }
|
|
|
// bindTaskStatus(viewModule.status)
|
|
|
swipeToLoadLayout {
|
|
|
swipeToLayout = this
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContract(QueryType = "2")
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryContract("2")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
recyclerView {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
- adapter = unSubmitAdapter
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
+ adapter = contractAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ contractAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}, emptyBlock = {
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- viewModel.toAuditList.bindOptional(context){
|
|
|
- if (it?.isEmpty() == true || it?.size == 0){
|
|
|
+ viewModel.toAuditList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
statusLayout.showEmpty()
|
|
|
- }else {
|
|
|
- if (swipeToLayout.getIsRefreshing()){
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
swipeToLayout.finishRefresh()
|
|
|
+// mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
|
|
|
}
|
|
|
statusLayout.showSuccess()
|
|
|
- unSubmitAdapter.setNewData(it)
|
|
|
+ contractAdapter.setDatas(it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -370,56 +553,142 @@ class ToAuditUI(
|
|
|
class PerformanceUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: ContractViewModel
|
|
|
-) {
|
|
|
-
|
|
|
+) : ContractAdapter.OnContentScrollListener {
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
|
|
|
- private val unSubmitAdapter: BaseAdapter<ContractData, ContractDataViewHolder> = BaseAdapter { _, _ -> ContractDataViewHolder(activity, viewModel,"3") }
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val contractAdapter by lazy {
|
|
|
+ ContractAdapter(activity,"1",viewModel)
|
|
|
+ }
|
|
|
|
|
|
+ @SuppressLint("RtlHardcoded")
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
- viewModel.queryContract(QueryType = "3")
|
|
|
- creatContractHeadUI()
|
|
|
-
|
|
|
- view {
|
|
|
- background = resources.getDrawable(R.color.line_hint_color)
|
|
|
- }.lparams(matchParent, autoSize(1))
|
|
|
+ viewModel.queryTitle(Constant.table_mobile_spotcontract,"3")
|
|
|
+ contractAdapter.setOnContentScrollListener(this@PerformanceUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.performanceTitle.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ contractAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.performanceTitle.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
statusLayout(contentBlock = {
|
|
|
statusLayout = this
|
|
|
+ setRetryAction {
|
|
|
+ viewModel.queryContract("3")
|
|
|
+ }
|
|
|
// bindTaskStatus(viewModule.status)
|
|
|
swipeToLoadLayout {
|
|
|
swipeToLayout = this
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContract(QueryType = "3")
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryContract("3")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
recyclerView {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
- adapter = unSubmitAdapter
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
+ adapter = contractAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ contractAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}, emptyBlock = {
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- viewModel.performanceList.bindOptional(context){
|
|
|
- if (it?.isEmpty() == true || it?.size == 0){
|
|
|
+ viewModel.performanceList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
statusLayout.showEmpty()
|
|
|
- }else {
|
|
|
- if (swipeToLayout.getIsRefreshing()){
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
swipeToLayout.finishRefresh()
|
|
|
+// mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
|
|
|
}
|
|
|
statusLayout.showSuccess()
|
|
|
- unSubmitAdapter.setNewData(it)
|
|
|
+ contractAdapter.setDatas(it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -428,58 +697,143 @@ class PerformanceUI(
|
|
|
class FinishUI(
|
|
|
private val activity: AppCompatActivity,
|
|
|
private val viewModel: ContractViewModel
|
|
|
-){
|
|
|
-
|
|
|
+) : ContractAdapter.OnContentScrollListener {
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
|
|
|
- private val unSubmitAdapter: BaseAdapter<ContractData, ContractDataViewHolder> = BaseAdapter { _, _ -> ContractDataViewHolder(activity, viewModel,"4") }
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val contractAdapter by lazy {
|
|
|
+ ContractAdapter(activity,"1",viewModel)
|
|
|
+ }
|
|
|
|
|
|
+ @SuppressLint("RtlHardcoded")
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
- viewModel.queryContract(QueryType = "4")
|
|
|
- creatContractHeadUI()
|
|
|
-
|
|
|
- view {
|
|
|
- background = resources.getDrawable(R.color.line_hint_color)
|
|
|
- }.lparams(matchParent, autoSize(1))
|
|
|
+ viewModel.queryTitle(Constant.table_mobile_spotcontract,"4")
|
|
|
+ contractAdapter.setOnContentScrollListener(this@FinishUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.finishTitle.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(SizeUtils.dp2px(135f)), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ contractAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.finishTitle.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
statusLayout(contentBlock = {
|
|
|
statusLayout = this
|
|
|
+ setRetryAction {
|
|
|
+ viewModel.queryContract("4")
|
|
|
+ }
|
|
|
// bindTaskStatus(viewModule.status)
|
|
|
swipeToLoadLayout {
|
|
|
swipeToLayout = this
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContract(QueryType = "4")
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryContract("4")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
recyclerView {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
- adapter = unSubmitAdapter
|
|
|
- }.lparams(matchParent, matchParent)
|
|
|
+ adapter = contractAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ContractAdapter.ItemViewHolder> =
|
|
|
+ contractAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].horItemScrollview.scrollTo(
|
|
|
+ contractAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}, emptyBlock = {
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- viewModel.finishList.bindOptional(context){
|
|
|
- if (it?.isEmpty() == true || it?.size == 0){
|
|
|
+ viewModel.finishList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
statusLayout.showEmpty()
|
|
|
- }else {
|
|
|
- if (swipeToLayout.getIsRefreshing()){
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
swipeToLayout.finishRefresh()
|
|
|
+// mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
|
|
|
}
|
|
|
statusLayout.showSuccess()
|
|
|
- unSubmitAdapter.setNewData(it)
|
|
|
+ contractAdapter.setDatas(it)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
+}
|
|
|
fun _LinearLayout.creatContractHeadUI(){
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|