package cz.muni.sutralog.ui.list

import android.net.Uri
import androidx.recyclerview.widget.RecyclerView
import cz.muni.sutralog.data.PhotoPresentableListItem
import cz.muni.sutralog.databinding.PhotoItemListBinding

class PhotoViewHolder(private val binding: PhotoItemListBinding)
    : RecyclerView.ViewHolder(binding.root) {

    fun bind(listItem: PhotoPresentableListItem,
             onItemClick: (PhotoPresentableListItem) -> Unit,
             onItemLongClick: (PhotoPresentableListItem) -> Boolean) {
        binding.rockImage.setImageURI(Uri.parse(listItem.path))
        binding.rockImage.setOnLongClickListener{
            onItemLongClick(listItem)
        }
        binding.rockImage.setOnClickListener {
            onItemClick(listItem)
        }
    }
}