diff --git a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcMaWb.kt b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcMaWb.kt index bc558e2..0c55d98 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcMaWb.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcMaWb.kt @@ -111,6 +111,7 @@ data class GjcMaWb( ) { // ==================== UI扩展字段 ==================== val checked: ObservableBoolean = ObservableBoolean(false) // 选中状态 + val showMore: ObservableBoolean = ObservableBoolean(false) // 展开状态 // 兼容现有API的isSelected属性 var isSelected: Boolean diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallySubViewHolder.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallySubViewHolder.kt new file mode 100644 index 0000000..ab4f946 --- /dev/null +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallySubViewHolder.kt @@ -0,0 +1,26 @@ +package com.lukouguoji.gjc.holder + +import android.view.View +import com.lukouguoji.gjc.databinding.ItemIntExpTallySubBinding +import com.lukouguoji.module_base.base.BaseViewHolder +import com.lukouguoji.module_base.bean.GjcHaWb + +/** + * 国际出港-出港理货 子订单(分单) ViewHolder + */ +class IntExpTallySubViewHolder(view: View) : + BaseViewHolder(view) { + + override fun onBind(item: Any?, position: Int) { + val bean = getItemBean(item) ?: return + binding.bean = bean + binding.position = position + 1 // 序号从 1 开始 + binding.executePendingBindings() + + // checkbox点击切换选择状态 + binding.ivCheckbox.setOnClickListener { + bean.checked.set(!bean.checked.get()) + binding.executePendingBindings() + } + } +} diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallyViewHolder.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallyViewHolder.kt index a45ccd7..60f7324 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallyViewHolder.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/holder/IntExpTallyViewHolder.kt @@ -1,9 +1,12 @@ package com.lukouguoji.gjc.holder import android.view.View +import com.lukouguoji.gjc.R import com.lukouguoji.gjc.databinding.ItemIntExpTallyBinding +import com.lukouguoji.module_base.adapter.setCommonAdapter import com.lukouguoji.module_base.base.BaseViewHolder import com.lukouguoji.module_base.bean.GjcMaWb +import com.lukouguoji.module_base.ktx.refresh /** * 国际出港-出港理货 ViewHolder @@ -17,10 +20,25 @@ class IntExpTallyViewHolder(view: View) : binding.position = position binding.executePendingBindings() - // 图标点击切换选择状态 + // 图标点击切换选择状态(保留原有) binding.ivIcon.setOnClickListener { bean.checked.set(!bean.checked.get()) binding.executePendingBindings() } + + // ========== 新增:展开按钮点击事件 ========== + binding.ivShow.setOnClickListener { + bean.showMore.set(!bean.showMore.get()) + } + + // ========== 新增:初始化子列表 RecyclerView ========== + setCommonAdapter( + binding.rvSub, + IntExpTallySubViewHolder::class.java, + R.layout.item_int_exp_tally_sub + ) + + // 刷新子列表数据 + binding.rvSub.refresh(bean.haWbList ?: emptyList()) } } diff --git a/module_gjc/src/main/res/layout/item_int_exp_tally.xml b/module_gjc/src/main/res/layout/item_int_exp_tally.xml index 620f92b..a5e1738 100644 --- a/module_gjc/src/main/res/layout/item_int_exp_tally.xml +++ b/module_gjc/src/main/res/layout/item_int_exp_tally.xml @@ -1,304 +1,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + diff --git a/module_gjc/src/main/res/layout/item_int_exp_tally_sub.xml b/module_gjc/src/main/res/layout/item_int_exp_tally_sub.xml new file mode 100644 index 0000000..788b9bb --- /dev/null +++ b/module_gjc/src/main/res/layout/item_int_exp_tally_sub.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +