pull/17/head
louwar 2 years ago
commit 71b72e9e8e

@ -9,14 +9,12 @@ android {
defaultConfig {
applicationId "fr.iut.cinecool"
minSdk 19
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
@ -33,7 +31,6 @@ android {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
viewBinding true
}
}
@ -47,20 +44,24 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'androidx.core:core-ktx:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"
implementation "com.google.code.gson:gson:2.8.9"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'androidx.fragment:fragment-ktx:1.5.6'
implementation 'androidx.multidex:multidex:2.0.1'
// Java language implementation
implementation("androidx.navigation:navigation-fragment:2.5.3")
implementation("androidx.navigation:navigation-ui:2.5.3")
// Kotlin
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
// Feature module Support
implementation("androidx.navigation:navigation-dynamic-features-fragment:2.5.3")
// Testing Navigation
androidTestImplementation("androidx.navigation:navigation-testing:2.5.3")
// Jetpack Compose Integration
implementation("androidx.navigation:navigation-compose:2.5.3")
}

@ -1,11 +1,18 @@
package fr.iut.cinecool
import android.app.Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
class CinemaActivity : AppCompatActivity() {
private lateinit var navController: NavController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_cinema)
val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment
navController = navHostFragment.navController
}
}

@ -0,0 +1,18 @@
package fr.iut.cinecool
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
class CinemaFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_cinema, container, false)
}
}

@ -0,0 +1,41 @@
package fr.iut.cinecool
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.LinearLayout
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import fr.iut.cinecool.adapter.MovieAdapter
import fr.iut.cinecool.model.Movie
import fr.iut.cinecool.model.Stub
class MoviesFragment : Fragment() {
private lateinit var recycler: RecyclerView
private lateinit var movieList: ArrayList<Movie>
private lateinit var movieAdapter: MovieAdapter
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.fragment_movies, container, false)
val button = view.findViewById<Button>(R.id.button)
button.setOnClickListener {
findNavController().navigate(R.id.movies_to_sessions)
}
recycler = view.findViewById(R.id.recyclerMovie)
recycler.setHasFixedSize(true)
recycler.layoutManager = LinearLayoutManager(context)
val stub = Stub()
stub.loading()
movieList=stub.movies
movieAdapter = MovieAdapter(movieList)
recycler.adapter = movieAdapter
return view
}
}

@ -0,0 +1,25 @@
package fr.iut.cinecool
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
class SessionFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.fragment_session, container, false)
val button = view.findViewById<Button>(R.id.returnButton)
button.setOnClickListener {
findNavController().navigate(R.id.action_SessionFragment_to_fragment_movies)
}
return view
}
}

@ -0,0 +1,37 @@
package fr.iut.cinecool.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import fr.iut.cinecool.R
import fr.iut.cinecool.model.Movie
class MovieAdapter(private val moviesList: ArrayList<Movie>) :
RecyclerView.Adapter<MovieAdapter.MovieViewHolder>() {
class MovieViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val imageView = itemView.findViewById<ImageView>(R.id.imageView)
val MovieName = itemView.findViewById<TextView>(R.id.MovieName)
val OtherInformations = itemView.findViewById<TextView>(R.id.OtherInformations)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.movie, parent, false)
return MovieViewHolder(view)
}
override fun getItemCount(): Int {
return moviesList.size
}
override fun onBindViewHolder(holder: MovieViewHolder, position: Int) {
val movie = moviesList[position]
holder.imageView.setImageResource(movie.icon)
holder.MovieName.text = movie.name
holder.OtherInformations.text = movie.realisator +" "+ movie.duration +" "+ movie.mark
}
}

@ -2,4 +2,4 @@ package fr.iut.cinecool.model
import java.util.Date
class Session(val id:Int, val date: Date, val beginHour:Int, val endingHour:Int, val room:String)
data class Session(val id:Int, val date: Date, val beginHour:Int, val endingHour:Int, val room:String)

@ -1,14 +1,15 @@
package fr.iut.cinecool.model
import android.graphics.drawable.Drawable
import fr.iut.cinecool.R
import java.util.Date
class Stub(var sessions:ArrayList<Session>,var movies:ArrayList<Movie>, var cinemas:ArrayList<Cinema>) {
class Stub( var sessions:ArrayList<Session> = ArrayList(),var movies:ArrayList<Movie> = ArrayList(),var cinemas:ArrayList<Cinema> = ArrayList()) {
fun loading(){
val date = Date(2023,3,12)
sessions.addAll(listOf(Session(0,date,14,16,"2A"),Session(1,date,4,6,"5B")))
//movies.add(Movie(1,"trop bg",2,"Pas moi",2.0,))
//movies.add(Movie(0,"Imitation Game",4,"Moi",3.0,))
movies.add(Movie(1,"trop bg",2,"Pas moi",2.0, R.drawable.no_pictures))
movies.add(Movie(0,"Imitation Game",4,"Moi",3.0,R.drawable.imitation_game))
cinemas.add(Cinema(0,12367,67894,"clf","CineJaude"))
cinemas.add(Cinema(1,87634,43567,"Aubière","CGR Le Paris"))
}

@ -6,11 +6,15 @@
android:layout_height="match_parent"
tools:context=".CinemaActivity">
<androidx.recyclerview.widget.RecyclerView
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="409dp"
android:layout_height="729dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:defaultNavHost="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CinemaFragment">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerCinemas"/>
</FrameLayout>

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MoviesFragment">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="All movies"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerMovie"
android:layout_width="match_parent"
android:layout_height="500dp"
app:layout_constraintBottom_toBottomOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SessionFragment">
<Button
android:id="@+id/returnButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button Sessions"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/no_pictures" />
<TextView
android:id="@+id/MovieName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Movie-Name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.522"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.122"
android:textSize="30dp"/>
<TextView
android:id="@+id/OtherInformations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Other-Informations"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/MovieName"
android:textSize="20dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

@ -3,26 +3,35 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/FirstFragment">
app:startDestination="@id/fragment_movies">
<fragment
android:id="@+id/FirstFragment"
android:name="fr.iut.cinecool.FirstFragment"
android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_first">
android:id="@+id/CinemaFragment"
android:name="fr.iut.cinecool.CinemaFragment"
android:label="Cinema Fragment"
tools:layout="@layout/fragment_cinema">
<action
android:id="@+id/action_FirstFragment_to_SecondFragment"
app:destination="@id/SecondFragment" />
app:destination="@id/fragment_movies">
</action>
</fragment>
<fragment
android:id="@+id/SecondFragment"
android:name="fr.iut.cinecool.SecondFragment"
android:label="@string/second_fragment_label"
tools:layout="@layout/fragment_second">
android:id="@+id/fragment_movies"
android:name="fr.iut.cinecool.MoviesFragment"
android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_movies">
<action
android:id="@+id/action_SecondFragment_to_FirstFragment"
app:destination="@id/FirstFragment" />
android:id="@+id/movies_to_sessions"
app:destination="@id/SessionFragment">
</action>
</fragment>
<fragment
android:id="@+id/SessionFragment"
android:name="fr.iut.cinecool.SessionFragment"
android:label="SessionFragment"
tools:layout="@layout/fragment_session">
<action
android:id="@+id/action_SessionFragment_to_fragment_movies"
app:destination="@id/fragment_movies" />
</fragment>
</navigation>

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.CineCool" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.CineCool" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>

Loading…
Cancel
Save