diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/model/Movie.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/model/Movie.kt index 96b8b59..6269f00 100644 --- a/Sources/app/src/main/java/fr/iut/pm/movieapplication/model/Movie.kt +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/model/Movie.kt @@ -10,41 +10,45 @@ import java.util.Date @Entity(tableName = "movies_table") data class Movie( @ColumnInfo(name = "adult") - var adult: Boolean, + val adult: Boolean, @ColumnInfo(name = "budget") - var budget: Int, + val budget: Int, @ColumnInfo(name = "genres") - var genres: Array, + val genres: Array, @ColumnInfo(name = "homepage") - var homePage: String?, + val homePage: String?, @PrimaryKey @ColumnInfo(name = "id") - var movieId: Int, + val movieId: Int, @ColumnInfo(name = "original_language") - var originalLanguage: String, + val originalLanguage: String, @ColumnInfo(name = "original_title") - var originalTitle: String, - var overview: String?, - var popularity: Int, - //var posterPath : String?, + val originalTitle: String, + val overview: String?, + val popularity: Int, + @ColumnInfo(name = "poster_path") + val posterPath : String?, @Embedded - var productionCompanies: Array, + val productionCompanies: Array, @Relation( parentColumn = "movieId", entityColumn = "" ) - var productionCountries: Array, - var releaseDate: Date, - var revenue: Int, - var runtime: Int?, + @ColumnInfo(name = "production_countries") + val productionCountries: Array, + @ColumnInfo(name = "release_date") + val releaseDate: Date, + val revenue: Int, + val runtime: Int?, //var spokenLanguages : Array, - var status: String, - var tagLine: String?, - var title: String, + val status: String, + @ColumnInfo(name = "tag_line") + val tagLine: String?, + val title: String, @ColumnInfo(name = "vote_average") - var voteAverage: Number, + val voteAverage: Number, @ColumnInfo(name = "vote_count") - var voteCount : Int + val voteCount : Int ) { diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/activity/MainActivity.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/activity/MainActivity.kt index 29ec867..9214665 100644 --- a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/activity/MainActivity.kt +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/activity/MainActivity.kt @@ -2,11 +2,22 @@ package fr.iut.pm.movieapplication.ui.activity import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import com.google.android.material.bottomnavigation.BottomNavigationView import fr.iut.pm.movieapplication.R +import fr.iut.pm.movieapplication.ui.fragments.HomeSectionsFragment class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + + //Trends fragment injected in main activity + val transaction = supportFragmentManager.beginTransaction() + transaction.replace(R.id.trends_section_container, HomeSectionsFragment()) + transaction.addToBackStack(null) + transaction.commit() + + //val bottomNavigationView = findViewById(R.id.navigation_view) + } } \ No newline at end of file diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemAdapter.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemAdapter.kt new file mode 100644 index 0000000..b2c3ef3 --- /dev/null +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemAdapter.kt @@ -0,0 +1,25 @@ +package fr.iut.pm.movieapplication.ui.adapter + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import androidx.recyclerview.widget.RecyclerView +import fr.iut.pm.movieapplication.R + +class HomeItemAdapter(private val layoutId : Int) : RecyclerView.Adapter() { + + class ViewHolder(view : View) : RecyclerView.ViewHolder(view) { + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val view = LayoutInflater + .from(parent.context) + .inflate(R.layout.item_horizontal_home_page, parent, false) + return ViewHolder(view) + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) {} + + override fun getItemCount(): Int = 5 +} \ No newline at end of file diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemDecoration.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemDecoration.kt new file mode 100644 index 0000000..88d2ba3 --- /dev/null +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/adapter/HomeItemDecoration.kt @@ -0,0 +1,12 @@ +package fr.iut.pm.movieapplication.ui.adapter + +import android.graphics.Rect +import android.view.View +import androidx.recyclerview.widget.RecyclerView + +class HomeItemDecoration : RecyclerView.ItemDecoration() { + + override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { + outRect.left = 20 + } +} \ No newline at end of file diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/HomeSectionsFragment.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/HomeSectionsFragment.kt new file mode 100644 index 0000000..ebcb9f5 --- /dev/null +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/HomeSectionsFragment.kt @@ -0,0 +1,34 @@ +package fr.iut.pm.movieapplication.ui.fragments + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.RecyclerView +import fr.iut.pm.movieapplication.R +import fr.iut.pm.movieapplication.ui.adapter.HomeItemAdapter +import fr.iut.pm.movieapplication.ui.adapter.HomeItemDecoration + +class HomeSectionsFragment : Fragment() { + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + val view = inflater.inflate(R.layout.fragment_home_sections, container, false) + + //get the trends RecyclerView + val homeTrendsRecyclerView = view?.findViewById(R.id.home_trends_recycler_view) + homeTrendsRecyclerView?.adapter = HomeItemAdapter(R.layout.item_horizontal_home_page) + homeTrendsRecyclerView?.addItemDecoration(HomeItemDecoration()) + + //get the popularity RecyclerView + val homePopularityRecyclerView = view?.findViewById(R.id.home_popularity_recycler_view) + homePopularityRecyclerView?.adapter = HomeItemAdapter(R.layout.item_horizontal_home_page) + homePopularityRecyclerView?.addItemDecoration(HomeItemDecoration()) + + //get the free RecyclerView + val homeFreeRecyclerView = view?.findViewById(R.id.home_free_recycler_view) + homeFreeRecyclerView?.adapter = HomeItemAdapter(R.layout.item_horizontal_home_page) + homeFreeRecyclerView?.addItemDecoration(HomeItemDecoration()) + return view + } +} \ No newline at end of file diff --git a/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/MoviesFragment.kt b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/MoviesFragment.kt new file mode 100644 index 0000000..66eb838 --- /dev/null +++ b/Sources/app/src/main/java/fr/iut/pm/movieapplication/ui/fragments/MoviesFragment.kt @@ -0,0 +1,26 @@ +package fr.iut.pm.movieapplication.ui.fragments + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.RecyclerView +import fr.iut.pm.movieapplication.R +import fr.iut.pm.movieapplication.ui.adapter.HomeItemAdapter +import fr.iut.pm.movieapplication.ui.adapter.HomeItemDecoration + +class MoviesFragment : Fragment() { + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + val view = inflater.inflate(R.layout.fragment_movies, container, false) + + //get the recycler view + val moviesRecyclerView = view?.findViewById(R.id.movies_item_recycler_view) + moviesRecyclerView?.adapter = HomeItemAdapter(R.layout.item_vertical_fragment) + moviesRecyclerView?.addItemDecoration(HomeItemDecoration()) + + + return view + } +} \ No newline at end of file diff --git a/Sources/app/src/main/res/drawable/ic_baseline_star_border_24.xml b/Sources/app/src/main/res/drawable/ic_baseline_star_border_24.xml new file mode 100644 index 0000000..59aef55 --- /dev/null +++ b/Sources/app/src/main/res/drawable/ic_baseline_star_border_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/Sources/app/src/main/res/drawable/ic_home.xml b/Sources/app/src/main/res/drawable/ic_home.xml new file mode 100644 index 0000000..5a870f5 --- /dev/null +++ b/Sources/app/src/main/res/drawable/ic_home.xml @@ -0,0 +1,5 @@ + + + diff --git a/Sources/app/src/main/res/drawable/ic_movie.xml b/Sources/app/src/main/res/drawable/ic_movie.xml new file mode 100644 index 0000000..a0e2d16 --- /dev/null +++ b/Sources/app/src/main/res/drawable/ic_movie.xml @@ -0,0 +1,5 @@ + + + diff --git a/Sources/app/src/main/res/drawable/ic_tv_shows.xml b/Sources/app/src/main/res/drawable/ic_tv_shows.xml new file mode 100644 index 0000000..cdd0f67 --- /dev/null +++ b/Sources/app/src/main/res/drawable/ic_tv_shows.xml @@ -0,0 +1,5 @@ + + + diff --git a/Sources/app/src/main/res/layout/activity_main.xml b/Sources/app/src/main/res/layout/activity_main.xml index fef6e47..1c12462 100644 --- a/Sources/app/src/main/res/layout/activity_main.xml +++ b/Sources/app/src/main/res/layout/activity_main.xml @@ -2,21 +2,57 @@ + + + + + + + + + + app:menu="@menu/bottom_navigation_menu" + /> \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/fragment_home_sections.xml b/Sources/app/src/main/res/layout/fragment_home_sections.xml new file mode 100644 index 0000000..6c2afed --- /dev/null +++ b/Sources/app/src/main/res/layout/fragment_home_sections.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/fragment_movies.xml b/Sources/app/src/main/res/layout/fragment_movies.xml new file mode 100644 index 0000000..c6f31e4 --- /dev/null +++ b/Sources/app/src/main/res/layout/fragment_movies.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/item_horizontal_home_page.xml b/Sources/app/src/main/res/layout/item_horizontal_home_page.xml new file mode 100644 index 0000000..d7dc465 --- /dev/null +++ b/Sources/app/src/main/res/layout/item_horizontal_home_page.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/item_vertical_fragment.xml b/Sources/app/src/main/res/layout/item_vertical_fragment.xml new file mode 100644 index 0000000..00ff925 --- /dev/null +++ b/Sources/app/src/main/res/layout/item_vertical_fragment.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/app/src/main/res/menu/bottom_navigation_menu.xml b/Sources/app/src/main/res/menu/bottom_navigation_menu.xml new file mode 100644 index 0000000..675901b --- /dev/null +++ b/Sources/app/src/main/res/menu/bottom_navigation_menu.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/Sources/app/src/main/res/values/strings.xml b/Sources/app/src/main/res/values/strings.xml index debac46..059d1c4 100644 --- a/Sources/app/src/main/res/values/strings.xml +++ b/Sources/app/src/main/res/values/strings.xml @@ -1,3 +1,17 @@ Movie Application + + Accueil + Films + Séries + Artistes + + + Bienvenue + Des millions de films, émissions télévisées et artistes… + Tendances + Populaires + Gratuits + section_nested_scroll_view + \ No newline at end of file