|
|
@ -9,6 +9,7 @@ import android.view.ViewGroup
|
|
|
|
import android.widget.Button
|
|
|
|
import android.widget.Button
|
|
|
|
import androidx.fragment.app.viewModels
|
|
|
|
import androidx.fragment.app.viewModels
|
|
|
|
import android.widget.LinearLayout
|
|
|
|
import android.widget.LinearLayout
|
|
|
|
|
|
|
|
import androidx.fragment.app.activityViewModels
|
|
|
|
import androidx.navigation.fragment.findNavController
|
|
|
|
import androidx.navigation.fragment.findNavController
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
@ -16,8 +17,10 @@ import fr.iut.cinecool.adapter.MovieAdapter
|
|
|
|
import fr.iut.cinecool.databinding.FragmentMoviesBinding
|
|
|
|
import fr.iut.cinecool.databinding.FragmentMoviesBinding
|
|
|
|
import fr.iut.cinecool.model.Movie
|
|
|
|
import fr.iut.cinecool.model.Movie
|
|
|
|
import fr.iut.cinecool.model.Stub
|
|
|
|
import fr.iut.cinecool.model.Stub
|
|
|
|
|
|
|
|
import fr.iut.cinecool.model.cineViewModel
|
|
|
|
|
|
|
|
|
|
|
|
class MoviesFragment : Fragment() {
|
|
|
|
class MoviesFragment : Fragment() {
|
|
|
|
|
|
|
|
private val sharedViewModel: cineViewModel by activityViewModels()
|
|
|
|
|
|
|
|
|
|
|
|
private var _binding: FragmentMoviesBinding? = null
|
|
|
|
private var _binding: FragmentMoviesBinding? = null
|
|
|
|
private val binding get() = _binding!!
|
|
|
|
private val binding get() = _binding!!
|
|
|
@ -31,7 +34,6 @@ class MoviesFragment : Fragment() {
|
|
|
|
): View? {
|
|
|
|
): View? {
|
|
|
|
_binding = FragmentMoviesBinding.inflate(inflater, container, false)
|
|
|
|
_binding = FragmentMoviesBinding.inflate(inflater, container, false)
|
|
|
|
return binding.root
|
|
|
|
return binding.root
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
@ -60,10 +62,14 @@ class MoviesFragment : Fragment() {
|
|
|
|
movieAdapter = MovieAdapter(ArrayList())
|
|
|
|
movieAdapter = MovieAdapter(ArrayList())
|
|
|
|
binding.recyclerMovie.adapter = movieAdapter
|
|
|
|
binding.recyclerMovie.adapter = movieAdapter
|
|
|
|
movieAdapter.onItemClick = {
|
|
|
|
movieAdapter.onItemClick = {
|
|
|
|
val fragment = SessionFragment()
|
|
|
|
/*val fragment = SessionFragment()
|
|
|
|
val myBundle = Bundle()
|
|
|
|
fragment.arguments = Bundle().apply {
|
|
|
|
myBundle.putParcelable("movie",it)
|
|
|
|
putParcelable("movie",it)
|
|
|
|
fragment.arguments=myBundle
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sharedViewModel.setCine(it)
|
|
|
|
|
|
|
|
|
|
|
|
findNavController().navigate(R.id.movies_to_sessions)
|
|
|
|
findNavController().navigate(R.id.movies_to_sessions)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|