feat: opt ui
This commit is contained in:
@@ -4,6 +4,10 @@ import android.view.View
|
||||
import com.lukouguoji.gjc.databinding.ItemIntExpMoveBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.GjcMove
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* 国际出港移库列表项ViewHolder
|
||||
@@ -16,10 +20,15 @@ class IntExpMoveViewHolder(view: View) :
|
||||
binding.bean = bean
|
||||
binding.position = position
|
||||
|
||||
// 点击整个item切换选中状态
|
||||
binding.root.setOnClickListener {
|
||||
bean.isSelected = !bean.isSelected
|
||||
binding.bean = bean // 触发DataBinding更新
|
||||
// 添加图标点击事件 - 切换选择状态
|
||||
binding.ivIcon.setOnClickListener {
|
||||
bean.checked.set(!bean.checked.get()) // 反转选择状态
|
||||
binding.executePendingBindings() // 立即刷新UI
|
||||
|
||||
// 发送事件通知Activity更新全选状态
|
||||
GlobalScope.launch {
|
||||
FlowBus.with<String>(ConstantEvent.EVENT_CHECK_CHANGED).emit("check_changed")
|
||||
}
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
|
||||
Reference in New Issue
Block a user