|
|
|
@ -14,7 +14,9 @@ import fr.iut.pm.movieapplication.ui.adapter.HomeItemAdapter
|
|
|
|
|
import fr.iut.pm.movieapplication.ui.adapter.HomeItemDecoration
|
|
|
|
|
import fr.iut.pm.movieapplication.ui.viewmodel.HomeSectionsVM
|
|
|
|
|
|
|
|
|
|
class HomeSectionsFragment(private val context : MainActivity) : Fragment() {
|
|
|
|
|
class HomeSectionsFragment(
|
|
|
|
|
private val context : MainActivity
|
|
|
|
|
) : Fragment() {
|
|
|
|
|
|
|
|
|
|
private lateinit var homeSectionsViewModel : HomeSectionsVM
|
|
|
|
|
|
|
|
|
@ -22,15 +24,18 @@ class HomeSectionsFragment(private val context : MainActivity) : Fragment() {
|
|
|
|
|
val view = inflater.inflate(R.layout.fragment_home_sections, container, false)
|
|
|
|
|
|
|
|
|
|
//get the trends RecyclerView
|
|
|
|
|
context.movieRepository.getTrends {
|
|
|
|
|
val homeTrendsRecyclerView = view?.findViewById<RecyclerView>(R.id.home_trends_recycler_view)
|
|
|
|
|
homeTrendsRecyclerView?.adapter = HomeItemAdapter(context,R.layout.item_horizontal_home_page,ArrayList<Movie>())
|
|
|
|
|
homeTrendsRecyclerView?.adapter = HomeItemAdapter(context,R.layout.item_horizontal_home_page,it)
|
|
|
|
|
homeTrendsRecyclerView?.addItemDecoration(HomeItemDecoration())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the popularity RecyclerView
|
|
|
|
|
context.movieRepository.getPopularMovies {
|
|
|
|
|
val homePopularityRecyclerView = view?.findViewById<RecyclerView>(R.id.home_popularity_recycler_view)
|
|
|
|
|
homePopularityRecyclerView?.adapter = HomeItemAdapter(context,R.layout.item_horizontal_home_page,ArrayList<Movie>())
|
|
|
|
|
homePopularityRecyclerView?.adapter = HomeItemAdapter(context,R.layout.item_horizontal_home_page,it)
|
|
|
|
|
homePopularityRecyclerView?.addItemDecoration(HomeItemDecoration())
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//get the free RecyclerView
|
|
|
|
|
val homeFreeRecyclerView = view?.findViewById<RecyclerView>(R.id.home_free_recycler_view)
|
|
|
|
|
homeFreeRecyclerView?.adapter = HomeItemAdapter(context,R.layout.item_horizontal_home_page,ArrayList())
|
|
|
|
|