出入库功能改版
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.sw.inbound.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.sw.inbound.R
|
||||
import com.sw.inbound.databinding.ListItemGoodsSearchBinding
|
||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||
import com.sw.inbound.utils.ext.dp
|
||||
import com.sw.inbound.utils.ext.setShapeDrawable
|
||||
|
||||
class GoodsSearchAdapter(var list: MutableList<SearchGoodsInfo.Record>) :
|
||||
BaseQuickAdapter<SearchGoodsInfo.Record, GoodsSearchAdapter.VH>(list) {
|
||||
|
||||
inner class VH(var binding: ListItemGoodsSearchBinding) : QuickViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val binding = ListItemGoodsSearchBinding.inflate(inflater, parent, false)
|
||||
return VH(binding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: VH, position: Int, item: SearchGoodsInfo.Record?) {
|
||||
holder.binding.let {
|
||||
it.tvGoodsName.run {
|
||||
text = item!!.goodsName
|
||||
setTextColor(if (item!!.isSelected) "#FF0032C8".toColorInt() else "#FF666666".toColorInt())
|
||||
}
|
||||
it.root.run {
|
||||
if (item!!.isSelected) {
|
||||
setShapeDrawable(
|
||||
solidColor = "#FFEAF0FF",
|
||||
strokeColor = "#FF0033CC",
|
||||
strokeWidth = 2.dp,
|
||||
radius = 10.dp
|
||||
)
|
||||
} else {
|
||||
setShapeDrawable(
|
||||
solidColor = "#FFF5F5F5",
|
||||
radius = 10.dp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user