切换家庭联动
This commit is contained in:
@@ -9,12 +9,18 @@ import com.example.defenseapplication.databinding.ItemSwitchFamilyBinding
|
||||
import com.example.defenseapplication.model.FamilyItem
|
||||
|
||||
class FamilySwitchAdapter(
|
||||
private val familyList: List<FamilyItem>,
|
||||
private var familyList: List<FamilyItem>,
|
||||
private val onItemClickListener: (FamilyItem) -> Unit
|
||||
) : RecyclerView.Adapter<FamilySwitchAdapter.FamilyViewHolder>() {
|
||||
|
||||
private var selectedPosition = 0
|
||||
|
||||
fun updateList(newList: List<FamilyItem>) {
|
||||
familyList = newList
|
||||
selectedPosition = 0
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FamilyViewHolder {
|
||||
val binding = ItemSwitchFamilyBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
|
||||
Reference in New Issue
Block a user