Compare commits

...

1 Commits

Author SHA1 Message Date
louwar 3d198fac54 test à voir plus tard
2 years ago

@ -9,7 +9,7 @@ android {
defaultConfig { defaultConfig {
applicationId "fr.iut.cinecool" applicationId "fr.iut.cinecool"
minSdk 21 minSdk 19
targetSdk 33 targetSdk 33
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@ -36,7 +36,6 @@ android {
} }
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0' implementation 'com.google.android.material:material:1.8.0'
@ -44,6 +43,13 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-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 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'androidx.fragment:fragment-ktx:1.5.6'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.core:core-ktx:+'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
@ -65,6 +71,10 @@ dependencies {
// Jetpack Compose Integration // Jetpack Compose Integration
implementation("androidx.navigation:navigation-compose:2.5.3") implementation("androidx.navigation:navigation-compose:2.5.3")
// Map
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'com.github.MKergall:osmbonuspack:6.6.0'
// API // API
implementation "com.squareup.okhttp3:okhttp:4.9.3" implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.3" implementation "com.squareup.okhttp3:logging-interceptor:4.9.3"
@ -72,10 +82,6 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:retrofit: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'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
} }

@ -1,33 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> package="com.example.myapplication">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Ajoutez cette ligne pour autoriser l'accès à Internet -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.CineCool" android:theme="@style/AppTheme">
tools:targetApi="31">
<activity <meta-data
android:name=".CinemaActivity" android:name="org.osmdroid.config"
android:exported="false" /> android:resource="@xml/osmdroid_config" />
<activity
android:name=".MainActivity" <activity android:name="MainActivity">
android:exported="true"
android:label="@string/title_activity_main"
android:theme="@style/Theme.CineCool.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>

@ -0,0 +1,16 @@
package fr.iut.cinecool.API.OpenStreetMap
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Query
interface ApiService {
@Headers("User-Agent: MyApp")
@GET("search")
fun searchCinemas(
@Query("q") query: String,
@Query("format") format: String = "json",
@Query("limit") limit: Int = 10
): Call<List<Cinema>>
}

@ -0,0 +1,17 @@
package fr.iut.cinecool.API.OpenStreetMap
import com.google.gson.annotations.SerializedName
data class Cinema(
@SerializedName("place_id")
val placeId: Long,
@SerializedName("lat")
val latitude: Double,
@SerializedName("lon")
val longitude: Double,
@SerializedName("display_name")
val displayName: String
)

@ -0,0 +1,34 @@
package fr.iut.cinecool.API.OpenStreetMap
import android.location.Location
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
class Repository {
private fun fetchNearbyCinemas(location: Location) {
val retrofit = Retrofit.Builder()
.baseUrl("https://nominatim.openstreetmap.org/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val nominatimService = retrofit.create(NominatimService::class.java)
val call = nominatimService.searchCinemas("cinema near ${location.latitude},${location.longitude}")
call.enqueue(object : Callback<List<Cinema>> {
override fun onResponse(call: Call<List<Cinema>>, response: Response<List<Cinema>>) {
if (response.isSuccessful) {
val cinemas = response.body() ?: emptyList()
displayCinemas(cinemas)
}
}
override fun onFailure(call: Call<List<Cinema>>, t: Throwable) {
// Gérer l'erreur
}
})
}
}

@ -1,4 +1,4 @@
package fr.iut.cinecool.API package fr.iut.cinecool.API.THMDB
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory

@ -1,4 +1,4 @@
package fr.iut.cinecool.API package fr.iut.cinecool.API.THMDB
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Query import retrofit2.http.Query

@ -1,4 +1,4 @@
package fr.iut.cinecool.API package fr.iut.cinecool.API.THMDB
import android.os.Parcel import android.os.Parcel
import android.os.Parcelable import android.os.Parcelable

@ -1,4 +1,4 @@
package fr.iut.cinecool.API package fr.iut.cinecool.API.THMDB
class Repository { class Repository {
private val apiService = ApiClient.apiService private val apiService = ApiClient.apiService

@ -1,32 +1,61 @@
package fr.iut.cinecool package fr.iut.cinecool
import android.content.Intent import android.Manifest
import android.content.pm.PackageManager
import android.location.Location
import android.os.Bundle import android.os.Bundle
import android.widget.EditText
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import fr.iut.cinecool.fragments.CinemaListFragment
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
private lateinit var fusedLocationClient: FusedLocationProviderClient
private val locationPermissionRequestCode = 1
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
val loginButton = findViewById<ImageView>(R.id.loginButton)
loginButton.setOnClickListener(){ fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
login()
if (savedInstanceState == null) {
supportFragmentManager.beginTransaction()
.add(R.id.fragment_container, CinemaListFragment())
.commit()
} }
requestLocationPermission()
}
/*ActivityCompat.requestPermissions(this, private fun requestLocationPermission() {
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION,1) if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
)*/ != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
locationPermissionRequestCode
)
} }
fun login(){ }
val name = findViewById<EditText>(R.id.name).text
if (name.isNotEmpty()){ override fun onRequestPermissionsResult(
val intent = Intent(applicationContext,CinemaActivity::class.java) requestCode: Int,
startActivity(intent) permissions: Array<out String>,
System.out.println(name) grantResults: IntArray
) {
if (requestCode == locationPermissionRequestCode) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// La permission de localisation a été accordée, vous pouvez effectuer les actions correspondantes
} else {
// La permission de localisation a été refusée, vous devez gérer ce cas
} }
} }
} }
}

@ -0,0 +1,43 @@
package fr.iut.cinecool.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import fr.iut.cinecool.API.OpenStreetMap.Cinema
import fr.iut.cinecool.R
class CinemaAdapter(private val onCinemaClickListener: (Cinema) -> Unit) :
RecyclerView.Adapter<CinemaAdapter.CinemaViewHolder>() {
private val cinemas = mutableListOf<Cinema>()
fun updateCinemas(newCinemas: List<Cinema>) {
cinemas.clear()
cinemas.addAll(newCinemas)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CinemaViewHolder {
val itemView = LayoutInflater.from(parent.context).inflate(R.layout.item_cinema, parent, false)
return CinemaViewHolder(itemView, onCinemaClickListener)
}
override fun onBindViewHolder(holder: CinemaViewHolder, position: Int) {
holder.bind(cinemas[position])
}
override fun getItemCount(): Int = cinemas.size
class CinemaViewHolder(itemView: View, private val onCinemaClickListener: (Cinema) -> Unit) :
RecyclerView.ViewHolder(itemView) {
private val cinemaNameTextView: TextView = itemView.findViewById(R.id.cinemaNameTextView)
fun bind(cinema: Cinema) {
cinemaNameTextView.text = cinema.displayName
itemView.setOnClickListener { onCinemaClickListener(cinema) }
}
}
}

@ -8,47 +8,33 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import fr.iut.cinecool.R import fr.iut.cinecool.R
import fr.iut.cinecool.API.Movie import fr.iut.cinecool.API.THMDB.Movie
class MovieAdapter(private var moviesList: List<Movie>) : class MovieAdapter : RecyclerView.Adapter<MovieAdapter.MovieViewHolder>() {
RecyclerView.Adapter<MovieAdapter.MovieViewHolder>() {
var onItemClick : ((Movie)->Unit)?=null private var movies: List<Movie> = emptyList()
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 { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.movie, parent, false) val view = LayoutInflater.from(parent.context).inflate(R.layout.movie_item, parent, false)
return MovieViewHolder(view) return MovieViewHolder(view)
} }
override fun getItemCount(): Int {
return moviesList.size
}
override fun onBindViewHolder(holder: MovieViewHolder, position: Int) { override fun onBindViewHolder(holder: MovieViewHolder, position: Int) {
val movie = moviesList[position] holder.bind(movies[position])
val imageUrl = "https://image.tmdb.org/t/p/w500${movie.poster_path}"
Glide.with(holder.itemView.context)
.load(imageUrl)
.placeholder(R.drawable.imitation_game)
.into(holder.imageView)
holder.MovieName.text = movie.title
holder.OtherInformations.text = movie.overview
holder.itemView.setOnClickListener {
onItemClick?.invoke(movie)
} }
// Pour cet exemple, je mets l'overview en tant qu'OtherInformations, vous pouvez le personnaliser selon vos besoins override fun getItemCount(): Int = movies.size
}
// Ajoutez cette méthode pour mettre à jour la liste des films fun setMovies(movies: List<Movie>) {
fun updateMovies(newMovies: List<Movie>) { this.movies = movies
moviesList = newMovies
notifyDataSetChanged() notifyDataSetChanged()
} }
class MovieViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
private val titleTextView: TextView = itemView.findViewById(R.id.titleTextView)
fun bind(movie: Movie) {
titleTextView.text = movie.title
}
}
} }

