1 Commits

Author SHA1 Message Date
334cc4cf6f WIP to get repository working 2022-11-06 21:24:41 +01:00
93 changed files with 708 additions and 832 deletions

9
.gitignore vendored
View File

@@ -1,11 +1,16 @@
*.iml *.iml
.gradle .gradle
/local.properties /local.properties
/.idea /.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store .DS_Store
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties local.properties
app/release app/release

3
.idea/.gitignore generated vendored Normal file
View File

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

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
Thuis

6
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

17
.idea/deploymentTargetDropDown.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_4_XL_API_31.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-11-06T10:26:15.426480Z" />
</component>
</project>

19
.idea/gradle.xml generated Normal file
View File

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

View File

@@ -0,0 +1,29 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
</profile>
</component>

10
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" 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>

6
.idea/vcs.xml generated Normal file
View File

@@ -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>

View File

@@ -5,14 +5,14 @@ plugins {
android { android {
namespace 'com.mitchelbv.thuis_c' namespace 'com.mitchelbv.thuis_c'
compileSdk 34 compileSdk 32
defaultConfig { defaultConfig {
applicationId "com.mitchelbv.thuis_c" applicationId "com.mitchelbv.thuis_c"
minSdk 30 minSdk 30
targetSdk 34 targetSdk 32
versionCode 3 versionCode 1
versionName "1.3" versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {
@@ -37,7 +37,7 @@ android {
compose true compose true
} }
composeOptions { composeOptions {
kotlinCompilerExtensionVersion '1.3.2' kotlinCompilerExtensionVersion '1.1.1'
} }
packagingOptions { packagingOptions {
resources { resources {
@@ -49,31 +49,33 @@ android {
dependencies { dependencies {
//Network //Network
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.9.1' implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
// Display images from the internet // Display images from the internet
implementation "io.coil-kt:coil-compose:2.2.2" implementation "io.coil-kt:coil-compose:2.2.2"
// Database // Database
implementation "androidx.room:room-runtime:2.5.0" implementation "androidx.room:room-runtime:2.4.3"
annotationProcessor("androidx.room:room-compiler:2.5.0") annotationProcessor("androidx.room:room-compiler:2.4.3")
// Navigation // Navigation
implementation "androidx.navigation:navigation-compose:2.5.3" implementation "androidx.navigation:navigation-compose:2.5.3"
// ViewModel // ViewModel and livedata
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.6.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.activity:activity-compose:1.3.1'
implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.compose.material3:material3:1.0.1' implementation 'androidx.compose.material3:material3:1.0.0-alpha02'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -3,12 +3,18 @@ package com.mitchelbv.thuis_c
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.List
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.navigation.NavDestination.Companion.hierarchy import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.NavGraph.Companion.findStartDestination
@@ -16,10 +22,7 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController import androidx.navigation.compose.rememberNavController
import com.mitchelbv.thuis_c.ui.card.CardsScreen
import com.mitchelbv.thuis_c.ui.feyenoord.FeyenoordScreen import com.mitchelbv.thuis_c.ui.feyenoord.FeyenoordScreen
import com.mitchelbv.thuis_c.ui.freezer.FreezerScreen
import com.mitchelbv.thuis_c.ui.freezer.detailed.FreezerDetailedScreen
import com.mitchelbv.thuis_c.ui.home.HomeScreen import com.mitchelbv.thuis_c.ui.home.HomeScreen
import com.mitchelbv.thuis_c.ui.recipe.RecipeScreen import com.mitchelbv.thuis_c.ui.recipe.RecipeScreen
import com.mitchelbv.thuis_c.ui.theme.ThuisTheme import com.mitchelbv.thuis_c.ui.theme.ThuisTheme
@@ -41,6 +44,12 @@ class MainActivity : ComponentActivity() {
} }
} }
sealed class Screen(val route: String, @StringRes val resourceId: Int, val icon: ImageVector) {
object Feyenoord : Screen("feyenoord", R.string.nav_feyenoord, Icons.Default.DateRange)
object Recipes : Screen("recipes", R.string.nav_recipes, Icons.Default.List)
object Home : Screen("home", R.string.nav_home, Icons.Default.Home)
}
val screenItems = listOf( val screenItems = listOf(
Screen.Home, Screen.Home,
Screen.Recipes, Screen.Recipes,
@@ -51,13 +60,13 @@ val screenItems = listOf(
@Composable @Composable
fun ThuisApp() { fun ThuisApp() {
val navController = rememberNavController() val navController = rememberNavController()
val navBackStackEntry by navController.currentBackStackEntryAsState()
Scaffold( Scaffold(
topBar = { topBar = {
TopAppBar(title = { Text(stringResource(id = R.string.app_name))}) SmallTopAppBar(title = { Text(stringResource(id = R.string.app_name))})
}, },
bottomBar = { bottomBar = {
NavigationBar { NavigationBar {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination val currentDestination = navBackStackEntry?.destination
screenItems.forEach { screen -> screenItems.forEach { screen ->
NavigationBarItem( NavigationBarItem(
@@ -81,10 +90,6 @@ fun ThuisApp() {
composable("home") { HomeScreen(navController) } composable("home") { HomeScreen(navController) }
composable("feyenoord") { FeyenoordScreen(navHostController = navController) } composable("feyenoord") { FeyenoordScreen(navHostController = navController) }
composable("recipes") { RecipeScreen(navHostController = navController)} composable("recipes") { RecipeScreen(navHostController = navController)}
composable("freezer") {FreezerScreen(navHostController = navController)}
composable("cards") { CardsScreen(navHostController = navController) }
composable("freezer-details/{freezerId}") { backStackEntry -> FreezerDetailedScreen(navHostController = navController, freezerId = backStackEntry.arguments?.getString("freezerId")) }
composable("freezer-edit") { CardsScreen(navHostController = navController) }
} }
} }
} }

View File

@@ -1,17 +0,0 @@
package com.mitchelbv.thuis_c
import androidx.annotation.StringRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.navigation.NavArgs
sealed class Screen(val route: String, @StringRes val resourceId: Int, val icon: ImageVector) {
object Feyenoord : Screen("feyenoord", R.string.nav_feyenoord, Icons.Default.DateRange)
object Recipes : Screen("recipes", R.string.nav_recipes, Icons.Default.List)
object Home : Screen("home", R.string.nav_home, Icons.Default.Home)
object Cards : Screen("cards", R.string.home_card_cards, Icons.Default.Call)
object Freezer : Screen("freezer", R.string.home_card_freezer, Icons.Default.DateRange)
object FreezerDetails : Screen("freezer-details", R.string.home_card_freezer, Icons.Default.ShoppingCart)
object FreezerEdit : Screen("freezer-edit", R.string.edit_freezer, Icons.Default.Call)
}

View File

@@ -0,0 +1,32 @@
package com.mitchelbv.thuis_c.database
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.mitchelbv.thuis_c.ui.feyenoord.Match
@Entity
data class DatabaseMatches constructor(
@PrimaryKey(autoGenerate = true)
val id: Int,
val home_team: String,
val away_team: String,
val date: String,
val begin_time: String,
val end_time: String,
val home_image: String,
val away_image: String
)
fun List<DatabaseMatches>.asDomainModel(): List<Match> {
return map {
Match(
home_team = it.home_team,
away_team = it.away_team,
date = it.date,
begin_time = it.begin_time,
end_time = it.end_time,
home_image = it.home_image,
away_image = it.away_image
)
}
}

View File

@@ -0,0 +1,42 @@
package com.mitchelbv.thuis_c.database
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.room.*
import kotlinx.coroutines.withContext
@Dao
interface MatchDao {
@Query("select * from databasematches")
fun getMatches(): LiveData<List<DatabaseMatches>>
@Query("select * from databasematches order by id ASC")
fun getUpcomingMatch(): LiveData<DatabaseMatches>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertAll(matches: List<DatabaseMatches>)
}
@Database(entities = [DatabaseMatches::class], version = 1)
abstract class MatchesDatabase : RoomDatabase() {
abstract val matchDao: MatchDao
companion object {
@Volatile
private lateinit var INSTANCE: MatchesDatabase
fun getDatabase(context: Context): MatchesDatabase {
synchronized(MatchesDatabase::class.java) {
if (!::INSTANCE.isInitialized) {
INSTANCE = Room.databaseBuilder(
context.applicationContext,
MatchesDatabase::class.java,
"matches"
).build()
}
}
return INSTANCE
}
}
}

View File

@@ -0,0 +1,16 @@
package com.mitchelbv.thuis_c.network.card
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
object CardRetrofitHelper {
val baseUrl = "https://10.0.2.2:7239/"
fun getInstance(): Retrofit {
return Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
}

View File

@@ -0,0 +1,13 @@
package com.mitchelbv.thuis_c.network.card
import com.mitchelbv.thuis_c.network.card.responses.Card
import com.mitchelbv.thuis_c.network.card.responses.Cards
import retrofit2.http.GET
interface CardService {
@GET("Card")
suspend fun getCards(): Cards
@GET("Card/{id}")
suspend fun getCard(id: Int): Card
}

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.thuis.responses package com.mitchelbv.thuis_c.network.card.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.thuis.responses package com.mitchelbv.thuis_c.network.card.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName

View File

@@ -4,12 +4,12 @@ import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
object FeyenoordRetrofitHelper { object FeyenoordRetrofitHelper {
const val baseUrl = "https://feyenoord.api.tymes4-infra.com/v2/" val baseUrl = "https://tickets-api.feyenoord.nl/api/"
private val retrofit = Retrofit.Builder() private val retrofit = Retrofit.Builder()
.baseUrl(baseUrl) .baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.build() .build()
val feyenoord: FeyenoordService = retrofit.create(FeyenoordService::class.java) val feyenoord = retrofit.create(FeyenoordService::class.java)
} }

View File

@@ -1,14 +1,9 @@
package com.mitchelbv.thuis_c.network.feyenoord package com.mitchelbv.thuis_c.network.feyenoord
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordTokenResponse.FeyenoordTokenResponse import com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
import com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse.FeyenoordEventResponse
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Header
interface FeyenoordService { interface FeyenoordService {
@GET("Event") @GET("event")
suspend fun getEvents(@Header("Authorization") token: String): FeyenoordEventResponse suspend fun getEvents(): FeyenoordEventResponse
@GET("Account/default-token")
suspend fun getToken(): FeyenoordTokenResponse
} }

View File

@@ -1,28 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.FeyenoordTokenResponse
import com.google.gson.annotations.SerializedName
data class CurrentChannel(
@SerializedName("Id") var id: Int? = null,
@SerializedName("Name") var name: String? = null,
@SerializedName("Code") var code: String? = null,
@SerializedName("HexColor") var hexColor: String? = null,
@SerializedName("Active") var active: Boolean? = null,
@SerializedName("HexBackColor") var hexBackColor: String? = null,
@SerializedName("HexForeColor") var hexForeColor: String? = null,
@SerializedName("SalesGroupId") var salesGroupId: Int? = null,
@SerializedName("ShowMarketplaceForEvent") var showMarketplaceForEvent: Boolean? = null,
@SerializedName("RedirectToMarketplace") var redirectToMarketplace: Boolean? = null,
@SerializedName("AllowAnonymous") var allowAnonymous: Boolean? = null,
@SerializedName("ParentCode") var parentCode: String? = null,
@SerializedName("ParentId") var parentId: String? = null,
@SerializedName("UserSelectable") var userSelectable: Boolean? = null,
@SerializedName("HeaderImageId") var headerImageId: String? = null,
@SerializedName("HeaderImageFileName") var headerImageFileName: String? = null,
@SerializedName("HeaderImageUrl") var headerImageUrl: String? = null,
@SerializedName("TicketshopHeaderLinkText") var ticketshopHeaderLinkText: String? = null,
@SerializedName("CustomCSS") var customCSS: String? = null
)

View File

@@ -1,11 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.FeyenoordTokenResponse
import com.google.gson.annotations.SerializedName
data class FeyenoordTokenResponse(
@SerializedName("AuthResult") var authResult: Int? = null,
@SerializedName("Token") var token: String? = null,
@SerializedName("CurrentChannel") var currentChannel: CurrentChannel? = CurrentChannel(),
@SerializedName("SalesChannels") var salesChannels: ArrayList<SalesChannels> = arrayListOf(),
@SerializedName("IsArchiveMode") var isArchiveMode: Boolean? = null
)

View File

@@ -1,26 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.FeyenoordTokenResponse
import com.google.gson.annotations.SerializedName
data class SalesChannels(
@SerializedName("Id") var id: Int? = null,
@SerializedName("Name") var name: String? = null,
@SerializedName("Code") var code: String? = null,
@SerializedName("HexColor") var hexColor: String? = null,
@SerializedName("Active") var active: Boolean? = null,
@SerializedName("HexBackColor") var hexBackColor: String? = null,
@SerializedName("HexForeColor") var hexForeColor: String? = null,
@SerializedName("SalesGroupId") var salesGroupId: Int? = null,
@SerializedName("ShowMarketplaceForEvent") var showMarketplaceForEvent: Boolean? = null,
@SerializedName("RedirectToMarketplace") var redirectToMarketplace: Boolean? = null,
@SerializedName("AllowAnonymous") var allowAnonymous: Boolean? = null,
@SerializedName("ParentCode") var parentCode: String? = null,
@SerializedName("ParentId") var parentId: String? = null,
@SerializedName("UserSelectable") var userSelectable: Boolean? = null,
@SerializedName("HeaderImageId") var headerImageId: String? = null,
@SerializedName("HeaderImageFileName") var headerImageFileName: String? = null,
@SerializedName("HeaderImageUrl") var headerImageUrl: String? = null,
@SerializedName("TicketshopHeaderLinkText") var ticketshopHeaderLinkText: String? = null,
@SerializedName("CustomCSS") var customCSS: String? = null
)

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
@@ -8,8 +8,8 @@ data class ButtonData(
@SerializedName("EventId") var EventId: Int? = null, @SerializedName("EventId") var EventId: Int? = null,
@SerializedName("SaleCategoryId") var SaleCategoryId: Int? = null, @SerializedName("SaleCategoryId") var SaleCategoryId: Int? = null,
@SerializedName("TranslationCode") var TranslationCode: String? = null, @SerializedName("TranslationCode") var TranslationCode: String? = null,
@SerializedName("ButtonStyle") var ButtonStyle: String? = null, @SerializedName("ButtonStyle") var ButtonStyle: Int? = null,
@SerializedName("ActionType") var ActionType: String? = null, @SerializedName("ActionType") var ActionType: Int? = null,
@SerializedName("Action") var Action: String? = null, @SerializedName("Action") var Action: String? = null,
@SerializedName("ActiveFrom") var ActiveFrom: String? = null, @SerializedName("ActiveFrom") var ActiveFrom: String? = null,
@SerializedName("ActiveTill") var ActiveTill: String? = null, @SerializedName("ActiveTill") var ActiveTill: String? = null,

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName

View File

@@ -0,0 +1,19 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName
data class EventStartDateTimeFormatted (
@SerializedName("DateTime" ) var DateTime : String? = null,
@SerializedName("Full" ) var Full : String? = null,
@SerializedName("DateLong" ) var DateLong : String? = null,
@SerializedName("DateShort" ) var DateShort : String? = null,
@SerializedName("Time" ) var Time : String? = null,
@SerializedName("DayMonth" ) var DayMonth : String? = null,
@SerializedName("DayOfWeek" ) var DayOfWeek : Int? = null,
@SerializedName("Year" ) var Year : Int? = null,
@SerializedName("Month" ) var Month : Int? = null,
@SerializedName("Day" ) var Day : Int? = null
)

View File

@@ -0,0 +1,62 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName
import com.mitchelbv.thuis_c.database.DatabaseMatches
import com.mitchelbv.thuis_c.ui.feyenoord.Match
data class FeyenoordEventResponse(
@SerializedName("HeaderItem") var HeaderItem: HeaderItem? = HeaderItem(),
@SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(),
@SerializedName("CrossSellInfo") var CrossSellInfo: String? = null
)
fun notNullHandler(test: String?): String {
if (!test.isNullOrEmpty()) {
return test;
}
return ""
}
fun FeyenoordEventResponse.asDomainModel(): List<Match> {
val tempMatches = mutableListOf<Match>()
val test2 = TabItems.filter { it.CategoryId == 2 }
test2.forEach { items ->
for (item in items.Items) {
tempMatches.add(
Match(
home_team = notNullHandler(item.NameHomeTeam),
away_team = notNullHandler(item.NameAwayTeam),
date = notNullHandler(item.EventStartDateTimeFormatted?.Full),
begin_time = notNullHandler(item.EventStartDateTimeFormatted?.Time),
end_time = notNullHandler(item.EventEndDateTimeFormatted?.Time),
away_image = notNullHandler(item.AwayImageUrl),
home_image = notNullHandler(item.HomeImageUrl)
)
)
}
}
return tempMatches
}
fun FeyenoordEventResponse.asDatabaseModel(): List<DatabaseMatches> {
val tempMatches = mutableListOf<DatabaseMatches>()
val test2 = TabItems.filter { it.CategoryId == 2 }
test2.forEach { items ->
for (item in items.Items) {
tempMatches.add(
DatabaseMatches(
id = item.EventId!!,
home_team = notNullHandler(item.NameHomeTeam),
away_team = notNullHandler(item.NameAwayTeam),
date = notNullHandler(item.EventStartDateTimeFormatted?.Full),
begin_time = notNullHandler(item.EventStartDateTimeFormatted?.Time),
end_time = notNullHandler(item.EventEndDateTimeFormatted?.Time),
away_image = notNullHandler(item.AwayImageUrl),
home_image = notNullHandler(item.HomeImageUrl)
)
)
}
}
return tempMatches
}

View File

@@ -1,19 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
import com.google.gson.annotations.SerializedName
data class EventStartDateTimeFormatted(
@SerializedName("DateTime") var DateTime: String? = null,
@SerializedName("Full") var Full: String? = null,
@SerializedName("DateLong") var DateLong: String? = null,
@SerializedName("DateShort") var DateShort: String? = null,
@SerializedName("Time") var Time: String? = null,
@SerializedName("DayMonth") var DayMonth: String? = null,
@SerializedName("DayOfWeek") var DayOfWeek: Int? = null,
@SerializedName("Year") var Year: Int? = null,
@SerializedName("Month") var Month: Int? = null,
@SerializedName("Day") var Day: Int? = null
)

View File

@@ -1,10 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
import com.google.gson.annotations.SerializedName
data class FeyenoordEventResponse(
@SerializedName("HeaderItem") var HeaderItem: HeaderItem? = HeaderItem(),
@SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(),
@SerializedName("CrossSellInfo") var CrossSellInfo: String? = null
)

View File

@@ -1,63 +0,0 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
import com.google.gson.annotations.SerializedName
data class HeaderItem(
@SerializedName("DisplayCountdown") var DisplayCountdown: Boolean? = null,
@SerializedName("ShowResellInHeader") var ShowResellInHeader: Boolean? = null,
@SerializedName("ResellTicketsAllowed") var ResellTicketsAllowed: Boolean? = null,
@SerializedName("ResellTicketsFrom") var ResellTicketsFrom: String? = null,
@SerializedName("ResellTicketsTill") var ResellTicketsTill: String? = null,
@SerializedName("EventId") var EventId: Int? = null,
@SerializedName("SaleCategoryId") var SaleCategoryId: Int? = null,
@SerializedName("HasGeneralSale") var HasGeneralSale: Boolean? = null,
@SerializedName("VisibleInShop") var VisibleInShop: Boolean? = null,
@SerializedName("HighlightInShop") var HighlightInShop: Boolean? = null,
@SerializedName("HasSoldOut") var HasSoldOut: Boolean? = null,
@SerializedName("OnGeneralSaleFrom") var OnGeneralSaleFrom: String? = null,
@SerializedName("OnGeneralSaleTill") var OnGeneralSaleTill: String? = null,
@SerializedName("VisibleInShopFrom") var VisibleInShopFrom: String? = null,
@SerializedName("VisibleInShopTill") var VisibleInShopTill: String? = null,
@SerializedName("Name") var Name: String? = null,
@SerializedName("NameHomeTeam") var NameHomeTeam: String? = null,
@SerializedName("NameAwayTeam") var NameAwayTeam: String? = null,
@SerializedName("EventStartDateTime") var EventStartDateTime: String? = null,
@SerializedName("EventStartDateTimeOffset") var EventStartDateTimeOffset: String? = null,
@SerializedName("EventEndDateTime") var EventEndDateTime: String? = null,
@SerializedName("CategoryTranslationCode") var CategoryTranslationCode: String? = null,
@SerializedName("SaleCategoryOrder") var SaleCategoryOrder: Int? = null,
@SerializedName("ImageId") var ImageId: String? = null,
@SerializedName("ImageFileName") var ImageFileName: String? = null,
@SerializedName("ImageUniqueName") var ImageUniqueName: String? = null,
@SerializedName("HomeImageId") var HomeImageId: Int? = null,
@SerializedName("HomeImageFileName") var HomeImageFileName: String? = null,
@SerializedName("HomeImageUniqueName") var HomeImageUniqueName: String? = null,
@SerializedName("AwayImageId") var AwayImageId: Int? = null,
@SerializedName("AwayImageFileName") var AwayImageFileName: String? = null,
@SerializedName("AwayImageUniqueName") var AwayImageUniqueName: String? = null,
@SerializedName("HasTicketsAvailable") var HasTicketsAvailable: Boolean? = null,
@SerializedName("HasMarketplaceTicketsAvailable") var HasMarketplaceTicketsAvailable: Boolean? = null,
@SerializedName("HasPossibleTicketsInFuture") var HasPossibleTicketsInFuture: Boolean? = null,
@SerializedName("CurrentlyOnSaleForUser") var CurrentlyOnSaleForUser: Boolean? = null,
@SerializedName("PurchaseRightAvailableAfterLogin") var PurchaseRightAvailableAfterLogin: Boolean? = null,
@SerializedName("ImageUrl") var ImageUrl: String? = null,
@SerializedName("HomeImageUrl") var HomeImageUrl: String? = null,
@SerializedName("AwayImageUrl") var AwayImageUrl: String? = null,
@SerializedName("EventTypeName") var EventTypeName: String? = null,
@SerializedName("EventTypeLogoId") var EventTypeLogoId: Int? = null,
@SerializedName("EventTypeLogoUrl") var EventTypeLogoUrl: String? = null,
@SerializedName("EventTypeLogoFileName") var EventTypeLogoFileName: String? = null,
@SerializedName("EventTypeLogoUniqueName") var EventTypeLogoUniqueName: String? = null,
@SerializedName("InfoUrl") var InfoUrl: String? = null,
@SerializedName("EventStartDateTimeFormatted") var EventStartDateTimeFormatted: EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
@SerializedName("EventEndDateTimeFormatted") var EventEndDateTimeFormatted: EventEndDateTimeFormatted? = EventEndDateTimeFormatted(),
@SerializedName("ButtonData") var ButtonData: ButtonData? = ButtonData(),
@SerializedName("ShowMarketplaceForEvent") var ShowMarketplaceForEvent: Boolean? = null,
@SerializedName("RedirectToMarketplace") var RedirectToMarketplace: Boolean? = null,
@SerializedName("MarketplaceButtonTextColor") var MarketplaceButtonTextColor: String? = null,
@SerializedName("MarketplaceButtonBackgroundColor") var MarketplaceButtonBackgroundColor: String? = null,
@SerializedName("DeepLinkRoute") var DeepLinkRoute: String? = null
)

View File

@@ -0,0 +1,63 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName
data class HeaderItem (
@SerializedName("DisplayCountdown" ) var DisplayCountdown : Boolean? = null,
@SerializedName("ShowResellInHeader" ) var ShowResellInHeader : Boolean? = null,
@SerializedName("ResellTicketsAllowed" ) var ResellTicketsAllowed : Boolean? = null,
@SerializedName("ResellTicketsFrom" ) var ResellTicketsFrom : String? = null,
@SerializedName("ResellTicketsTill" ) var ResellTicketsTill : String? = null,
@SerializedName("EventId" ) var EventId : Int? = null,
@SerializedName("SaleCategoryId" ) var SaleCategoryId : Int? = null,
@SerializedName("HasGeneralSale" ) var HasGeneralSale : Boolean? = null,
@SerializedName("VisibleInShop" ) var VisibleInShop : Boolean? = null,
@SerializedName("HighlightInShop" ) var HighlightInShop : Boolean? = null,
@SerializedName("HasSoldOut" ) var HasSoldOut : Boolean? = null,
@SerializedName("OnGeneralSaleFrom" ) var OnGeneralSaleFrom : String? = null,
@SerializedName("OnGeneralSaleTill" ) var OnGeneralSaleTill : String? = null,
@SerializedName("VisibleInShopFrom" ) var VisibleInShopFrom : String? = null,
@SerializedName("VisibleInShopTill" ) var VisibleInShopTill : String? = null,
@SerializedName("Name" ) var Name : String? = null,
@SerializedName("NameHomeTeam" ) var NameHomeTeam : String? = null,
@SerializedName("NameAwayTeam" ) var NameAwayTeam : String? = null,
@SerializedName("EventStartDateTime" ) var EventStartDateTime : String? = null,
@SerializedName("EventStartDateTimeOffset" ) var EventStartDateTimeOffset : String? = null,
@SerializedName("EventEndDateTime" ) var EventEndDateTime : String? = null,
@SerializedName("CategoryTranslationCode" ) var CategoryTranslationCode : String? = null,
@SerializedName("SaleCategoryOrder" ) var SaleCategoryOrder : Int? = null,
@SerializedName("ImageId" ) var ImageId : String? = null,
@SerializedName("ImageFileName" ) var ImageFileName : String? = null,
@SerializedName("ImageUniqueName" ) var ImageUniqueName : String? = null,
@SerializedName("HomeImageId" ) var HomeImageId : Int? = null,
@SerializedName("HomeImageFileName" ) var HomeImageFileName : String? = null,
@SerializedName("HomeImageUniqueName" ) var HomeImageUniqueName : String? = null,
@SerializedName("AwayImageId" ) var AwayImageId : Int? = null,
@SerializedName("AwayImageFileName" ) var AwayImageFileName : String? = null,
@SerializedName("AwayImageUniqueName" ) var AwayImageUniqueName : String? = null,
@SerializedName("HasTicketsAvailable" ) var HasTicketsAvailable : Boolean? = null,
@SerializedName("HasMarketplaceTicketsAvailable" ) var HasMarketplaceTicketsAvailable : Boolean? = null,
@SerializedName("HasPossibleTicketsInFuture" ) var HasPossibleTicketsInFuture : Boolean? = null,
@SerializedName("CurrentlyOnSaleForUser" ) var CurrentlyOnSaleForUser : Boolean? = null,
@SerializedName("PurchaseRightAvailableAfterLogin" ) var PurchaseRightAvailableAfterLogin : Boolean? = null,
@SerializedName("ImageUrl" ) var ImageUrl : String? = null,
@SerializedName("HomeImageUrl" ) var HomeImageUrl : String? = null,
@SerializedName("AwayImageUrl" ) var AwayImageUrl : String? = null,
@SerializedName("EventTypeName" ) var EventTypeName : String? = null,
@SerializedName("EventTypeLogoId" ) var EventTypeLogoId : Int? = null,
@SerializedName("EventTypeLogoUrl" ) var EventTypeLogoUrl : String? = null,
@SerializedName("EventTypeLogoFileName" ) var EventTypeLogoFileName : String? = null,
@SerializedName("EventTypeLogoUniqueName" ) var EventTypeLogoUniqueName : String? = null,
@SerializedName("InfoUrl" ) var InfoUrl : String? = null,
@SerializedName("EventStartDateTimeFormatted" ) var EventStartDateTimeFormatted : EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
@SerializedName("EventEndDateTimeFormatted" ) var EventEndDateTimeFormatted : EventEndDateTimeFormatted? = EventEndDateTimeFormatted(),
@SerializedName("ButtonData" ) var ButtonData : ButtonData? = ButtonData(),
@SerializedName("ShowMarketplaceForEvent" ) var ShowMarketplaceForEvent : Boolean? = null,
@SerializedName("RedirectToMarketplace" ) var RedirectToMarketplace : Boolean? = null,
@SerializedName("MarketplaceButtonTextColor" ) var MarketplaceButtonTextColor : String? = null,
@SerializedName("MarketplaceButtonBackgroundColor" ) var MarketplaceButtonBackgroundColor : String? = null,
@SerializedName("DeepLinkRoute" ) var DeepLinkRoute : String? = null
)

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
@@ -51,6 +51,8 @@ data class Items(
@SerializedName("EventTypeLogoFileName") var EventTypeLogoFileName: String? = null, @SerializedName("EventTypeLogoFileName") var EventTypeLogoFileName: String? = null,
@SerializedName("EventTypeLogoUniqueName") var EventTypeLogoUniqueName: String? = null, @SerializedName("EventTypeLogoUniqueName") var EventTypeLogoUniqueName: String? = null,
@SerializedName("InfoUrl") var InfoUrl: String? = null, @SerializedName("InfoUrl") var InfoUrl: String? = null,
@SerializedName("EventStartDateTimeFormatted") var EventStartDateTimeFormatted: EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
@SerializedName("EventEndDateTimeFormatted") var EventEndDateTimeFormatted: EventEndDateTimeFormatted? = EventEndDateTimeFormatted(),
@SerializedName("ButtonData") var ButtonData: ButtonData? = ButtonData(), @SerializedName("ButtonData") var ButtonData: ButtonData? = ButtonData(),
@SerializedName("ShowMarketplaceForEvent") var ShowMarketplaceForEvent: Boolean? = null, @SerializedName("ShowMarketplaceForEvent") var ShowMarketplaceForEvent: Boolean? = null,
@SerializedName("RedirectToMarketplace") var RedirectToMarketplace: Boolean? = null, @SerializedName("RedirectToMarketplace") var RedirectToMarketplace: Boolean? = null,

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName

View File

@@ -1,16 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
object ThuisRetrofitHelper {
val baseUrl = "http://10.0.2.2:5052/"
private val retrofit = Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.build()
val thuis = retrofit.create(ThuisService::class.java)
}

View File

@@ -1,62 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis
import com.mitchelbv.thuis_c.network.thuis.responses.*
import retrofit2.http.*
interface ThuisService {
// Cards
// Getters
@GET("api/Card")
suspend fun getCards(): ArrayList<Card>
@GET("api/Card/{id}")
suspend fun getCard(id: Int): Card
// Post
@POST("api/card")
suspend fun postCard(@Body card: Card): Card
// Freezer
// Getters
@GET("api/Freezer")
suspend fun getFreezers(): ArrayList<Freezer>
@GET("api/Freezer/{id}")
suspend fun getFreezer(@Path("id") id: Int): Freezer
// Post
@POST("api/Freezer")
suspend fun postFreezer(@Body freezer: Freezer): Freezer
// Put
@PUT("api/Freezer/{id}")
suspend fun putFreezer(@Body freezer: Freezer): Freezer
// Delete
@DELETE("api/Freezer/{id]")
suspend fun deleteFreezer(id: Int)
// Freezer items
// Getters
@GET("api/FreezerItem")
suspend fun getFreezerItems(): FreezerItems
@GET("api/FreezerItem/{id}")
suspend fun getFreezerItem(id: Int): FreezerItem
@GET("api/FreezerItem/InFreezer/{id}")
suspend fun getFreezerItemsInFreezer(id: Int): FreezerItemsInFreezer
// Post
@POST("api/FreezerItem")
suspend fun postFreezerItem(@Body freezerItem: FreezerItem): FreezerItem
// Put
@PUT("api/FreezerItem/{id}")
suspend fun putFreezerItem(@Body freezerItem: FreezerItem): FreezerItem
// Delete
@DELETE("api/FreezerItem/{id}")
suspend fun deleteFreezerItem(id: Int)
}

View File

@@ -1,9 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName
data class Freezer(
@SerializedName("freezerId") var freezerId: Int? = null,
@SerializedName("location") var location: String? = null,
@SerializedName("amountInFreezer") var amountInFreezer: Int? = null
)

View File

@@ -1,14 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName
data class FreezerItem(
@SerializedName("freezerItemId") var freezerItemId: Int? = null,
@SerializedName("item") var item: String? = null,
@SerializedName("amount") var amount: Int? = null,
@SerializedName("drawer") var drawer: Int? = null,
@SerializedName("dateTimeAdded") var dateTimeAdded: String? = null,
@SerializedName("freezerId") var freezerId: Int? = null
)

View File

@@ -1,8 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName
data class FreezerItems(
@SerializedName("freezerItems") var freezerItems: ArrayList<FreezerItem> = arrayListOf()
)

View File

@@ -1,13 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName
data class FreezerItemsInFreezer(
@SerializedName("freezerItemId") var freezerItemId: Int? = null,
@SerializedName("item") var item: String? = null,
@SerializedName("amount") var amount: Int? = null,
@SerializedName("drawer") var drawer: Int? = null,
@SerializedName("dateTimeAdded") var dateTimeAdded: String? = null,
@SerializedName("freezerId") var freezerId: Int? = null
)

View File

@@ -1,7 +0,0 @@
package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName
data class Freezers(
@SerializedName("freezers") var freezers: ArrayList<Freezer> = arrayListOf()
)

View File

@@ -1,60 +1,25 @@
package com.mitchelbv.thuis_c.repository package com.mitchelbv.thuis_c.repository
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import com.mitchelbv.thuis_c.database.MatchesDatabase
import com.mitchelbv.thuis_c.database.asDomainModel
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordService import com.mitchelbv.thuis_c.network.feyenoord.responses.asDatabaseModel
import com.mitchelbv.thuis_c.ui.feyenoord.Match import com.mitchelbv.thuis_c.ui.feyenoord.Match
import java.text.SimpleDateFormat import kotlinx.coroutines.Dispatchers
import java.util.Locale import kotlinx.coroutines.withContext
import java.util.TimeZone
class FeyenoordRepository() {
private val feyenoordService: FeyenoordService = FeyenoordRetrofitHelper.feyenoord
private fun toLocalFormattedDateTime(date: String, outputFormat: String): String { class FeyenoordRepository(private val database: MatchesDatabase) {
val apiUtcDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()) val matches: LiveData<List<Match>> = Transformations.map(database.matchDao.getMatches()) {
apiUtcDate.timeZone = TimeZone.getTimeZone("UTC") it.asDomainModel()
val parsedDate = apiUtcDate.parse(date)
val localDateFormat = SimpleDateFormat(outputFormat, Locale.getDefault())
localDateFormat.timeZone = TimeZone.getDefault()
return localDateFormat.format(parsedDate)
} }
suspend fun getMatches(): List<Match> {
val tempMatches = mutableListOf<Match>()
val token = feyenoordService.getToken()
val feyenoordApiResponse = token.token?.let { feyenoordService.getEvents(it) }
feyenoordApiResponse?.TabItems?.filter { it.CategoryId == 2 }?.forEach {
for (item in it.Items) {
tempMatches.add( suspend fun refreshMatches() {
Match( withContext(Dispatchers.IO) {
homeTeam = item.NameHomeTeam!!, val matches = FeyenoordRetrofitHelper.feyenoord.getEvents()
awayTeam = item.NameAwayTeam!!, database.matchDao.insertAll(matches.asDatabaseModel())
date = item.EventStartDateTime?.let { it1 ->
toLocalFormattedDateTime(
it1,
"dd MMMM"
)
}.toString(),
beginTime = item.EventStartDateTime?.let { it1 ->
toLocalFormattedDateTime(
it1,
"HH:mm"
)
}.toString(),
endTime = item.EventEndDateTime?.let { it1 ->
toLocalFormattedDateTime(
it1,
"HH:mm"
)
}.toString(),
awayImage = item.AwayImageUrl!!,
homeImage = item.HomeImageUrl!!
)
)
}
} }
return tempMatches
} }
} }

View File

@@ -2,8 +2,8 @@ package com.mitchelbv.thuis_c.ui.card
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper import com.mitchelbv.thuis_c.network.card.CardRetrofitHelper
import com.mitchelbv.thuis_c.network.thuis.ThuisService import com.mitchelbv.thuis_c.network.card.CardService
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
@@ -22,18 +22,18 @@ class CardViewModel : ViewModel() {
} }
private fun fillCards() { private fun fillCards() {
// val tempCards = mutableListOf<Card>() val tempCards = mutableListOf<Card>()
// viewModelScope.launch { viewModelScope.launch {
// val cApiClient = ThuisRetrofitHelper.getInstance().create(ThuisService::class.java) val cApiClient = CardRetrofitHelper.getInstance().create(CardService::class.java)
// val apiResponse = cApiClient.getCards() val apiResponse = cApiClient.getCards()
// for (card in apiResponse.cards) { for (card in apiResponse.cards) {
// tempCards.add(Card( tempCards.add(Card(
// id = card.id!!, id = card.id!!,
// code = card.code!!, code = card.code!!,
// issuer = card.issuer!! issuer = card.issuer!!
// )) ))
// } }
// } }
// _uiState.value = CardUiState(tempCards) _uiState.value = CardUiState(tempCards)
} }
} }

View File

@@ -6,10 +6,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
@Composable @Composable
fun CardsScreen(navHostController: NavHostController, cardViewModel: CardViewModel = viewModel()) { fun CardsScreen(cardViewModel: CardViewModel = viewModel()) {
val cardUiState by cardViewModel.uiState.collectAsState() val cardUiState by cardViewModel.uiState.collectAsState()
Column() { Column() {
cardUiState.cards.forEach { cardUiState.cards.forEach {

View File

@@ -11,8 +11,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@@ -22,23 +20,14 @@ import coil.compose.AsyncImage
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.R
@Composable @Composable
fun FeyenoordScreen( fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel(), navHostController: NavHostController) {
feyenoordViewModel: FeyenoordViewModel = viewModel(),
navHostController: NavHostController
) {
val feyenoordUiState by feyenoordViewModel.uiState.collectAsState() val feyenoordUiState by feyenoordViewModel.uiState.collectAsState()
Column( Column(
modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()), modifier = Modifier
verticalArrangement = Arrangement.Center, .verticalScroll(rememberScrollState())
horizontalAlignment = Alignment.CenterHorizontally // .padding(16.dp)
) { ) {
if (feyenoordUiState.loading) { MatchList(matches = feyenoordUiState.matches, Modifier)
CircularProgressIndicator()
} else if (feyenoordUiState.error != null) {
Text(stringResource(feyenoordUiState.error!!))
} else {
MatchList(matches = feyenoordUiState.matches, Modifier)
}
} }
} }
@@ -52,28 +41,20 @@ fun MatchList(matches: List<Match>, modifier: Modifier) {
} }
@Composable @Composable
fun TeamNameWithLogo(teamName: String, teamLogoUrl: String, modifier: Modifier) { fun TeamNameWithLogo(team_name: String, team_logo_url: String, modifier: Modifier) {
Column( Column(modifier = modifier
modifier = modifier .size(128.dp)
.size(128.dp) .fillMaxWidth(), Arrangement.Center, Alignment.CenterHorizontally) {
.fillMaxWidth(),
Arrangement.Center,
Alignment.CenterHorizontally
) {
AsyncImage( AsyncImage(
model = teamLogoUrl, model = team_logo_url,
contentDescription = teamName, contentDescription = team_name,
placeholder = painterResource(id = R.drawable.placeholder), placeholder = painterResource(id = R.drawable.ic_launcher_foreground),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
modifier = modifier.size(64.dp) modifier = modifier.size(64.dp)
) )
Text( Text(text = team_name, modifier = modifier
text = teamName, .fillMaxWidth()
textAlign = TextAlign.Center, .wrapContentWidth(Alignment.CenterHorizontally))
modifier = modifier
.fillMaxWidth()
// .wrapContentWidth(Alignment.CenterHorizontally)
)
} }
} }
@@ -89,8 +70,8 @@ fun MatchCard(match: Match, modifier: Modifier) {
.height(128.dp) .height(128.dp)
) { ) {
TeamNameWithLogo( TeamNameWithLogo(
teamName = match.homeTeam, team_name = match.home_team,
teamLogoUrl = match.homeImage, team_logo_url = match.home_image,
modifier = modifier modifier = modifier
) )
Column( Column(
@@ -99,14 +80,14 @@ fun MatchCard(match: Match, modifier: Modifier) {
) { ) {
Text(text = match.date, overflow = TextOverflow.Ellipsis) Text(text = match.date, overflow = TextOverflow.Ellipsis)
Row { Row {
Text(match.beginTime) Text(match.begin_time)
Text(" - ") Text(" - ")
Text(match.endTime) Text(match.end_time)
} }
} }
TeamNameWithLogo( TeamNameWithLogo(
teamName = match.awayTeam, team_name = match.away_team,
teamLogoUrl = match.awayImage, team_logo_url = match.away_image,
modifier = modifier modifier = modifier
) )
@@ -117,13 +98,13 @@ fun MatchCard(match: Match, modifier: Modifier) {
@Composable @Composable
fun PreviewMatchCard() { fun PreviewMatchCard() {
val test = Match( val test = Match(
homeImage = "https://tymes4-cdn.azureedge.net/feyenoord/21-feyenoord-logo-original.png", home_image = "https://tymes4-cdn.azureedge.net/feyenoord/21-feyenoord-logo-original.png",
awayImage = "https://tymes4-cdn.azureedge.net/feyenoord/291-S.S._Lazio_badge.svg-min-original.png", away_image = "https://tymes4-cdn.azureedge.net/feyenoord/291-S.S._Lazio_badge.svg-min-original.png",
homeTeam = "Feyenoord Vrouwen 1", home_team = "Feyenoord Vrouwen 1",
awayTeam = "FC Twente Vrouwen 1", away_team = "FC Twente Vrouwen 1",
date = "do 03 November 2023", date = "do 03 November 2023",
beginTime = "18:03", begin_time = "18:03",
endTime = "20:03" end_time = "20:03"
) )
MatchCard(match = test, Modifier) MatchCard(match = test, Modifier)
} }

View File

@@ -1,39 +1,61 @@
package com.mitchelbv.thuis_c.ui.feyenoord package com.mitchelbv.thuis_c.ui.feyenoord
import android.content.res.Resources import android.app.Application
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.database.MatchesDatabase.Companion.getDatabase
import com.mitchelbv.thuis_c.repository.FeyenoordRepository import com.mitchelbv.thuis_c.repository.FeyenoordRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
data class FeyenoordUiState( data class FeyenoordUiState(
val matches: List<Match> = listOf(), val matches: List<Match> = listOf()
val loading: Boolean = true,
val error: Int? = null
) )
class FeyenoordViewModel : ViewModel() { class FeyenoordViewModel(application: Application) : ViewModel() {
private val _uiState = MutableStateFlow(FeyenoordUiState()) private val _uiState = MutableStateFlow(FeyenoordUiState())
val uiState: StateFlow<FeyenoordUiState> = _uiState.asStateFlow() val uiState: StateFlow<FeyenoordUiState> = _uiState.asStateFlow()
private val feyenoordRepository: FeyenoordRepository = FeyenoordRepository()
private val feyenoordRepository = FeyenoordRepository(getDatabase(application))
val matches = feyenoordRepository.matches
init { init {
fillMatches() refreshMatchesFromRepository()
} }
private fun fillMatches() { private fun refreshMatchesFromRepository() {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch {
try { feyenoordRepository.refreshMatches()
_uiState.value = FeyenoordUiState(matches = feyenoordRepository.getMatches(), loading = false) _uiState.value = FeyenoordUiState(matches = matches.value!!)
} catch (e: Exception) {
_uiState.value = FeyenoordUiState(loading = false, error = R.string.feyenoord_network_error)
}
} }
} }
// private fun fillMatches() {
// // TODO Get data from the internet
// val tempMatches = mutableListOf<Match>()
// viewModelScope.launch(Dispatchers.IO) {
// val fApiClient =
// FeyenoordRetrofitHelper.getInstance().create(FeyenoordService::class.java)
// val apiResponse = fApiClient.getEvents()
// for (tabItem in apiResponse.TabItems) {
// val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
// test.forEach {
// for (item in it.Items) {
// tempMatches.add(Match(
// home_team = item.NameHomeTeam!!,
// away_team = item.NameAwayTeam!!,
// date = item.EventStartDateTimeFormatted?.Full!!,
// begin_time = item.EventStartDateTimeFormatted?.Time!!,
// end_time = item.EventEndDateTimeFormatted?.Time!!,
// away_image = item.AwayImageUrl!!,
// home_image = item.HomeImageUrl!!
// ))
// }
// }
// }
// _uiState.value = FeyenoordUiState(matches = tempMatches)
// }
// }
} }

View File

@@ -1,11 +1,11 @@
package com.mitchelbv.thuis_c.ui.feyenoord package com.mitchelbv.thuis_c.ui.feyenoord
data class Match( data class Match(
val homeImage: String, val home_image: String,
val awayImage: String, val away_image: String,
val homeTeam: String, val home_team: String,
val awayTeam: String, val away_team: String,
val date: String, val date: String,
val beginTime: String, val begin_time: String,
val endTime: String val end_time: String
) )

View File

@@ -1,108 +0,0 @@
package com.mitchelbv.thuis_c.ui.freezer
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.R
import com.mitchelbv.thuis_c.Screen
import com.mitchelbv.thuis_c.network.thuis.responses.Freezer
@Composable
fun FreezerScreen(
navHostController: NavHostController,
freezerViewModel: FreezerViewModel = viewModel()
) {
val freezerUiState by freezerViewModel.uiState.collectAsState()
FreezerList(freezerUiState.freezers, navHostController, Modifier)
FloatingActionButton(onClick = { navHostController.navigate("edit_freezer") }) {
Icon(Icons.Default.Edit, contentDescription = "Edit")
}
}
@Composable
fun FreezerList(freezers: List<Freezer>, navHostController: NavHostController, modifier: Modifier) {
if (freezers.isNotEmpty()) {
LazyColumn {
items(freezers) { freezer ->
FreezerListItem(
freezer = freezer,
navigateTo = { navHostController.navigate("${Screen.FreezerDetails.route}/${freezer.freezerId}") },
modifier = modifier
)
}
}
} else {
Text(stringResource(id = R.string.freezer_list_empty))
}
}
@Composable
fun FreezerListItem(freezer: Freezer, navigateTo: () -> Unit, modifier: Modifier) {
Row(
modifier = modifier
.fillMaxWidth()
.height(150.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(freezer.location!!)
Column(
horizontalAlignment = Alignment.End,
verticalArrangement = Arrangement.Center,
modifier = modifier.fillMaxHeight()
) {
Icon(
painter = painterResource(id = R.drawable.arrow),
contentDescription = "arrow",
modifier = modifier.size(20.dp)
)
Text("${freezer.amountInFreezer} artikelen")
}
}
Spacer(
modifier = Modifier
.fillMaxWidth()
.background(Color(0f, 0f, 0f, .5f))
.height(1.dp)
)
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FreezerCard(freezer: Freezer, navigateTo: () -> Unit) {
Card(
onClick = { navigateTo() }, modifier = Modifier
.fillMaxWidth()
.height(100.dp)
.padding(10.dp)
) {
Text(freezer.location!!)
}
}
@Preview(widthDp = 250, showBackground = true, heightDp = 300)
@Composable
fun FreezerListItemPreview() {
val freezer = Freezer(freezerId = 1, location = "Keuken", amountInFreezer = 5)
FreezerListItem(freezer = freezer, modifier = Modifier, navigateTo = {})
}

View File

@@ -1,39 +0,0 @@
package com.mitchelbv.thuis_c.ui.freezer
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper
import com.mitchelbv.thuis_c.network.thuis.responses.Freezer
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import java.net.ConnectException
data class FreezerUiState(
val freezers: List<Freezer> = listOf()
)
class FreezerViewModel : ViewModel() {
private val _uiState = MutableStateFlow(FreezerUiState())
val uiState: StateFlow<FreezerUiState> = _uiState.asStateFlow()
init {
fillFreezer()
}
private fun fillFreezer() {
viewModelScope.launch(Dispatchers.IO) {
try {
val apiResponse = ThuisRetrofitHelper.thuis.getFreezers()
_uiState.value = FreezerUiState(apiResponse)
} catch (e: ConnectException) {
_uiState.value = FreezerUiState(listOf())
}
}
}
}

View File

@@ -1,10 +0,0 @@
package com.mitchelbv.thuis_c.ui.freezer.detailed
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
@Composable
fun FreezerDetailedScreen(navHostController: NavHostController, freezerId: String?) {
Text("Hi!, requesting for freezer $freezerId")
}

View File

@@ -1,30 +0,0 @@
package com.mitchelbv.thuis_c.ui.freezer.detailed
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper
import com.mitchelbv.thuis_c.network.thuis.responses.Freezer
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import java.net.ConnectException
data class FreezerEditUiState(
var freezerName: String = "",
)
class FreezerEditViewModel : ViewModel() {
private val _uiState = MutableStateFlow(FreezerEditUiState())
val uiState: StateFlow<FreezerEditUiState> = _uiState.asStateFlow()
init {
fillFreezerTextField()
}
private fun fillFreezerTextField() {
// Todo
}
}

View File

@@ -1,30 +0,0 @@
package com.mitchelbv.thuis_c.ui.freezer.edit
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.ui.freezer.detailed.FreezerEditViewModel
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FreezerEditScreen(
navHostController: NavHostController,
freezerEditViewModel: FreezerEditViewModel = viewModel(),
freezerId: String?) {
val freezerUiState by freezerEditViewModel.uiState.collectAsState()
val freezerName by remember { mutableStateOf(freezerUiState.freezerName)}
Text("Hi!, editing (or creating) freezer. $freezerId")
Column {
TextField(value = freezerName, onValueChange = { freezerUiState.freezerName = it })
Button(onClick = { /* TODO */ }) {
}
}
}

View File

@@ -1,56 +1,17 @@
package com.mitchelbv.thuis_c.ui.home package com.mitchelbv.thuis_c.ui.home
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.ui.theme.Typography import com.mitchelbv.thuis_c.ui.theme.Typography
import com.mitchelbv.thuis_c.R
import com.mitchelbv.thuis_c.Screen
@Composable @Composable
fun HomeScreen(navController: NavHostController) { fun HomeScreen(navController: NavHostController) {
Column( Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text("De thuis app!", style = Typography.bodySmall) Text("De thuis app!", style = Typography.bodySmall)
// Row(modifier = Modifier.height(100.dp).width(180.dp)) {
// HomeCard(cardId = R.drawable.storefront, cardText = R.string.home_card_cards, routeTo = Screen.Cards.route, navController = navController)
// HomeCard(cardId = R.drawable.feyenoord, cardText = R.string.home_card_freezer, routeTo = Screen.Freezer.route, navController = navController)
// HomeButton(buttonText = R.string.home_card_cards, routeTo = Screen.Cards.route, navController = navController)
// HomeButton(buttonText = R.string.home_card_freezer, routeTo = Screen.Freezer.route, navController = navController)
// }
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeCard(cardId: Int, cardText: Int, routeTo: String, navController: NavHostController) {
Card(onClick = { navController.navigate(routeTo) }) {
Row(modifier = Modifier.fillMaxSize()) {
Icon(
painterResource(cardId), contentDescription = null, modifier = Modifier
.padding(end = 10.dp)
)
Text(
text = stringResource(id = cardText),
Modifier
.padding(10.dp)
)
}
}
}
@Composable
fun HomeButton(buttonText: Int, routeTo: String, navController: NavHostController) {
Button(onClick = { navController.navigate(routeTo) }) {
Text(stringResource(id = buttonText))
} }
} }

View File

@@ -1,46 +0,0 @@
package com.mitchelbv.thuis_c.ui.home
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
import com.mitchelbv.thuis_c.ui.feyenoord.Match
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
data class HomeUiState(
val upcomingMatch: Match? = null
)
class HomeViewModel : ViewModel() {
private val _uiState = MutableStateFlow(HomeUiState())
val uiState: StateFlow<HomeUiState> = _uiState.asStateFlow()
init {
getUpcomingMatch()
}
fun notNullHandler(test: String?): String {
if (!test.isNullOrEmpty()) {
return test;
}
return ""
}
private fun getUpcomingMatch() {
viewModelScope.launch {
// val apiResponse = FeyenoordRetrofitHelper.feyenoord.getEvents().HeaderItem!!
// val match = Match(
// homeTeam = notNullHandler(apiResponse.NameHomeTeam),
// awayTeam = notNullHandler(apiResponse.NameAwayTeam),
// date = notNullHandler(apiResponse.EventStartDateTimeFormatted?.Full),
// beginTime = notNullHandler(apiResponse.EventStartDateTimeFormatted?.Time),
// endTime = notNullHandler(apiResponse.EventEndDateTimeFormatted?.Time),
// awayImage = notNullHandler(apiResponse.AwayImageUrl),
// homeImage = notNullHandler(apiResponse.HomeImageUrl)
// )
// _uiState.value = HomeUiState(upcomingMatch = match)
}
}
}

View File

@@ -31,7 +31,6 @@ fun RecipeScreen(navHostController: NavHostController) {
} }
settings.javaScriptEnabled = true settings.javaScriptEnabled = true
settings.domStorageEnabled = true settings.domStorageEnabled = true
settings.safeBrowsingEnabled = false
loadUrl("https://rs.mitchelbv.nl/") loadUrl("https://rs.mitchelbv.nl/")
webView = this webView = this
} }

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -1,14 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="63.66dp"
android:height="158.48dp"
android:viewportWidth="63.66"
android:viewportHeight="158.48">
<path
android:pathData="M63.66,79.24l-8.17,5.72l-55.48,-79.24l8.17,-5.72z"
android:strokeWidth="0.236994"
android:fillColor="#000000"/>
<path
android:pathData="M63.66,79.24l-8.17,-5.72l-55.48,79.24l8.17,5.72z"
android:strokeWidth="0.24"
android:fillColor="#000000"/>
</vector>

View File

@@ -1,6 +1,170 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" <vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"> android:width="108dp"
<color android:name="ic_launcher_background" android:height="108dp"
tools:ignore="ExtraText">#FFFFFF</color> android:viewportWidth="108"
</resources> android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,4 +0,0 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000" android:pathData="M21.9,8.89l-1.05,-4.37c-0.22,-0.9 -1,-1.52 -1.91,-1.52H5.05C4.15,3 3.36,3.63 3.15,4.52L2.1,8.89c-0.24,1.02 -0.02,2.06 0.62,2.88C2.8,11.88 2.91,11.96 3,12.06V19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-6.94c0.09,-0.09 0.2,-0.18 0.28,-0.28C21.92,10.96 22.15,9.91 21.9,8.89zM18.91,4.99l1.05,4.37c0.1,0.42 0.01,0.84 -0.25,1.17C19.57,10.71 19.27,11 18.77,11c-0.61,0 -1.14,-0.49 -1.21,-1.14L16.98,5L18.91,4.99zM13,5h1.96l0.54,4.52c0.05,0.39 -0.07,0.78 -0.33,1.07C14.95,10.85 14.63,11 14.22,11C13.55,11 13,10.41 13,9.69V5zM8.49,9.52L9.04,5H11v4.69C11,10.41 10.45,11 9.71,11c-0.34,0 -0.65,-0.15 -0.89,-0.41C8.57,10.3 8.45,9.91 8.49,9.52zM4.04,9.36L5.05,5h1.97L6.44,9.86C6.36,10.51 5.84,11 5.23,11c-0.49,0 -0.8,-0.29 -0.93,-0.47C4.03,10.21 3.94,9.78 4.04,9.36zM5,19v-6.03C5.08,12.98 5.15,13 5.23,13c0.87,0 1.66,-0.36 2.24,-0.95c0.6,0.6 1.4,0.95 2.31,0.95c0.87,0 1.65,-0.36 2.23,-0.93c0.59,0.57 1.39,0.93 2.29,0.93c0.84,0 1.64,-0.35 2.24,-0.95c0.58,0.59 1.37,0.95 2.24,0.95c0.08,0 0.15,-0.02 0.23,-0.03V19H5z"/>
</vector>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/> <background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/> <background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -1,14 +1,7 @@
<resources> <resources>
<string name="app_name">Thuis</string> <string name="app_name">Thuis</string>
<string name="nav_feyenoord">Wedstrijden</string> <string name="nav_feyenoord">Feyenoord</string>
<string name="nav_recipes">Recepten</string> <string name="nav_recipes">Recepten</string>
<string name="nav_home">Home</string> <string name="nav_home">Home</string>
<string name="home_card_cards">Kaarten</string>
<string name="home_card_freezer">Vriezer</string>
<string name="freezer_list_empty">Er zijn geen vriezers</string>
<string name="edit_freezer">Vriezer aanpassen</string>
<string name="feyenoord_network_error">Er is geen netwerk beschikbaar</string>
</resources> </resources>

View File

@@ -1,10 +1,10 @@
buildscript { buildscript {
ext { ext {
compose_version = '1.3.3' compose_version = '1.1.1'
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.7.3' apply false id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '8.7.3' apply false id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
} }

View File

@@ -20,6 +20,4 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the # Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies, # resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library # thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false

View File

@@ -1,6 +1,6 @@
#Mon Oct 31 14:59:45 CET 2022 #Mon Oct 31 14:59:45 CET 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME