Compare commits
37 Commits
Stub_Recyc
...
master
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,123 @@
|
||||
<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>
|
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
@ -1,4 +0,0 @@
|
||||
<changelist name="Uncommitted_changes_before_Update_at_21_03_2023_09_05_[Changes]" date="1679385937643" recycled="true" deleted="true">
|
||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_21_03_2023_09_05_[Changes]/shelved.patch" />
|
||||
<option name="DESCRIPTION" value="Uncommitted changes before Update at 21/03/2023 09:05 [Changes]" />
|
||||
</changelist>
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,12 @@
|
||||
<?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>
|
@ -0,0 +1,10 @@
|
||||
<?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>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,119 @@
|
||||
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")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
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
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package uca.iut.clermont.api.response.areaResponse
|
||||
|
||||
import uca.iut.clermont.model.Area
|
||||
|
||||
data class AreaResponse(
|
||||
val areas: List<Area>,
|
||||
val count: Int
|
||||
)
|
@ -0,0 +1,7 @@
|
||||
package uca.iut.clermont.api.response.competitionResponse
|
||||
|
||||
data class CompetitionResponse(
|
||||
val competitions: List<CompetitionResult>,
|
||||
val count: Int,
|
||||
val filters: Filters
|
||||
)
|
@ -0,0 +1,24 @@
|
||||
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
|
||||
)
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package uca.iut.clermont.api.response.competitionResponse
|
||||
|
||||
data class Filters(
|
||||
val client: String
|
||||
)
|
@ -0,0 +1,7 @@
|
||||
package uca.iut.clermont.api.response.matchResponse
|
||||
|
||||
data class Filters(
|
||||
val dateFrom: String,
|
||||
val dateTo: String,
|
||||
val permission: String
|
||||
)
|
@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package uca.iut.clermont.api.response.matchResponse
|
||||
|
||||
data class MatchResponse(
|
||||
val filters: Filters,
|
||||
val matches: List<MatchResult>,
|
||||
val resultSet: ResultSet
|
||||
)
|
@ -0,0 +1,32 @@
|
||||
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)
|
||||
|
||||
)
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
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
|
||||
)
|
@ -0,0 +1,16 @@
|
||||
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
|
||||
)
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
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()
|
||||
|
||||
)
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package uca.iut.clermont.api.response.matchResponse
|
||||
|
||||
data class Time(
|
||||
val away: Int?,
|
||||
val home: Int?
|
||||
)
|
@ -0,0 +1,6 @@
|
||||
package uca.iut.clermont.api.response.playerResponse
|
||||
|
||||
data class ContractResponse(
|
||||
val start: String,
|
||||
val until: String
|
||||
)
|
@ -0,0 +1,7 @@
|
||||
package uca.iut.clermont.api.response.playerResponse
|
||||
|
||||
data class CurrentTeamResponse(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val contract: ContractResponse
|
||||
)
|
@ -0,0 +1,38 @@
|
||||
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
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
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)
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
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 getItemsByName(substring: String): List<Match> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
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,11 +1,16 @@
|
||||
package uca.iut.clermont.model
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "competitions")
|
||||
class Competition(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
val code: String,
|
||||
val type: String,
|
||||
val emblem: String,
|
||||
val currentSeason: Season,
|
||||
@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 area: Area
|
||||
)
|
@ -1,7 +1,6 @@
|
||||
package uca.iut.clermont.model
|
||||
|
||||
interface GenericDataManager<T> {
|
||||
fun getItemsByName(substring: String): List<T>
|
||||
fun getItems(): List<T>
|
||||
fun getItemById(id: Int): T?
|
||||
suspend fun getItems(): List<T>
|
||||
suspend fun getItemById(id: Int): T?
|
||||
}
|
@ -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,11 +1,11 @@
|
||||
package uca.iut.clermont.model
|
||||
|
||||
import java.util.Date
|
||||
import java.util.Calendar
|
||||
|
||||
class Season(
|
||||
val id: Int,
|
||||
val startDate: Date,
|
||||
val endDate: Date,
|
||||
val startDate: Calendar,
|
||||
val endDate: Calendar,
|
||||
val currentMatchday: Int,
|
||||
val winner: Int
|
||||
val winner: Int?
|
||||
)
|
@ -0,0 +1,129 @@
|
||||
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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package uca.iut.clermont.view
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import uca.iut.clermont.R
|
||||
|
||||
class FavoriteActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_favorite)
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package uca.iut.clermont.view
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
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.view.adapter.FavoritesAdapter
|
||||
import uca.iut.clermont.view.viewModel.FavoriteViewModel
|
||||
|
||||
class FavoriteFragment : Fragment(), FavoritesAdapter.OnItemClickListener {
|
||||
|
||||
private val viewModel: FavoriteViewModel by viewModels()
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
private fun initializeView(view: View) {
|
||||
val buttonHome = view.findViewById<ImageButton>(R.id.buttonHome)
|
||||
val buttonTextFavorite = view.findViewById<Button>(R.id.buttonTextHome)
|
||||
|
||||
buttonHome.setOnClickListener {
|
||||
navigate()
|
||||
}
|
||||
buttonTextFavorite.setOnClickListener {
|
||||
navigate()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initRecyclerView(
|
||||
view: View,
|
||||
favorites: List<Competition>,
|
||||
listener: FavoritesAdapter.OnItemClickListener
|
||||
) {
|
||||
val recyclerViewFavorites = view.findViewById<RecyclerView>(R.id.listFavorites)
|
||||
with(recyclerViewFavorites) {
|
||||
layoutManager = LinearLayoutManager(view.context)
|
||||
adapter = FavoritesAdapter(favorites.toList().toTypedArray(), listener)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package uca.iut.clermont.view
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import uca.iut.clermont.R
|
||||
import uca.iut.clermont.data.StubData
|
||||
import uca.iut.clermont.view.adapter.MatchesAdapter
|
||||
|
||||
class HomeActivity : Activity() {
|
||||
|
||||
private var manager = StubData()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_home)
|
||||
//val imageFirstTeam = findViewById<ImageView>(R.id.ImageFirstTeam)
|
||||
|
||||
val adapterMatches = findViewById<RecyclerView>(R.id.ListRecentsMatches)
|
||||
|
||||
with(adapterMatches) {
|
||||
adapter = MatchesAdapter(manager.matchesMgr.getItems().toList().toTypedArray())
|
||||
}
|
||||
|
||||
adapterMatches.layoutManager = LinearLayoutManager(this)
|
||||
|
||||
adapterMatches
|
||||
|
||||
/*Glide.with(this)
|
||||
.load("https://crests.football-data.org/1765.svg")
|
||||
.error(R.drawable.imagenotfound)
|
||||
.into(imageFirstTeam)*/
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
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.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?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
|
||||
val view = inflater.inflate(R.layout.fragment_home, container, false)
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
private fun initRecyclerView(view: View, matches: List<Match>) {
|
||||
val recyclerViewMatches = view.findViewById<RecyclerView>(R.id.listRecentsMatches)
|
||||
with(recyclerViewMatches) {
|
||||
layoutManager = LinearLayoutManager(view.context)
|
||||
adapter = MatchesAdapter(matches.toList().toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
private fun displayMatches() {
|
||||
viewModel.loadMatches()
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package uca.iut.clermont.view
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import uca.iut.clermont.R
|
||||
import uca.iut.clermont.data.StubData
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
var manager = StubData()
|
||||
|
||||
private lateinit var navController: NavController
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun hideSystemUI() {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
WindowInsetsControllerCompat(
|
||||
window,
|
||||
window.decorView.findViewById(android.R.id.content)
|
||||
).let { controller ->
|
||||
controller.hide(WindowInsetsCompat.Type.systemBars())
|
||||
controller.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
hideSystemUI()
|
||||
setContentView(R.layout.activity_main)
|
||||
supportActionBar?.hide()
|
||||
|
||||
manager.initTeams()
|
||||
manager.initCompetitions()
|
||||
manager.initMatches()
|
||||
|
||||
val navHostFragment =
|
||||
supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment
|
||||
|
||||
navHostFragment.navController
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package uca.iut.clermont.view
|
||||
|
||||
import android.content.Context
|
||||
import android.hardware.Sensor
|
||||
import android.hardware.SensorEvent
|
||||
import android.hardware.SensorEventListener
|
||||
import android.hardware.SensorManager
|
||||
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 {
|
||||
|
||||
|
||||
private lateinit var ball: ImageView
|
||||
private lateinit var sensorManager: SensorManager
|
||||
private var accelerometer: Sensor? = null
|
||||
private var lastUpdate: Long = 0
|
||||
private var xPosition = 600f
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
|
||||
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)
|
||||
|
||||
val buttonFavorite = view.findViewById<ImageButton>(R.id.nextButton)
|
||||
|
||||
buttonFavorite.setOnClickListener {
|
||||
findNavController().navigate(R.id.homeFragment)
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_UI)
|
||||
lastUpdate = System.currentTimeMillis()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
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
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(favoriteCompetition[position].emblem)
|
||||
.error(R.drawable.imagenotfound)
|
||||
.into(holder.imageFavorites)
|
||||
|
||||
}
|
||||
|
||||
interface OnItemClickListener {
|
||||
fun onItemClick(position: Int)
|
||||
}
|
||||
|
||||
|
||||
override fun getItemCount() = favoriteCompetition.size
|
||||
|
||||
}
|
@ -1,16 +1,31 @@
|
||||
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 MatchHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val textView: TextView
|
||||
val titleFirstTeam: TextView
|
||||
val titleSecondTeam: TextView
|
||||
val scoreHomeTeam: TextView
|
||||
val scoreAwayTeam: TextView
|
||||
val imageHomeTeam: ImageView
|
||||
val imageAwayTeam: ImageView
|
||||
val iconStatus: ImageView
|
||||
val dateCompetition: TextView
|
||||
|
||||
init {
|
||||
// Define click listener for the ViewHolder's View
|
||||
textView = view.findViewById(R.id.TitleFirstTeam)
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
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 }
|
||||
}
|
||||
|
||||
}
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 971 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 607 B |
@ -0,0 +1,59 @@
|
||||
<?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>
|
@ -0,0 +1,129 @@
|
||||
<?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>
|
@ -0,0 +1,22 @@
|
||||
<?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.MainActivity">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment"
|
||||
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:navGraph="@navigation/my_nav" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,211 @@
|
||||
<?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" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,59 @@
|
||||
<?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">
|
||||
|
||||
<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>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/my_nav"
|
||||
app:startDestination="@id/startFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/startFragment"
|
||||
android:name="uca.iut.clermont.view.StartFragment"
|
||||
android:label="StartFragment">
|
||||
<action
|
||||
android:id="@+id/action_startFragment_to_detailFragment"
|
||||
app:destination="@id/homeFragment" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/homeFragment"
|
||||
android:name="uca.iut.clermont.view.HomeFragment"
|
||||
android:label="HomeFragment">
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_favoriteFragment"
|
||||
app:destination="@id/favoriteFragment" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/favoriteFragment"
|
||||
android:name="uca.iut.clermont.view.FavoriteFragment"
|
||||
android:label="FavoriteFragment">
|
||||
<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,3 +1,7 @@
|
||||
<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>
|