feat: io
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.lukouguoji.gjc.holder
|
||||
|
||||
import android.view.View
|
||||
import com.lukouguoji.gjc.databinding.ItemAssembleInfoBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.AssembleInfoBean
|
||||
|
||||
/**
|
||||
* 组装信息ViewHolder
|
||||
*/
|
||||
class AssembleInfoViewHolder(view: View) :
|
||||
BaseViewHolder<AssembleInfoBean, ItemAssembleInfoBinding>(view) {
|
||||
|
||||
override fun onBind(item: Any?, position: Int) {
|
||||
val bean = getItemBean(item) ?: return
|
||||
binding.bean = bean
|
||||
binding.position = position
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.lukouguoji.gjc.holder
|
||||
|
||||
import android.view.View
|
||||
import com.lukouguoji.gjc.databinding.ItemAssemblePositionBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.AssemblePositionBean
|
||||
|
||||
/**
|
||||
* 组装位置ViewHolder
|
||||
*/
|
||||
class AssemblePositionViewHolder(view: View) :
|
||||
BaseViewHolder<AssemblePositionBean, ItemAssemblePositionBinding>(view) {
|
||||
|
||||
override fun onBind(item: Any?, position: Int) {
|
||||
val bean = getItemBean(item) ?: return
|
||||
binding.bean = bean
|
||||
binding.position = position
|
||||
|
||||
// 点击选择位置
|
||||
itemView.setOnClickListener {
|
||||
clickListener?.onItemClick(position, 0)
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.lukouguoji.gjc.holder
|
||||
|
||||
import android.view.View
|
||||
import com.lukouguoji.gjc.databinding.ItemAssembleWaybillBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.AssembleWaybillBean
|
||||
|
||||
/**
|
||||
* 运单列表ViewHolder
|
||||
*/
|
||||
class AssembleWaybillViewHolder(view: View) :
|
||||
BaseViewHolder<AssembleWaybillBean, ItemAssembleWaybillBinding>(view) {
|
||||
|
||||
override fun onBind(item: Any?, position: Int) {
|
||||
val bean = getItemBean(item) ?: return
|
||||
binding.bean = bean
|
||||
binding.position = position
|
||||
|
||||
// 点击运单
|
||||
itemView.setOnClickListener {
|
||||
clickListener?.onItemClick(position, 0)
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,12 @@ class IntExpAssembleViewHolder(view: View) :
|
||||
// 更新展开状态(初次绑定不需要动画)
|
||||
updateExpandState(bean, animate = false)
|
||||
|
||||
// 点击整个item切换选中状态
|
||||
binding.root.setOnClickListener {
|
||||
bean.isSelected = !bean.isSelected
|
||||
binding.bean = bean // 触发DataBinding更新
|
||||
}
|
||||
|
||||
// 展开按钮点击事件
|
||||
binding.btnExpand.setOnClickListener {
|
||||
clickListener?.onItemClick(position, 1000) // type=1000表示展开操作
|
||||
|
||||
Reference in New Issue
Block a user