first commit

This commit is contained in:
2026-03-03 01:25:13 +07:00
parent 826ab3a914
commit f585f6dca9
226 changed files with 11855 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
package com.amz.genie.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.amz.genie.R
import com.amz.genie.models.AttachmentItem
class AttachmentAdapter(
private val onRemove: (AttachmentItem) -> Unit
) : RecyclerView.Adapter<AttachmentAdapter.VH>() {
private val items = mutableListOf<AttachmentItem>()
fun submitList(newItems: List<AttachmentItem>) {
items.clear()
items.addAll(newItems)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_attachment_chip, parent, false)
return VH(view)
}
override fun onBindViewHolder(holder: VH, position: Int) {
holder.bind(items[position])
}
override fun getItemCount(): Int = items.size
inner class VH(itemView: View) : RecyclerView.ViewHolder(itemView) {
private val tvName: TextView = itemView.findViewById(R.id.tv_name_attachment_chip)
private val ibRemove: ImageButton = itemView.findViewById(R.id.ib_remove_attachment_chip)
fun bind(item: AttachmentItem) {
tvName.text = item.name
ibRemove.setOnClickListener { onRemove(item) }
}
}
}