@ -0,0 +1,57 @@
package fr.iut.cinecool.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import fr.iut.cinecool.API.OpenStreetMap.Cinema
import fr.iut.cinecool.R
import fr.iut.cinecool.adapter.MovieAdapter
class CinemaDetailFragment : Fragment() {
private lateinit var cinemaNameTextView: TextView
private lateinit var recyclerView: RecyclerView
private lateinit var adapter: MovieAdapter
private lateinit var cinema: Cinema
companion object {
private const val ARG_CINEMA = "cinema"
fun newInstance(cinema: Cinema): CinemaDetailFragment {
val fragment = CinemaDetailFragment()
val args = Bundle()
args.putParcelable(ARG_CINEMA, cinema)
fragment.arguments = args
return fragment
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
cinema = arguments?.getParcelable(ARG_CINEMA) ?: throw IllegalStateException("Cinema not provided")
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_cinema_detail, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
cinemaNameTextView = view.findViewById(R.id.cinemaNameTextView)
recyclerView = view.findViewById(R.id.recyclerView)
recyclerView.layoutManager = LinearLayoutManager(requireContext())
adapter = MovieAdapter()
recyclerView.adapter = adapter
cinemaNameTextView.text = cinema.displayName
// Récupérez et affichez la liste des films à l'affiche pour le cinéma sélectionné
}
}

@ -1,10 +1,11 @@
package fr.iut.cinecool package fr.iut.cinecool.fragments
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import fr.iut.cinecool.R
class CinemaFragment : Fragment() { class CinemaFragment : Fragment() {

@ -0,0 +1,45 @@
package fr.iut.cinecool.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.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import fr.iut.cinecool.R
import fr.iut.cinecool.adapter.CinemaAdapter
class CinemaListFragment : Fragment() {
private lateinit var recyclerView: RecyclerView
private lateinit var adapter: CinemaAdapter
private lateinit var fusedLocationClient: FusedLocationProviderClient
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_cinema_list, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView = view.findViewById(R.id.recyclerView)
recyclerView.layoutManager = LinearLayoutManager(requireContext())
adapter = CinemaAdapter { cinema ->
val fragment = CinemaDetailFragment.newInstance(cinema)
requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container, fragment)
.addToBackStack(null)
.commit()
}
recyclerView.adapter = adapter
fusedLocationClient = LocationServices.getFusedLocationProviderClient(requireActivity())
// Récupérez la position de l'utilisateur et affichez les cinémas à proximité
}
}

@ -0,0 +1,45 @@
package fr.iut.cinecool.fragments
import android.content.res.Configuration
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
//import androidx.lifecycle.viewmodel.CreationExtras.Empty.map
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
class MapFragment : Fragment() {
/*
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.fragment_map)
map = findViewById(R.id.map)
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)
mapFragment.getMapAsync(this)
}
override fun onMapReady(googleMap: GoogleMap) {
this.gMap = googleMap
val mapIndia = LatLng(20.5937, 789629)
this.gMap.addMarker(MarkerOptions().position(mapIndia).title("Marker in India"))
this.gMap.moveCamera(CameraUpdateFactory.newLatLng(mapIndia))
}
override fun onDestroyView() {
super.onDestroyView()
}
// TODO https://youtu.be/JzxjNNCYt_o
// https://console.cloud.google.com/apis/credentials?hl=fr&project=upbeat-grammar-382309
*/
}

@ -1,12 +1,7 @@
package fr.iut.cinecool package fr.iut.cinecool.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import fr.iut.cinecool.API.Movie
// import fr.iut.cinecool.databinding.FragmentMovieDetailBinding // import fr.iut.cinecool.databinding.FragmentMovieDetailBinding
class MovieDetailFragment : Fragment() { class MovieDetailFragment : Fragment() {

@ -1,6 +1,5 @@
package fr.iut.cinecool package fr.iut.cinecool.fragments
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
@ -10,6 +9,8 @@ import androidx.fragment.app.viewModels
import androidx.fragment.app.activityViewModels 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 fr.iut.cinecool.viewModel.MovieViewModel
import fr.iut.cinecool.R
import fr.iut.cinecool.adapter.MovieAdapter import fr.iut.cinecool.adapter.MovieAdapter
import fr.iut.cinecool.databinding.FragmentMoviesBinding import fr.iut.cinecool.databinding.FragmentMoviesBinding
import fr.iut.cinecool.model.cineViewModel import fr.iut.cinecool.model.cineViewModel

@ -1,4 +1,4 @@
package fr.iut.cinecool package fr.iut.cinecool.fragments
import android.os.Bundle import android.os.Bundle
import android.text.method.ScrollingMovementMethod import android.text.method.ScrollingMovementMethod
@ -6,15 +6,13 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import fr.iut.cinecool.API.Movie import fr.iut.cinecool.R
import fr.iut.cinecool.databinding.FragmentSessionBinding
import fr.iut.cinecool.model.cineViewModel import fr.iut.cinecool.model.cineViewModel
class SessionFragment : Fragment() { class SessionFragment : Fragment() {

@ -3,13 +3,14 @@ package fr.iut.cinecool.model
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import fr.iut.cinecool.API.THMDB.Movie
class cineViewModel : ViewModel() { class cineViewModel : ViewModel() {
private val _cine = MutableLiveData<fr.iut.cinecool.API.Movie>() private val _cine = MutableLiveData<Movie>()
val cine: LiveData<fr.iut.cinecool.API.Movie> = _cine val cine: LiveData<Movie> = _cine
fun setCine(cine: fr.iut.cinecool.API.Movie) { fun setCine(cine: Movie) {
_cine.value = cine _cine.value = cine
} }

@ -1,11 +1,11 @@
package fr.iut.cinecool package fr.iut.cinecool.viewModel
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import fr.iut.cinecool.API.Movie import fr.iut.cinecool.API.THMDB.Movie
import fr.iut.cinecool.API.Repository import fr.iut.cinecool.API.THMDB.Repository
class MovieViewModel : ViewModel() { class MovieViewModel : ViewModel() {
private val repository = Repository() private val repository = Repository()

@ -1,65 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto" <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" xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".MainActivity">
<ImageView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/Background" android:id="@+id/recyclerView"
android:layout_width="3000px"
android:layout_height="3000px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/background" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300sp" android:layout_height="match_parent"
android:background="@drawable/login_background"
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="0.821">
<EditText
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="17"
android:inputType="textPersonName"
android:text="Name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.49"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.235" />
<ImageView
android:id="@+id/loginButton"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName" app:layout_constraintTop_toTopOf="parent" />
app:srcCompat="@drawable/connection_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/Logo"
android:background="@color/white"
android:layout_width="189dp"
android:layout_height="199dp"
app:layout_constraintBottom_toTopOf="@+id/constraintLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/cinema" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".CinemaFragment"> tools:context=".fragments.CinemaFragment">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

@ -0,0 +1,31 @@
<?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">
<TextView
android:id="@+id/cinema_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="Cinema Name" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/movie_recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="8dp"
android:clipToPadding="false"
app:layout_constraintTop_toBottomOf="@id/cinema_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:listitem="@layout/movie_item" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,20 @@
<?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">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/cinema_recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="8dp"
android:clipToPadding="false"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:listitem="@layout/item_cinema" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,18 @@
<?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=".MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
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"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
tools:context=".MainActivity"/>

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MoviesFragment"> tools:context=".fragments.MoviesFragment">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="66dp" android:layout_width="66dp"

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".SessionFragment"> tools:context=".fragments.SessionFragment">
<ImageButton <ImageButton
android:id="@+id/returnButton" android:id="@+id/returnButton"

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/cinemaNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cinema Name"
android:textSize="18sp"
android:textColor="@android:color/black" />
</LinearLayout>

@ -0,0 +1,25 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/movie_title"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>

@ -7,13 +7,13 @@
<fragment <fragment
android:id="@+id/CinemaFragment" android:id="@+id/CinemaFragment"
android:name="fr.iut.cinecool.CinemaFragment" android:name="fr.iut.cinecool.fragments.CinemaFragment"
android:label="Cinema Fragment" android:label="Cinema Fragment"
tools:layout="@layout/fragment_cinema"/> tools:layout="@layout/fragment_cinema"/>
<fragment <fragment
android:id="@+id/fragment_movies" android:id="@+id/fragment_movies"
android:name="fr.iut.cinecool.MoviesFragment" android:name="fr.iut.cinecool.fragments.MoviesFragment"
android:label="@string/first_fragment_label" android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_movies"> tools:layout="@layout/fragment_movies">
@ -28,7 +28,7 @@
<fragment <fragment
android:id="@+id/SessionFragment" android:id="@+id/SessionFragment"
android:name="fr.iut.cinecool.SessionFragment" android:name="fr.iut.cinecool.fragments.SessionFragment"
android:label="SessionFragment" android:label="SessionFragment"
tools:layout="@layout/fragment_session"> tools:layout="@layout/fragment_session">
<action <action

@ -11,4 +11,5 @@
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string> <string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="error_loading_movie">erreur de chargement des films</string> <string name="error_loading_movie">erreur de chargement des films</string>
<string name="tmdb_api_key">a97243d7813d31446f6c43284e6854d5</string> <string name="tmdb_api_key">a97243d7813d31446f6c43284e6854d5</string>
<string name="movie_title">Movie Title</string>
</resources> </resources>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<osmdroid>
<preference name="osmdroid.basePath" value="osmdroid" />
<preference name="osmdroid.cachePath" value="tiles" />
</osmdroid>

@ -2,5 +2,5 @@
plugins { plugins {
id 'com.android.application' version '7.4.2' apply false id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20-RC2' apply false id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
} }
Loading…
Cancel
Save