package com.danilafe.fencelessgrazing import android.view.View import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.danilafe.fencelessgrazing.model.CollarSummary class CollarViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { private val nameView: TextView = itemView.findViewById(R.id.collarSummaryName) private val positionView: TextView = itemView.findViewById(R.id.collarSummaryPos) fun bindData(summary: CollarSummary, collarClickListener: CollarClickListener) { nameView.text = summary.name positionView.text = nameView.resources.getString(R.string.collarSummaryLocation, summary.pos.longitude.toDouble(), summary.pos.latitude.toDouble()) itemView.setOnClickListener { collarClickListener.onCollarClick(summary) } } }