Compare commits

..

No commits in common. 'master' and 'fragment_navigation' have entirely different histories.

@ -8,17 +8,12 @@ trigger:
steps:
- name: code-analysis
image: openjdk:8-jdk
image: androidsdk/android-31
environment:
SONAR_TOKEN:
from_secret: SECRET_TOKEN
SONAR_TOKEN:
from_secret: SECRET_TOKEN
settings:
sources: ./src/
sources: ./src/
commands:
- export SONAR_SCANNER_VERSION=4.7.0.2747
- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
- export SONAR_SCANNER_OPTS="-server"
- sonar-scanner -D sonar.projectKey=Scor_It -D sonar.sources=./src -D sonar.host.url=https://codefirst.iut.uca.fr/sonar
- cd src
- ./gradlew --no-daemon :app:assembleDebug sonarqube -Dsonar.projectKey=Scor_It -Dsonar.host.url=https://codefirst.iut.uca.fr/sonar -Dsonar.login=$${SONAR_TOKEN}

@ -138,7 +138,6 @@ Team --> "-area" Area
Match --> "-HomeTeam" Team
Match --> "-AwayTeam" Team
Match --> "-competition" Competition
Competition --> "-area" Area
Competition --> "-currentSeason" Season
@ -216,56 +215,6 @@ StubManager --|> DataManager
@enduml
```
## Visuel de l'Application
<div align = center>
<img src="doc/Images/StartPage.jpg" width="250" >
<img src="doc/Images/HomePage.jpg" width="250" >
<img src="doc/Images/FavoritePage.jpg" width="250" >
<img src="doc/Images/DetailCompetitionPage.jpg" width="250" >
</div>
## Avancement du projet
<u>Où en sommes-nous</u>:grey_question::grey_exclamation: (:white_check_mark: réalisé, :warning: presque abouti, :x: non commencé )
```Côté vue:```
- :white_check_mark: [**Partie 1**](src) : **Réalisation de la vue Start Page**
- :white_check_mark: [**Partie 2**](src) : **Réalisation de la vue Home Page**
- :white_check_mark: [**Partie 3**](src) : **Réalisation de la vue Favorite Page**
- :white_check_mark: [**Partie 4**](src) : **Réalisation de la vue Detail Competition Page**
- :x: [**Partie 5**](src) : **Réalisation de la vue Team Detail Page**
```Côté back-end:```
- :white_check_mark: [**Partie 1**](src) : **Réalisation de la navigation entre les fragments**
- :white_check_mark: [**Partie 2**](src) : **Master Detail**
- :white_check_mark: [**Partie 3**](src) : **Appelle à l'API**
- :white_check_mark: [**Partie 4**](src) : **Gyroscope pour le ballon de foot**
- :white_check_mark: [**Partie 5**](doc) : **Conception et réalisation du Model**
- :warning: [**Partie 6**](src) : **Persistance des donnéees**
- :x: [**Partie 7**](src) : **Réalisation de la barre de recherche**
- :x: [**Partie 8**](src) : **Affichage des images SVG**
```Autre:```
- :white_check_mark: [**Partie 1**](.drone.yml) : **Mise en place de SonarQube**
## :construction_worker: Technicien en charge de l'application
- Emre KARTAL : Emre.KARTAL@etu.uca.fr
@ -274,7 +223,7 @@ StubManager --|> DataManager
<a href = "https://codefirst.iut.uca.fr/git/emre.kartal">
<img src="https://codefirst.iut.uca.fr/git/avatars/402cf312e853192f42c0135a888725c2?size=870" width="50" >
</a>
<a href = "https://codefirst.iut.uca.fr/git/baptiste.marcel">
<a href = "https://codefirst.iut.uca.fr/git/david.d_almeida">
<img src="https://codefirst.iut.uca.fr/git/avatars/6b1f2a8b8f636d8f4d315b060075578f?size=870" width="50" >
</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

@ -1,123 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -32,25 +32,16 @@ android {
}
}
apply plugin: 'kotlin-kapt'
dependencies {
// Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
// Glide
//Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
// Room
implementation 'androidx.room:room-runtime:2.5.1'
implementation 'androidx.room:room-ktx:2.5.1'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

@ -1,119 +0,0 @@
package uca.iut.clermont.api
import AreaManager
import CompetitionsManager
import DataManager
import MatchesManager
import PeopleManager
import TeamsManager
import kotlinx.coroutines.coroutineScope
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import uca.iut.clermont.model.*
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl("https://api.football-data.org/v4/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val footballApi: FootballApi = retrofit.create(FootballApi::class.java)
class ApiManager : DataManager() {
override val areaMgr: AreaManager = ApiAreaManager()
override val peopleMgr: PeopleManager = ApiPeopleManager()
override val matchesMgr: MatchesManager = ApiMatchesManager()
override val competitionsMgr: CompetitionsManager = ApiCompetitionsManager()
override val teamsMgr: TeamsManager = ApiTeamsManager()
class ApiAreaManager : AreaManager {
override suspend fun getItemsByName(substring: String): List<Area> = coroutineScope {
val areas = footballApi.getAreas()
return@coroutineScope areas.areas.filter { it.name.contains(substring) }
}
override suspend fun getItems(): List<Area> = coroutineScope {
val areas = footballApi.getAreas()
return@coroutineScope areas.areas
}
override suspend fun getItemById(id: Int): Area = coroutineScope {
val area = footballApi.getArea(id)
return@coroutineScope area
}
}
class ApiPeopleManager : PeopleManager {
override suspend fun getItems(): List<Personne> = listOf()
override suspend fun getItemById(id: Int): Personne? = coroutineScope {
val personne = footballApi.getPlayer(id)
return@coroutineScope personne.toModel()
}
}
class ApiMatchesManager : MatchesManager {
override suspend fun getNbItemsByCompetition(id: Int): Int = coroutineScope {
val matches = footballApi.getMatchesByCompetition(id)
return@coroutineScope matches.matches.size
}
override suspend fun getItemsByCompetition(id: Int): List<Match> =
coroutineScope {
val matches = footballApi.getMatchesByCompetition(id)
return@coroutineScope matches.matches.map { it.toModel() }
}
override suspend fun getItems(): List<Match> = coroutineScope {
val matches = footballApi.getMatches()
return@coroutineScope matches.matches.map { matchResult -> matchResult.toModel() }
}
override suspend fun getItemById(id: Int): Match = coroutineScope {
val match = footballApi.getMatch(id)
return@coroutineScope match.toModel()
}
}
class ApiCompetitionsManager : CompetitionsManager {
override suspend fun getItemsByName(substring: String): List<Competition> = coroutineScope {
val competitons = footballApi.getCompetitions()
return@coroutineScope competitons.competitions.map { competitionResult -> competitionResult.toModel() }
.filter { it.name == substring }
}
override suspend fun getItems(): List<Competition> = coroutineScope {
val competitons = footballApi.getCompetitions()
return@coroutineScope competitons.competitions.map { competitionResult -> competitionResult.toModel() }
.sortedBy { it.name }
}
override suspend fun getItemById(id: Int): Competition = coroutineScope {
val competition = footballApi.getCompetition(id)
return@coroutineScope competition.toModel()
}
}
class ApiTeamsManager : TeamsManager {
override fun getItemsByName(substring: String): List<Team> {
TODO("Not yet implemented")
}
override suspend fun getItems(): List<Team> {
TODO("Not yet implemented")
}
override suspend fun getItemById(id: Int): Team? {
TODO("Not yet implemented")
}
}
}

@ -1,48 +0,0 @@
package uca.iut.clermont.api
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Path
import uca.iut.clermont.api.response.areaResponse.AreaResponse
import uca.iut.clermont.api.response.competitionResponse.CompetitionResponse
import uca.iut.clermont.api.response.competitionResponse.CompetitionResult
import uca.iut.clermont.api.response.matchResponse.MatchResponse
import uca.iut.clermont.api.response.matchResponse.MatchResult
import uca.iut.clermont.model.Area
import uca.iut.clermont.model.PlayerResponse
interface FootballApi {
@Headers("X-Auth-Token: 7814ffe5b0314b5291a287d32a178e57")
@GET("areas/{id}")
suspend fun getArea(@Path("id") id: Int): Area
@Headers("X-Auth-Token: 7814ffe5b0314b5291a287d32a178e57")
@GET("areas")
suspend fun getAreas(): AreaResponse
@Headers("X-Auth-Token: 7814ffe5b0314b5291a287d32a178e57")
@GET("persons/{id}")
suspend fun getPlayer(@Path("id") playerId: Int): PlayerResponse
@Headers("X-Auth-Token: 621ef06e148542f98b4993a5442421eb")
@GET("competitions")
suspend fun getCompetitions(): CompetitionResponse
@Headers("X-Auth-Token: 8f51b43de0444026bd3ec3484f082575")
@GET("competitions/{id}")
suspend fun getCompetition(@Path("id") id: Int): CompetitionResult
@Headers("X-Auth-Token: 7814ffe5b0314b5291a287d32a178e57")
@GET("matches")
suspend fun getMatches(): MatchResponse
@Headers("X-Auth-Token: 621ef06e148542f98b4993a5442421eb")
@GET("matches/{id}")
suspend fun getMatch(@Path("id") id: Int): MatchResult
@Headers("X-Auth-Token: b002ff114afa41a590e2baef63d8c689")
@GET("competitions/{id}/matches")
suspend fun getMatchesByCompetition(@Path("id") id: Int): MatchResponse
}

@ -1,8 +0,0 @@
package uca.iut.clermont.api.response.areaResponse
import uca.iut.clermont.model.Area
data class AreaResponse(
val areas: List<Area>,
val count: Int
)

@ -1,7 +0,0 @@
package uca.iut.clermont.api.response.competitionResponse
data class CompetitionResponse(
val competitions: List<CompetitionResult>,
val count: Int,
val filters: Filters
)

@ -1,24 +0,0 @@
package uca.iut.clermont.api.response.competitionResponse
import uca.iut.clermont.model.Area
import uca.iut.clermont.model.Competition
class CompetitionResult(
val id: Int,
val name: String,
val code: String,
val type: String,
val emblem: String,
val currentSeason: CurrentSeason,
val area: Area
) {
fun toModel() = Competition(
id,
name,
code,
type,
emblem,
currentSeason.toModel(),
area
)
}

@ -1,29 +0,0 @@
package uca.iut.clermont.api.response.competitionResponse
import uca.iut.clermont.model.Season
import java.text.SimpleDateFormat
import java.util.*
data class CurrentSeason(
val currentMatchday: Int,
val endDate: String,
val id: Int,
val startDate: String,
val winner: Any
) {
fun toModel(): Season {
val calendar = Calendar.getInstance()
val calendar2 = Calendar.getInstance()
return Season(
id,
calendar.apply {
time = SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(startDate) as Date
},
calendar2.apply {
time = SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(endDate) as Date
},
currentMatchday,
if (winner is Int) winner else null
)
}
}

@ -1,5 +0,0 @@
package uca.iut.clermont.api.response.competitionResponse
data class Filters(
val client: String
)

@ -1,7 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
data class Filters(
val dateFrom: String,
val dateTo: String,
val permission: String
)

@ -1,23 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
import uca.iut.clermont.api.response.competitionResponse.CurrentSeason
import uca.iut.clermont.model.Area
import uca.iut.clermont.model.Competition
class MatchCompetitionResult(
val id: Int,
val name: String,
val code: String,
val type: String,
val emblem: String
) {
fun toModel(season: CurrentSeason, area: Area) = Competition(
id,
name,
code,
type,
emblem,
season.toModel(),
area
)
}

@ -1,7 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
data class MatchResponse(
val filters: Filters,
val matches: List<MatchResult>,
val resultSet: ResultSet
)

@ -1,32 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
import uca.iut.clermont.api.response.competitionResponse.CurrentSeason
import uca.iut.clermont.model.Area
import uca.iut.clermont.model.Match
import java.text.SimpleDateFormat
import java.util.*
class MatchResult(
val id: Int,
val homeTeam: TeamResult,
val awayTeam: TeamResult,
val utcDate: String,
val status: String,
val score: ScoreResult,
val season: CurrentSeason,
val area: Area,
val competition: MatchCompetitionResult
) {
fun toModel() = Match(
id,
homeTeam.toModel(),
awayTeam.toModel(),
Calendar.getInstance().apply {
time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US).parse(utcDate) as Date
},
status,
score.toModel(),
competition.toModel(season, area)
)
}

@ -1,9 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
data class ResultSet(
val competitions: String,
val count: Int,
val first: String,
val last: String,
val played: Int
)

@ -1,16 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
import uca.iut.clermont.model.Score
data class ScoreResult(
val duration: String,
val fullTime: Time,
val halfTime: Time,
val winner: String?
){
fun toModel() = Score(
fullTime.home,
fullTime.away,
winner
)
}

@ -1,37 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
import uca.iut.clermont.model.Area
import uca.iut.clermont.model.Coach
import uca.iut.clermont.model.Contract
import uca.iut.clermont.model.Team
import java.util.*
class TeamResult(
val id: Int,
val name: String,
val shortName: String,
val crest: String
) {
fun toModel() = Team(
id,
name,
shortName,
crest,
"",
"",
"",
"",
Area(1, "", "", "", ""),
"",
Coach(
1, "", "", "", Calendar.getInstance()
.apply { set(2022, 12, 28) }, "",
Contract(
Calendar.getInstance().apply { set(2020, 7, 1) },
Calendar.getInstance().apply { set(2024, 7, 1) })
),
listOf(),
listOf()
)
}

@ -1,6 +0,0 @@
package uca.iut.clermont.api.response.matchResponse
data class Time(
val away: Int?,
val home: Int?
)

@ -1,6 +0,0 @@
package uca.iut.clermont.api.response.playerResponse
data class ContractResponse(
val start: String,
val until: String
)

@ -1,7 +0,0 @@
package uca.iut.clermont.api.response.playerResponse
data class CurrentTeamResponse(
val id: Int,
val name: String,
val contract: ContractResponse
)

@ -1,38 +0,0 @@
package uca.iut.clermont.model
import uca.iut.clermont.api.response.playerResponse.CurrentTeamResponse
import java.text.SimpleDateFormat
import java.util.*
data class PlayerResponse(
val id: Int,
val firstName: String,
val lastName: String,
val name: String,
val dateOfBirth: String,
val nationality: String,
val position: String,
val shirtNumber: Int,
val lastUpdated: String,
val currentTeam: CurrentTeamResponse
) {
fun toModel() = Personne(
id,
firstName,
lastName,
name,
Calendar.getInstance().apply {
time = SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(dateOfBirth) as Date
},
nationality,
Contract(
Calendar.getInstance().apply {
time = SimpleDateFormat("yyyy-MM", Locale.US).parse(currentTeam.contract.start) as Date
},
Calendar.getInstance().apply {
time = SimpleDateFormat("yyyy-MM", Locale.US).parse(currentTeam.contract.until) as Date
}
)
)
}

@ -1,31 +0,0 @@
package uca.iut.clermont.data
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import uca.iut.clermont.data.dao.CompetitionDao
import uca.iut.clermont.model.Competition
@Database(entities = arrayOf(Competition::class), version = 1)
abstract class BDD : RoomDatabase() {
abstract fun competitionDao(): CompetitionDao
companion object {
private var INSTANCE: BDD? = null
fun getInstance(context: Context) =
INSTANCE ?: synchronized(this) {
val db = Room.databaseBuilder(
context,
BDD::class.java,
"ScorItDB"
).build()
INSTANCE = db
}
}
}

@ -246,7 +246,7 @@ class StubData : DataManager() {
)
)
private val random = Random()
private val random = java.util.Random()
val matchList: MutableList<Match> = mutableListOf()
fun initMatches() {
@ -258,8 +258,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2022, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(2, 1, "DRAW"),
competitionList[1]
Score(1, 1, "DRAW")
)
)
matchList.add(
@ -270,8 +269,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2022, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(2, 3, "HOME_TEAM"),
competitionList[0]
Score(2, 0, "HOME_TEAM")
)
)
matchList.add(
@ -282,8 +280,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2022, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(0, 4, "AWAY_TEAM"),
competitionList[0]
Score(0, 4, "AWAY_TEAM")
)
)
matchList.add(
@ -294,8 +291,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2023, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(0, 1, "AWAY_TEAM"),
competitionList[0]
Score(0, 1, "AWAY_TEAM")
)
)
matchList.add(
@ -306,8 +302,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2023, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(0, 0, "DRAW"),
competitionList[1]
Score(0, 0, "DRAW")
)
)
matchList.add(
@ -318,8 +313,7 @@ class StubData : DataManager() {
Calendar.getInstance()
.apply { set(2023, random.nextInt(12), random.nextInt(28) + 1) },
"FINISHED",
Score(2, 0, "HOME_TEAM"),
competitionList[0]
Score(2, 0, "HOME_TEAM")
)
)
}
@ -332,7 +326,7 @@ class StubData : DataManager() {
1,
"Paris Saint-Germain FC",
"PSG",
"https://www.psg.fr/img/DefaultOpenGraphImage.jpg?20230329",
"https://crests.football-data.org/524.svg",
"24 Rue du Commandant Guilbaud, 75016 Paris, France",
"https://www.psg.fr/",
"1970",
@ -349,7 +343,7 @@ class StubData : DataManager() {
2,
"FC Barcelona",
"BAR",
"https://crests.football-data.org/109.svg",
"https://crests.football-data.org/81.svg",
"Carrer d'Aristides Maillol, s/n, 08028 Barcelona, Spain",
"https://www.fcbarcelona.com/",
"1899",
@ -366,7 +360,7 @@ class StubData : DataManager() {
3,
"Liverpool FC",
"LIV",
"https://upload.wikimedia.org/wikipedia/fr/thumb/5/54/Logo_FC_Liverpool.svg/1200px-Logo_FC_Liverpool.svg.png",
"https://crests.football-data.org/64.svg",
"Anfield Road, Liverpool L4 0TH, United Kingdom",
"https://www.liverpoolfc.com/",
"1892",
@ -390,13 +384,7 @@ class StubData : DataManager() {
"BSA",
"LEAGUE",
"https://crests.football-data.org/764.svg",
Season(
1557,
Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) },
Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },
1,
null
),
Season(1557, Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) }, Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },1, null),
areaList[2],
)
)
@ -407,13 +395,7 @@ class StubData : DataManager() {
"ELC",
"LEAGUE",
"https://crests.football-data.org/PL.png",
Season(
1557,
Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) },
Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },
1,
null
),
Season(1557, Calendar.getInstance().apply { set(2023, Calendar.MARCH, 15) }, Calendar.getInstance().apply { set(2022, Calendar.DECEMBER, 3) },1, null),
areaList[2],
)
)
@ -421,43 +403,39 @@ class StubData : DataManager() {
class StubAreaManager(private val parent: StubData) : AreaManager {
override suspend fun getItemsByName(substring: String) =
override fun getItemsByName(substring: String) =
parent.areaList.filter { it.name.contains(substring, ignoreCase = true) }
override suspend fun getItems(): List<Area> = parent.areaList
override fun getItems(): List<Area> = parent.areaList
override suspend fun getItemById(id: Int) = parent.areaList.find { it.id == id }
override fun getItemById(id: Int) = parent.areaList.find { it.id == id }
}
class StubPeopleManager(private val parent: StubData) : PeopleManager {
override fun getItemsByName(substring: String) =
parent.peopleList.filter { it.name.contains(substring, ignoreCase = true) }
override suspend fun getItems() = parent.peopleList
override fun getItems() = parent.peopleList
override suspend fun getItemById(id: Int) = parent.peopleList.find { it.id == id }
override fun getItemById(id: Int) = parent.peopleList.find { it.id == id }
}
class StubMatchesManager(private val parent: StubData) : MatchesManager {
override suspend fun getNbItemsByCompetition(id: Int) =
parent.matchList.filter { it.competition.id == id }.size
override suspend fun getItemsByCompetition(id: Int) =
parent.matchList.filter { it.competition.id == id }
override fun getItems(): List<Match> = parent.matchList
override suspend fun getItems(): List<Match> = parent.matchList
override suspend fun getItemById(id: Int) = parent.matchList.find { it.id == id }
override fun getItemById(id: Int) = parent.matchList.find { it.id == id }
}
class StubCompetitionsManager(private val parent: StubData) : CompetitionsManager {
override suspend fun getItemsByName(substring: String) =
override fun getItemsByName(substring: String) =
parent.competitionList.filter { it.name.contains(substring, ignoreCase = true) }
override suspend fun getItems() = parent.competitionList
override fun getItems() = parent.competitionList
override suspend fun getItemById(id: Int) = parent.competitionList.find { it.id == id }
override fun getItemById(id: Int) = parent.competitionList.find { it.id == id }
}
@ -465,9 +443,9 @@ class StubData : DataManager() {
override fun getItemsByName(substring: String) =
parent.teamList.filter { it.name.contains(substring, ignoreCase = true) }
override suspend fun getItems() = parent.teamList
override fun getItems() = parent.teamList
override suspend fun getItemById(id: Int) = parent.teamList.find { it.id == id }
override fun getItemById(id: Int) = parent.teamList.find { it.id == id }
}
}

@ -1,22 +0,0 @@
package uca.iut.clermont.data.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import kotlinx.coroutines.flow.Flow
import uca.iut.clermont.model.Competition
@Dao
interface CompetitionDao {
@Delete
fun deleteCompetition(competition: Competition)
@Query("SELECT * FROM competition")
fun getAllCompetitions(): Flow<List<Competition>>
@Insert
fun insertCompetition(competition: Competition)
}

@ -0,0 +1,88 @@
package uca.iut.clermont.model
import AreaManager
import CompetitionsManager
import DataManager
import MatchesManager
import PeopleManager
import TeamsManager
class ApiManager : DataManager() {
override val areaMgr: AreaManager = ApiAreaManager()
override val peopleMgr: PeopleManager = ApiPeopleManager()
override val matchesMgr: MatchesManager = ApiMatchesManager()
override val competitionsMgr: CompetitionsManager = ApiCompetitionsManager()
override val teamsMgr: TeamsManager = ApiTeamsManager()
class ApiAreaManager : AreaManager {
override fun getItemsByName(substring: String): List<Area> {
TODO("Not yet implemented")
}
override fun getItems(): List<Area> {
TODO("Not yet implemented")
}
override fun getItemById(id: Int): Area? {
TODO("Not yet implemented")
}
}
class ApiPeopleManager : PeopleManager {
override fun getItemsByName(substring: String): List<Personne> {
TODO("Not yet implemented")
}
override fun getItems(): List<Personne> {
TODO("Not yet implemented")
}
override fun getItemById(id: Int): Personne? {
TODO("Not yet implemented")
}
}
class ApiMatchesManager : MatchesManager {
override fun getItems(): List<Match> {
TODO("Not yet implemented")
}
override fun getItemById(id: Int): Match? {
TODO("Not yet implemented")
}
}
class ApiCompetitionsManager : CompetitionsManager {
override fun getItemsByName(substring: String): List<Competition> {
TODO("Not yet implemented")
}
override fun getItems(): List<Competition> {
TODO("Not yet implemented")
}
override fun getItemById(id: Int): Competition? {
TODO("Not yet implemented")
}
}
class ApiTeamsManager : TeamsManager {
override fun getItemsByName(substring: String): List<Team> {
TODO("Not yet implemented")
}
override fun getItems(): List<Team> {
TODO("Not yet implemented")
}
override fun getItemById(id: Int): Team? {
TODO("Not yet implemented")
}
}
}

@ -1,16 +1,11 @@
package uca.iut.clermont.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "competitions")
class Competition(
@PrimaryKey val id: Int,
@ColumnInfo val name: String,
@ColumnInfo val code: String,
@ColumnInfo val type: String,
@ColumnInfo val emblem: String,
@ColumnInfo val currentSeason: Season,
val id: Int,
val name: String,
val code: String,
val type: String,
val emblem: String,
val currentSeason: Season,
val area: Area
)

@ -6,23 +6,21 @@ abstract class DataManager {
abstract val matchesMgr: MatchesManager
abstract val competitionsMgr: CompetitionsManager
abstract val teamsMgr: TeamsManager
}
interface AreaManager : GenericDataManager<Area> {
suspend fun getItemsByName(substring: String): List<Area>
fun getItemsByName(substring: String): List<Area>
}
interface PeopleManager : GenericDataManager<Personne> {}
interface MatchesManager : GenericDataManager<Match> {
suspend fun getNbItemsByCompetition(id: Int): Int
suspend fun getItemsByCompetition(id: Int): List<Match>
interface PeopleManager : GenericDataManager<Personne> {
fun getItemsByName(substring: String): List<Personne>
}
interface MatchesManager : GenericDataManager<Match>
interface CompetitionsManager : GenericDataManager<Competition> {
suspend fun getItemsByName(substring: String): List<Competition>
fun getItemsByName(substring: String): List<Competition>
}
interface TeamsManager : GenericDataManager<Team> {

@ -1,6 +1,6 @@
package uca.iut.clermont.model
interface GenericDataManager<T> {
suspend fun getItems(): List<T>
suspend fun getItemById(id: Int): T?
fun getItems(): List<T>
fun getItemById(id: Int): T?
}

@ -8,6 +8,5 @@ class Match(
val awayTeam: Team,
val date: Calendar,
val status: String,
val score: Score,
val competition: Competition
val score: Score
)

@ -2,7 +2,7 @@ package uca.iut.clermont.model
import java.util.Calendar
open class Personne(
abstract class Personne(
val id: Int,
val firstName: String,
val lastName: String,

@ -1,7 +1,7 @@
package uca.iut.clermont.model
class Score(
val home: Int?,
val away: Int?,
val winner: String?
val home: Int,
val away: Int,
val winner: String
)

@ -1,129 +0,0 @@
package uca.iut.clermont.view
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.bumptech.glide.Glide
import uca.iut.clermont.R
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.model.Competition
import uca.iut.clermont.view.adapter.MatchesAdapter
import uca.iut.clermont.view.viewModel.DetailViewModel
import java.text.SimpleDateFormat
import java.util.*
class DetailFragment : Fragment() {
private var isLiked = false
private lateinit var competition: Competition
private val viewModel: DetailViewModel by viewModels()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_detail, container, false)
val id = arguments?.getInt("idItem")!!
viewModel.competition.observe(viewLifecycleOwner, Observer { comp ->
comp?.let {
competition = comp
initializeView(view)
initRecyclerView(view)
}
})
viewModel.loadCurrentCompetition(id)
viewModel.nbCompetitionMatches.observe(viewLifecycleOwner, Observer { comp ->
comp?.let {
initNumberMatches(view)
}
})
viewModel.competitionMatches.observe(viewLifecycleOwner, Observer { competitions ->
competitions?.let {
initRecyclerView(view)
viewModel.loadNumberMatches()
}
})
viewModel.loadMatches(id)
return view;
}
private fun initializeView(view: View) {
val button = view.findViewById<ImageButton>(R.id.buttonLike)
val buttonExit = view.findViewById<ImageButton>(R.id.buttonExit)
val imageHeader = view.findViewById<ImageView>(R.id.imageDetail)
val titleHeader = view.findViewById<TextView>(R.id.title)
val nbMatches = view.findViewById<TextView>(R.id.nbMatches)
val dateEnd = view.findViewById<TextView>(R.id.dateEnd)
val dateStart = view.findViewById<TextView>(R.id.dateStart)
buttonExit.setOnClickListener {
findNavController().navigate(R.id.favoriteFragment)
}
button.setOnClickListener {
isLiked = !isLiked
button.setImageResource(if (isLiked) R.drawable.full_like else R.drawable.empty_like)
}
Glide.with(view.context)
.load(competition.emblem)
.error(R.drawable.imagenotfound)
.into(imageHeader)
titleHeader.text = competition.name
var date = competition.currentSeason.endDate
var formatter = SimpleDateFormat("dd-MM-yyyy", Locale.US)
var formattedDate = formatter.format(date.time)
dateEnd.text = formattedDate
date = competition.currentSeason.startDate
formatter = SimpleDateFormat("dd-MM-yyyy", Locale.US)
formattedDate = formatter.format(date.time)
dateStart.text = formattedDate
}
private fun initNumberMatches(view: View) {
val nbMatches = view.findViewById<TextView>(R.id.nbMatches)
nbMatches.text = viewModel.nbCompetitionMatches.value.toString()
}
private fun initRecyclerView(view: View) {
val recyclerViewMatches = view.findViewById<RecyclerView>(R.id.listRecentsMatches)
with(recyclerViewMatches) {
layoutManager = LinearLayoutManager(view.context)
adapter = viewModel.competitionMatches.value?.toList()?.let {
MatchesAdapter(
it.toTypedArray()
)
}
}
}
}

@ -6,73 +6,50 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageButton
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.R
import uca.iut.clermont.model.Competition
import uca.iut.clermont.model.Match
import uca.iut.clermont.view.adapter.FavoritesAdapter
import uca.iut.clermont.view.viewModel.FavoriteViewModel
class FavoriteFragment : Fragment(), FavoritesAdapter.OnItemClickListener {
private val viewModel: FavoriteViewModel by viewModels()
import uca.iut.clermont.view.adapter.MatchesAdapter
class FavoriteFragment: Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_favorite, container, false)
viewModel.competitions.observe(viewLifecycleOwner, Observer { competitions ->
competitions?.let {
initRecyclerView(view, competitions, this)
}
})
viewModel.loadCompetitions()
initializeView(view)
return view
}
private fun navigate() {
findNavController().navigate(R.id.homeFragment)
}
val view = inflater.inflate(R.layout.fragment_favorite, container, false)
private fun initializeView(view: View) {
val buttonHome = view.findViewById<ImageButton>(R.id.buttonHome)
val competitions = (activity as MainActivity).manager.competitionsMgr.getItems()
var buttonHome = view.findViewById<ImageButton>(R.id.buttonHome)
val buttonTextFavorite = view.findViewById<Button>(R.id.buttonTextHome)
buttonHome.setOnClickListener {
navigate()
}
buttonTextFavorite.setOnClickListener {
navigate()
}
initRecyclerView(view, competitions)
return view
}
private fun initRecyclerView(
view: View,
favorites: List<Competition>,
listener: FavoritesAdapter.OnItemClickListener
) {
fun navigate() {
findNavController().navigate(R.id.homeFragment)
}
private fun initRecyclerView(view: View, favorites: List<Competition>) {
val recyclerViewFavorites = view.findViewById<RecyclerView>(R.id.listFavorites)
with(recyclerViewFavorites) {
layoutManager = LinearLayoutManager(view.context)
adapter = FavoritesAdapter(favorites.toList().toTypedArray(), listener)
adapter = FavoritesAdapter(favorites.toList().toTypedArray())
}
}
override fun onItemClick(position: Int) {
val competitions = viewModel.competitions.value!!
val bundle = bundleOf("idItem" to competitions[position].id)
findNavController().navigate(R.id.action_favoriteFragment_to_detailFragment, bundle)
}
}

@ -5,22 +5,16 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.R
import uca.iut.clermont.model.Match
import uca.iut.clermont.view.adapter.MatchesAdapter
import uca.iut.clermont.view.viewModel.HomeViewModel
class HomeFragment : Fragment() {
val viewModel: HomeViewModel by viewModels()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -28,31 +22,15 @@ class HomeFragment : Fragment() {
): View? {
val view = inflater.inflate(R.layout.fragment_home, container, false)
val matches = (activity as MainActivity).manager.matchesMgr.getItems()
val buttonFavorite = view.findViewById<ImageButton>(R.id.buttonFavorite)
val restartMatches = view.findViewById<ImageButton>(R.id.restartMatches)
val text = view.findViewById<TextView>(R.id.textEmpty)
viewModel.matches.observe(viewLifecycleOwner, Observer { matches ->
matches?.let {
if (it.isNotEmpty()) {
initRecyclerView(view, it)
} else {
text.setText(R.string.noMatches)
}
}
})
displayMatches()
buttonFavorite.setOnClickListener {
findNavController().navigate(R.id.favoriteFragment)
}
restartMatches.setOnClickListener {
displayMatches()
}
initRecyclerView(view, matches)
return view
}
@ -61,12 +39,11 @@ class HomeFragment : Fragment() {
with(recyclerViewMatches) {
layoutManager = LinearLayoutManager(view.context)
adapter = MatchesAdapter(matches.toList().toTypedArray())
}
}
private fun displayMatches() {
viewModel.loadMatches()
}
}

@ -19,6 +19,7 @@ class MainActivity : AppCompatActivity() {
private lateinit var navController: NavController
@RequiresApi(Build.VERSION_CODES.R)
private fun hideSystemUI() {
WindowCompat.setDecorFitsSystemWindows(window, false)
@ -33,6 +34,7 @@ class MainActivity : AppCompatActivity() {
}
@RequiresApi(Build.VERSION_CODES.R)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -41,13 +43,13 @@ class MainActivity : AppCompatActivity() {
supportActionBar?.hide()
manager.initTeams()
manager.initCompetitions()
manager.initMatches()
manager.initCompetitions()
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment
navHostFragment.navController
val navController = navHostFragment.navController
}

@ -1,5 +1,6 @@
package uca.iut.clermont.view
import android.animation.ObjectAnimator
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorEvent
@ -9,21 +10,20 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.ImageView
import androidx.core.view.marginStart
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import uca.iut.clermont.R
class StartFragment : Fragment(), SensorEventListener {
class StartFragment : Fragment(), SensorEventListener {
private lateinit var ball: ImageView
private lateinit var sensorManager: SensorManager
private var accelerometer: Sensor? = null
private var lastUpdate: Long = 0
private var xPosition = 600f
private lateinit var accelerometer: Sensor
private var lastX = 0f
private var lastY = 0f
private var lastZ = 0f
override fun onCreateView(
inflater: LayoutInflater,
@ -34,22 +34,44 @@ class StartFragment : Fragment(), SensorEventListener {
val view = inflater.inflate(R.layout.fragment_start, container, false)
ball = view.findViewById(R.id.ball)
sensorManager = activity?.getSystemService(Context.SENSOR_SERVICE) as SensorManager
accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL)
return view
}
override fun onSensorChanged(event: SensorEvent) {
val x = event.values[0]
val y = event.values[1]
val z = event.values[2]
val buttonFavorite = view.findViewById<ImageButton>(R.id.nextButton)
val angleX = x / 9.81f
val angleY = y / 9.81f
buttonFavorite.setOnClickListener {
findNavController().navigate(R.id.homeFragment)
if (Math.abs(angleX) > 0.1) {
// Déplacer la balle à droite ou à gauche en fonction de la direction du mouvement
val deltaX = angleX * 20f // La vitesse de déplacement est de 20 pixels par seconde
ObjectAnimator.ofFloat(ball, View.TRANSLATION_X, ball.x + deltaX).start()
// Faire tourner la balle pendant qu'elle se déplace
ObjectAnimator.ofFloat(ball, View.ROTATION, -angleX * 70f).start()
}
return view
lastX = x
lastY = y
lastZ = z
}
override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) {
}
override fun onResume() {
super.onResume()
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_UI)
lastUpdate = System.currentTimeMillis()
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL)
}
override fun onPause() {
@ -57,43 +79,4 @@ class StartFragment : Fragment(), SensorEventListener {
sensorManager.unregisterListener(this)
}
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
// not used
}
override fun onSensorChanged(event: SensorEvent?) {
if (event?.sensor?.type == Sensor.TYPE_ACCELEROMETER) {
val curTime = System.currentTimeMillis()
if ((curTime - lastUpdate) > 10) {
val x = event.values[0] * 6f
val width = ball.width
val margin = ball.marginStart
val maxXPosition = (ball.parent as View).width - width - margin.toFloat()
val newXPosition = xPosition - x
if (newXPosition < 0) {
xPosition = 0f
ball.clearAnimation()
} else if (newXPosition > maxXPosition) {
xPosition = maxXPosition
ball.clearAnimation()
} else {
xPosition = newXPosition
}
val rotation = x * 5
ball.post {
val rotationDirection = if (x > 0) -1 else 1
ball.rotation = ball.rotation + rotationDirection * rotation
}
ball.x = xPosition
lastUpdate = curTime
ball.animate().x(xPosition)
}
}
}
}
}

@ -1,44 +1,20 @@
package uca.iut.clermont.view.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 com.bumptech.glide.Glide
import uca.iut.clermont.R
import uca.iut.clermont.model.Competition
import uca.iut.clermont.view.viewHolder.FavoriteHolder
class FavoritesAdapter(
private val favoriteCompetition: Array<Competition>,
private val listener: OnItemClickListener,
) :
RecyclerView.Adapter<FavoritesAdapter.FavoriteHolder>() {
inner class FavoriteHolder(view: View) : RecyclerView.ViewHolder(view), View.OnClickListener {
val imageFavorites: ImageView
val textFavorites: TextView
init {
itemView.setOnClickListener(this)
imageFavorites = view.findViewById(R.id.imageFavorites)
textFavorites = view.findViewById(R.id.textFavorites)
}
override fun onClick(v: View?) {
val position = adapterPosition
listener.onItemClick(position)
}
class FavoritesAdapter(private val favoriteCompetition: Array<Competition> ) : RecyclerView.Adapter<FavoriteHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FavoriteHolder {
return FavoriteHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_favorite, parent, false)
)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = FavoriteHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_favorite, parent, false)
)
override fun onBindViewHolder(holder: FavoriteHolder, position: Int) {
holder.textFavorites.text = favoriteCompetition[position].name
@ -46,14 +22,9 @@ class FavoritesAdapter(
.load(favoriteCompetition[position].emblem)
.error(R.drawable.imagenotfound)
.into(holder.imageFavorites)
}
interface OnItemClickListener {
fun onItemClick(position: Int)
}
override fun getItemCount() = favoriteCompetition.size
}

@ -3,81 +3,22 @@ package uca.iut.clermont.view.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import uca.iut.clermont.R
import uca.iut.clermont.model.Match
import uca.iut.clermont.view.viewHolder.MatchHolder
import java.text.SimpleDateFormat
import java.util.*
class MatchesAdapter(private val recentMatches: Array<Match>) :
RecyclerView.Adapter<MatchHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = MatchHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_match, parent, false)
)
class MatchesAdapter(private val recentMatches: Array<Match>) : RecyclerView.Adapter<MatchHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MatchHolder {
return MatchHolder(
LayoutInflater.from(parent.context).inflate(R.layout.cellule_match, parent, false)
)
}
override fun onBindViewHolder(holder: MatchHolder, position: Int) {
holder.titleFirstTeam.text = recentMatches[position].homeTeam.name
holder.titleSecondTeam.text = recentMatches[position].awayTeam.name
if (recentMatches[position].score.home != null) {
holder.scoreHomeTeam.text = recentMatches[position].score.home.toString()
} else {
holder.scoreHomeTeam.text = "0"
}
if (recentMatches[position].score.away != null) {
holder.scoreAwayTeam.text = recentMatches[position].score.away.toString()
} else {
holder.scoreAwayTeam.text = "0"
}
val date = recentMatches[position].date
val formatter = SimpleDateFormat("dd/MM/yyyy' 'HH:mm", Locale.US)
val formattedDate = formatter.format(date.time)
with(holder.iconStatus) {
setImageResource(R.drawable.mi_temp)
layoutParams.width = 0
layoutParams.height = 0
(layoutParams as ViewGroup.MarginLayoutParams).apply {
topMargin = 8
bottomMargin = 7
}
}
if (recentMatches[position].status == "IN_PLAY") {
with(holder.iconStatus) {
setImageResource(R.drawable.live)
layoutParams.width = 130
layoutParams.height = 130
(layoutParams as ViewGroup.MarginLayoutParams).apply {
topMargin = 0
bottomMargin = 0
}
}
}
if (recentMatches[position].status == "PAUSED") {
with(holder.iconStatus) {
setImageResource(R.drawable.mi_temp)
layoutParams.width = 100
layoutParams.height = 100
}
}
holder.dateCompetition.text =
recentMatches[position].competition.name.plus(" : ").plus(formattedDate)
Glide.with(holder.itemView.context)
.load(recentMatches[position].homeTeam.crest)
.error(R.drawable.imagenotfound)
.into(holder.imageHomeTeam)
Glide.with(holder.itemView.context)
.load(recentMatches[position].awayTeam.crest)
.error(R.drawable.imagenotfound)
.into(holder.imageAwayTeam)
holder.scoreHomeTeam.text = recentMatches[position].score.home.toString()
holder.scoreAwayTeam.text = recentMatches[position].score.away.toString()
}
override fun getItemCount() = recentMatches.size

@ -0,0 +1,17 @@
package uca.iut.clermont.view.viewHolder
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.R
class FavoriteHolder(view: View) : RecyclerView.ViewHolder(view) {
val imageFavorites: ImageView
val textFavorites: TextView
init {
imageFavorites = view.findViewById(R.id.imageFavorites)
textFavorites = view.findViewById(R.id.textFavorites)
}
}

@ -1,7 +1,6 @@
package uca.iut.clermont.view.viewHolder
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import uca.iut.clermont.R
@ -11,21 +10,12 @@ class MatchHolder(view: View) : RecyclerView.ViewHolder(view) {
val titleSecondTeam: TextView
val scoreHomeTeam: TextView
val scoreAwayTeam: TextView
val imageHomeTeam: ImageView
val imageAwayTeam: ImageView
val iconStatus: ImageView
val dateCompetition: TextView
init {
titleFirstTeam = view.findViewById(R.id.TitleFirstTeam)
titleSecondTeam = view.findViewById(R.id.TitleSecondTeam)
scoreHomeTeam = view.findViewById(R.id.ScoreHomeTeam)
scoreAwayTeam = view.findViewById(R.id.ScoreAwayTeam)
imageHomeTeam = view.findViewById(R.id.ImageFirstTeam)
imageAwayTeam = view.findViewById(R.id.ImageSecondTeam)
dateCompetition = view.findViewById(R.id.DateCompetition)
iconStatus = view.findViewById(R.id.iconStatus)
}

@ -1,45 +0,0 @@
package uca.iut.clermont.view.viewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import uca.iut.clermont.api.ApiManager
import uca.iut.clermont.model.Competition
import uca.iut.clermont.model.Match
import java.util.*
class DetailViewModel(
//val dao: CompetitionDao
) : ViewModel() {
val manager = ApiManager()
val competition = MutableLiveData<Competition?>()
val competitionMatches = MutableLiveData<List<Match>>()
val nbCompetitionMatches = MutableLiveData<Int>()
/*fun insertCompetition(competition: Competition) =
viewModelScope.launch {
dao.insertCompetition(competition)
}
*/
fun loadCurrentCompetition(id: Int) = viewModelScope.launch {
val result = manager.competitionsMgr.getItemById(id)
competition.value = result
}
fun loadMatches(id: Int) = viewModelScope.launch {
val matchResults = manager.matchesMgr.getItemsByCompetition(id)
competitionMatches.value =
matchResults.filter { it.status != "TIMED" && it.status != "SCHEDULED" && it.status != "POSTPONED" }
.apply { forEach { it.date.add(Calendar.HOUR_OF_DAY, 2) } }
.sortedBy { it.competition.name }
.sortedByDescending { it.date }
}
fun loadNumberMatches() = viewModelScope.launch {
nbCompetitionMatches.value = competitionMatches.value?.size
}
}

@ -1,25 +0,0 @@
package uca.iut.clermont.view.viewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import uca.iut.clermont.api.ApiManager
import uca.iut.clermont.model.Competition
class FavoriteViewModel(
//val dao: CompetitionDao
) : ViewModel() {
val manager = ApiManager()
val competitions = MutableLiveData<List<Competition>>()
//fun getAllCompetitions() = dao.getAllCompetitions()
//.isLiveDate()
fun loadCompetitions() = viewModelScope.launch {
val result = manager.competitionsMgr.getItems()
competitions.value = result
}
}

@ -1,24 +0,0 @@
package uca.iut.clermont.view.viewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import uca.iut.clermont.api.ApiManager
import uca.iut.clermont.model.Match
import java.util.*
class HomeViewModel : ViewModel() {
val manager = ApiManager()
val matches = MutableLiveData<List<Match>?>()
fun loadMatches() = viewModelScope.launch {
val matchResults = manager.matchesMgr.getItems()
matches.value = matchResults.filter { it.status != "TIMED" }
.apply { forEach { it.date.add(Calendar.HOUR_OF_DAY, 2) } }
.sortedBy { it.competition.name }
.sortedByDescending { it.date }
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="30dp"
android:paddingVertical="30dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:id="@+id/exitContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/buttonHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/arrow"
android:contentDescription="@string/imageNotFound" />
<Button
android:id="@+id/buttonTextHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:fontFamily="@font/mulish_bold"
android:text="Exit"
android:textAllCaps="false"
android:textColor="@color/title"
android:textSize="26dp" />
</LinearLayout>
<TextView
android:id="@+id/textFavorites"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/mulish_black"
android:text="Favoris"
android:textColor="@color/title"
android:textSize="30dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/exitContainer" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listFavorites"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textFavorites" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,129 +0,0 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:paddingHorizontal="30dp">
<FrameLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textColor="@color/title"
android:textSize="20sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/buttonFavorite"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_gravity="end"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:src="@drawable/icon_like"
android:contentDescription="@string/imageNotFound" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textViewSubtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/mulish_black"
android:text="Welcome Back!"
android:textColor="@color/title"
android:textSize="28sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header" />
<LinearLayout
android:id="@+id/searchBarContainer"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:background="@drawable/background"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="16dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:contentDescription="search icon"
android:src="@drawable/search" />
<EditText
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:background="@android:color/transparent"
android:drawablePadding="8dp"
android:hint="Search for a league, team, etc."
android:inputType="text"
android:maxLines="1"
android:textColorHint="#B0B0B0"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:orientation="vertical">
<TextView
android:id="@+id/textViewRecentMatches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recent Matches"
android:textColor="@color/title"
android:textSize="30dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchBarContainer" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listRecentsMatches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches"
tools:itemCount="10" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -11,12 +11,13 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:defaultNavHost="true"
app:navGraph="@navigation/my_nav" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,11 +1,11 @@
<?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"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/border_rounded"
@ -19,8 +19,7 @@
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:contentDescription="@string/imageNotFound"/>
android:layout_marginVertical="10dp" />
<TextView
android:id="@+id/textFavorites"
@ -30,8 +29,10 @@
android:fontFamily="@font/mulish_bold"
android:maxLines="3"
android:textColor="@color/black"
android:textSize="18sp" />
android:textSize="18dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,61 +1,44 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_width="360dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginTop="10dp"
android:background="@drawable/background"
android:gravity="center"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingHorizontal="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iconStatus"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_gravity="end"
android:layout_marginTop="8dp"
android:layout_marginBottom="7dp"
android:contentDescription="@string/imageNotFound" />
</FrameLayout>
<TextView
android:id="@+id/DateCompetition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:ellipsize="end"
android:fontFamily="@font/mulish_bold"
android:maxLines="1"
android:text="Champions League - Groupe Stage: Matchay"
android:textColor="@color/title"
android:textSize="15sp"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
@ -126,7 +109,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView

@ -1,211 +1,6 @@
<?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=".view.DetailFragment">
<ImageView
android:id="@+id/imageDetail"
android:layout_width="220dp"
android:layout_height="0dp"
android:layout_marginTop="30dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/buttonExit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:background="@android:color/transparent"
android:src="@drawable/exit_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/buttonLike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:background="@android:color/transparent"
android:src="@drawable/empty_like"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/mulish_black"
android:textColor="@color/black"
android:textSize="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageDetail" />
<TextView
android:id="@+id/currentSeason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:fontFamily="@font/mulish_bold"
android:text="Current season"
android:textColor="@color/title"
android:textSize="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
<LinearLayout
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/currentSeason">
<LinearLayout
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/background"
android:gravity="center"
android:orientation="vertical"
android:paddingHorizontal="10dp">
<TextView
android:id="@+id/dateStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="2"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="20dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#E1DFDF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="1"
android:text="Start"
android:textColor="@color/text"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="vertical"
android:paddingHorizontal="10dp">
<TextView
android:id="@+id/nbMatches"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="1"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="26dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#E1DFDF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="1"
android:text="Number matches"
android:textColor="@color/text"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/background"
android:gravity="center"
android:orientation="vertical"
android:paddingHorizontal="10dp">
<TextView
android:id="@+id/dateEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="3"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="20dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#E1DFDF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:fontFamily="@font/mulish_bold"
android:maxLines="1"
android:text="End"
android:textColor="@color/text"
android:textSize="18dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/latestMatch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/mulish_bold"
android:text="Latest Match"
android:textColor="@color/title"
android:textSize="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listRecentsMatches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingHorizontal="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/latestMatch"
tools:itemCount="100" />
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -22,8 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/arrow"
android:contentDescription="@string/imageNotFound" />
android:src="@drawable/arrow" />
<Button
android:id="@+id/buttonTextHome"
@ -32,9 +31,9 @@
android:background="@android:color/transparent"
android:fontFamily="@font/mulish_bold"
android:text="Exit"
android:textAllCaps="false"
android:textColor="@color/title"
android:textSize="26dp" />
android:textSize="26dp"
android:textAllCaps="false" />
</LinearLayout>

@ -20,7 +20,7 @@
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:text="Hello"
android:textColor="@color/title"
android:textSize="20sp"
android:textStyle="bold" />
@ -29,11 +29,10 @@
android:id="@+id/buttonFavorite"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_gravity="end"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:src="@drawable/icon_like"
android:contentDescription="@string/imageNotFound" />
android:src="@drawable/icon_like" />
</FrameLayout>
@ -89,44 +88,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Recent Matches Day"
android:text="Recent Matches"
android:textColor="@color/title"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchBarContainer" />
<ImageButton
android:id="@+id/restartMatches"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="20dp"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:src="@drawable/restart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/searchBarContainer" />
<TextView
android:id="@+id/textEmpty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/title"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listRecentsMatches"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingBottom="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches"
tools:itemCount="10" />
app:layout_constraintTop_toBottomOf="@+id/textViewRecentMatches" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,59 +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"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ball"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ball"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/imageNotFound" />
<ImageView
android:id="@+id/shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/shadow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ball" />
<LinearLayout
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/shadow">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/mulish_black"
android:text="Continuer"
android:textColor="@color/title"
android:textSize="32sp" />
<ImageButton
android:id="@+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@android:color/transparent"
android:src="@drawable/button_next" />
</LinearLayout>
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -7,9 +7,9 @@
<fragment
android:id="@+id/startFragment"
android:name="uca.iut.clermont.view.StartFragment"
android:label="StartFragment">
android:label="StartFragment" >
<action
android:id="@+id/action_startFragment_to_detailFragment"
android:id="@+id/action_startFragment_to_homeFragment2"
app:destination="@id/homeFragment" />
</fragment>
@ -29,17 +29,6 @@
<action
android:id="@+id/action_favoriteFragment_to_homeFragment"
app:destination="@id/homeFragment" />
<action
android:id="@+id/action_favoriteFragment_to_detailFragment"
app:destination="@id/detailFragment" />
</fragment>
<fragment
android:id="@+id/detailFragment"
android:name="uca.iut.clermont.view.DetailFragment"
android:label="DetailFragment">
<action
android:id="@+id/action_detailFragment_to_favoriteFragment"
app:destination="@id/favoriteFragment" />
</fragment>
</navigation>

@ -1,7 +1,3 @@
<resources>
<string name="app_name">Scor_It</string>
<string name="noMatches">No games started yet!</string>
<string name="imageNotFound">Image not found</string>
<string name="hello">Hello</string>
</resources>
Loading…
Cancel
Save