Mandy Melnyk has been working in the radiology field since 2016. Mandy began their career at Aris Radiology as the Director of Operations and Customer Relations, where they were responsible for supervising and enhancing the work of multiple teams within the organization, while also meeting all client, physician, and internal needs and goals. In 2020, they joined Direct Radiology as an Implementation Manager.
package com.example.mvvm_tmdb.ui.movie
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.example.mvvm_tmdb.R
import com.example.mvvm_tmdb.databinding.ItemMovieBinding
import com.example.mvvm_tmdb.model.api.Movie
import com.example.mvvm_tmdb.ui.base.BaseViewHolder
class MovieAdapter(private val movieList : ArrayList<Movie>) : RecyclerView.Adapter<BaseViewHolder>(){
private lateinit var listener : MovieAdapterListener
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val binding : ItemMovieBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.context),
R.layout.item_movie, parent, false)
return MovieViewHolder(binding)
}
override fun getItemCount(): Int = movieList.size
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
holder.onBind(position)
}
fun setListener(listener: MovieAdapterListener){
this.listener = listener
}
inner class MovieViewHolder(private val binding : ItemMovieBinding) : BaseViewHolder(binding.root),
MovieItemViewModel.MovieItemViewModelListener{
private lateinit var viewModel : MovieItemViewModel
override fun onBind(position: Int) {
val movie = movieList[position]
viewModel = MovieItemViewModel(movie, this)
binding.viewModel = viewModel
binding.executePendingBindings()
}
override fun onItemClick(movie: Movie) {
listener.onItemClick(movie)
}
}
interface MovieAdapterListener{
fun onItemClick(movie : Movie)
Sign up to view 2 direct reports
Get started