commit
71b72e9e8e
@ -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
|
||||
}
|
||||
}
|
@ -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"))
|
||||
}
|
||||
|
@ -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>
|
Loading…
Reference in new issue