Open Gk160 opened 2 years ago
override fun onBindViewHolder(holder: ToDoViewHolder, position: Int) { val curToDo = todos[position] holder.itemView.apply { tvTodoTitle.text = curToDo.Title cbDone.isChecked = curToDo.isChecked toggleStrikeThrough(tvTodoTitle, curToDo.isChecked) cbDone.setOnCheckedChangeListener { _, isChecked -> toggleStrikeThrough(tvTodoTitle, isChecked) curToDo.isChecked = !curToDo.isChecked } }
override fun onBindViewHolder(holder: ToDoViewHolder, position: Int) { val curToDo = todos[position] holder.itemView.apply { tvTodoTitle.text = curToDo.Title cbDone.isChecked = curToDo.isChecked toggleStrikeThrough(tvTodoTitle, curToDo.isChecked) cbDone.setOnCheckedChangeListener { _, isChecked -> toggleStrikeThrough(tvTodoTitle, isChecked) curToDo.isChecked = !curToDo.isChecked } }