5 Commits

Author SHA1 Message Date
a80118fea7 Added app icon
Started work on the freezer overview

Updated dependencies

Some project restructuring
2023-01-23 10:09:41 +01:00
f7236485c0 Slight update 2022-11-06 21:39:51 +01:00
78b0d3aac7 Merge pull request 'Updated to material 3, layout is now a proper scaffold, navigationbar added' (#1) from layout_changes into master
Reviewed-on: #1
2022-11-06 12:02:01 +01:00
ec4fcc0ec2 Updated to material 3, layout is now a proper scaffold, navigationbar added 2022-11-06 12:01:10 +01:00
c5cb18abb4 Added room 2022-11-05 13:23:43 +01:00
75 changed files with 746 additions and 482 deletions

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>

1
.idea/gradle.xml generated
View File

@@ -7,6 +7,7 @@
<option name="testRunner" value="GRADLE" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@@ -5,12 +5,12 @@ plugins {
android { android {
namespace 'com.mitchelbv.thuis_c' namespace 'com.mitchelbv.thuis_c'
compileSdk 32 compileSdk 33
defaultConfig { defaultConfig {
applicationId "com.mitchelbv.thuis_c" applicationId "com.mitchelbv.thuis_c"
minSdk 30 minSdk 30
targetSdk 32 targetSdk 33
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@@ -37,7 +37,7 @@ android {
compose true compose true
} }
composeOptions { composeOptions {
kotlinCompilerExtensionVersion '1.1.1' kotlinCompilerExtensionVersion '1.3.2'
} }
packagingOptions { packagingOptions {
resources { resources {
@@ -47,23 +47,34 @@ android {
} }
dependencies { dependencies {
//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.0' implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation("io.coil-kt:coil-compose:2.2.2")
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07" // Display images from the internet
implementation "io.coil-kt:coil-compose:2.2.2"
implementation 'androidx.core:core-ktx:1.8.0' // Database
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' implementation "androidx.room:room-runtime:2.5.0"
implementation 'androidx.activity:activity-compose:1.5.1' annotationProcessor("androidx.room:room-compiler:2.5.0")
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version" // Navigation
implementation "androidx.compose.material:material:$compose_ui_version" implementation "androidx.navigation:navigation-compose:2.5.3"
// ViewModel
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.activity:activity-compose:1.6.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.compose.material3:material3:1.0.1'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version" androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -18,7 +18,6 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Thuis"> android:theme="@style/Theme.Thuis">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,16 +1,27 @@
package com.mitchelbv.thuis_c package com.mitchelbv.thuis_c
import android.annotation.SuppressLint
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.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.* import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material3.*
import androidx.compose.material.icons.filled.Favorite import androidx.compose.runtime.Composable
import androidx.compose.runtime.* import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.res.stringResource
import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
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.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.recipe.RecipeScreen
import com.mitchelbv.thuis_c.ui.theme.ThuisTheme import com.mitchelbv.thuis_c.ui.theme.ThuisTheme
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
@@ -21,7 +32,7 @@ class MainActivity : ComponentActivity() {
// A surface container using the 'background' color from the theme // A surface container using the 'background' color from the theme
Surface( Surface(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background color = MaterialTheme.colorScheme.background
) { ) {
ThuisApp() ThuisApp()
} }
@@ -30,25 +41,50 @@ class MainActivity : ComponentActivity() {
} }
} }
@SuppressLint("UnusedMaterialScaffoldPaddingParameter") val screenItems = listOf(
Screen.Home,
Screen.Recipes,
Screen.Feyenoord,
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun ThuisApp() { fun ThuisApp() {
var currentScreen: ThuisDestination by remember { mutableStateOf(Home) } val navController = rememberNavController()
return Scaffold(bottomBar = { val navBackStackEntry by navController.currentBackStackEntryAsState()
BottomNavigation() { Scaffold(
destinations.forEachIndexed { index, item -> topBar = {
BottomNavigationItem( TopAppBar(title = { Text(stringResource(id = R.string.app_name))})
selected = currentScreen.route == destinations[index].route, },
onClick = { currentScreen = destinations[index] }, bottomBar = {
icon = { NavigationBar {
Icon( val currentDestination = navBackStackEntry?.destination
destinations[index].icon, screenItems.forEach { screen ->
contentDescription = null NavigationBarItem(
) icon = { Icon(screen.icon, contentDescription = stringResource(id = screen.resourceId))},
}) label = { Text(stringResource(id = screen.resourceId))},
selected = currentDestination?.hierarchy?.any {it.route == screen.route} == true,
onClick = {
navController.navigate(screen.route) {
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
})
}
} }
} }
}) { ) { innerPadding ->
currentScreen.screen() NavHost(navController = navController, startDestination = "home", Modifier.padding(innerPadding)) {
composable("home") { HomeScreen(navController) }
composable("feyenoord") { FeyenoordScreen(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

@@ -0,0 +1,17 @@
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

@@ -1,45 +0,0 @@
package com.mitchelbv.thuis_c
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.material.icons.filled.ShoppingCart
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import com.mitchelbv.thuis_c.ui.card.CardsScreen
import com.mitchelbv.thuis_c.ui.feyenoord.FeyenoordScreen
import com.mitchelbv.thuis_c.ui.home.HomeScreen
import com.mitchelbv.thuis_c.ui.recipe.RecipeScreen
interface ThuisDestination {
val route: String
val screen: @Composable () -> Unit
val icon: ImageVector
}
object Home : ThuisDestination {
override val icon = Icons.Filled.Home
override val route = "home"
override val screen: @Composable () -> Unit = { HomeScreen() }
}
object FeyenoordMatches : ThuisDestination {
override val icon = Icons.Filled.DateRange
override val route: String = "matches"
override val screen: @Composable () -> Unit = { FeyenoordScreen() }
}
object Card : ThuisDestination {
override val icon = Icons.Filled.ShoppingCart
override val route = "card"
override val screen: @Composable () -> Unit = { CardsScreen() }
}
object Recipe : ThuisDestination {
override val icon = Icons.Filled.List
override val route = "recipe"
override val screen: @Composable () -> Unit = { RecipeScreen() }
}
val destinations = listOf(Home, Recipe, FeyenoordMatches)

View File

@@ -1,16 +0,0 @@
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

@@ -1,13 +0,0 @@
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

@@ -6,10 +6,10 @@ import retrofit2.converter.gson.GsonConverterFactory
object FeyenoordRetrofitHelper { object FeyenoordRetrofitHelper {
val baseUrl = "https://tickets-api.feyenoord.nl/api/" val baseUrl = "https://tickets-api.feyenoord.nl/api/"
fun getInstance(): Retrofit { private val retrofit = Retrofit.Builder()
return Retrofit.Builder() .baseUrl(baseUrl)
.baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()) .build()
.build()
} val feyenoord = retrofit.create(FeyenoordService::class.java)
} }

View File

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

View File

@@ -4,9 +4,7 @@ import com.google.gson.annotations.SerializedName
data class FeyenoordEventResponse( data class FeyenoordEventResponse(
@SerializedName("HeaderItem") var HeaderItem: HeaderItem? = HeaderItem(), @SerializedName("HeaderItem") var HeaderItem: HeaderItem? = HeaderItem(),
@SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(), @SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(),
@SerializedName("CrossSellInfo") var CrossSellInfo: String? = null @SerializedName("CrossSellInfo") var CrossSellInfo: String? = null
) )

View File

@@ -3,61 +3,61 @@ package com.mitchelbv.thuis_c.network.feyenoord.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
data class HeaderItem ( data class HeaderItem(
@SerializedName("DisplayCountdown" ) var DisplayCountdown : Boolean? = null, @SerializedName("DisplayCountdown") var DisplayCountdown: Boolean? = null,
@SerializedName("ShowResellInHeader" ) var ShowResellInHeader : Boolean? = null, @SerializedName("ShowResellInHeader") var ShowResellInHeader: Boolean? = null,
@SerializedName("ResellTicketsAllowed" ) var ResellTicketsAllowed : Boolean? = null, @SerializedName("ResellTicketsAllowed") var ResellTicketsAllowed: Boolean? = null,
@SerializedName("ResellTicketsFrom" ) var ResellTicketsFrom : String? = null, @SerializedName("ResellTicketsFrom") var ResellTicketsFrom: String? = null,
@SerializedName("ResellTicketsTill" ) var ResellTicketsTill : String? = null, @SerializedName("ResellTicketsTill") var ResellTicketsTill: String? = null,
@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("HasGeneralSale" ) var HasGeneralSale : Boolean? = null, @SerializedName("HasGeneralSale") var HasGeneralSale: Boolean? = null,
@SerializedName("VisibleInShop" ) var VisibleInShop : Boolean? = null, @SerializedName("VisibleInShop") var VisibleInShop: Boolean? = null,
@SerializedName("HighlightInShop" ) var HighlightInShop : Boolean? = null, @SerializedName("HighlightInShop") var HighlightInShop: Boolean? = null,
@SerializedName("HasSoldOut" ) var HasSoldOut : Boolean? = null, @SerializedName("HasSoldOut") var HasSoldOut: Boolean? = null,
@SerializedName("OnGeneralSaleFrom" ) var OnGeneralSaleFrom : String? = null, @SerializedName("OnGeneralSaleFrom") var OnGeneralSaleFrom: String? = null,
@SerializedName("OnGeneralSaleTill" ) var OnGeneralSaleTill : String? = null, @SerializedName("OnGeneralSaleTill") var OnGeneralSaleTill: String? = null,
@SerializedName("VisibleInShopFrom" ) var VisibleInShopFrom : String? = null, @SerializedName("VisibleInShopFrom") var VisibleInShopFrom: String? = null,
@SerializedName("VisibleInShopTill" ) var VisibleInShopTill : String? = null, @SerializedName("VisibleInShopTill") var VisibleInShopTill: String? = null,
@SerializedName("Name" ) var Name : String? = null, @SerializedName("Name") var Name: String? = null,
@SerializedName("NameHomeTeam" ) var NameHomeTeam : String? = null, @SerializedName("NameHomeTeam") var NameHomeTeam: String? = null,
@SerializedName("NameAwayTeam" ) var NameAwayTeam : String? = null, @SerializedName("NameAwayTeam") var NameAwayTeam: String? = null,
@SerializedName("EventStartDateTime" ) var EventStartDateTime : String? = null, @SerializedName("EventStartDateTime") var EventStartDateTime: String? = null,
@SerializedName("EventStartDateTimeOffset" ) var EventStartDateTimeOffset : String? = null, @SerializedName("EventStartDateTimeOffset") var EventStartDateTimeOffset: String? = null,
@SerializedName("EventEndDateTime" ) var EventEndDateTime : String? = null, @SerializedName("EventEndDateTime") var EventEndDateTime: String? = null,
@SerializedName("CategoryTranslationCode" ) var CategoryTranslationCode : String? = null, @SerializedName("CategoryTranslationCode") var CategoryTranslationCode: String? = null,
@SerializedName("SaleCategoryOrder" ) var SaleCategoryOrder : Int? = null, @SerializedName("SaleCategoryOrder") var SaleCategoryOrder: Int? = null,
@SerializedName("ImageId" ) var ImageId : String? = null, @SerializedName("ImageId") var ImageId: String? = null,
@SerializedName("ImageFileName" ) var ImageFileName : String? = null, @SerializedName("ImageFileName") var ImageFileName: String? = null,
@SerializedName("ImageUniqueName" ) var ImageUniqueName : String? = null, @SerializedName("ImageUniqueName") var ImageUniqueName: String? = null,
@SerializedName("HomeImageId" ) var HomeImageId : Int? = null, @SerializedName("HomeImageId") var HomeImageId: Int? = null,
@SerializedName("HomeImageFileName" ) var HomeImageFileName : String? = null, @SerializedName("HomeImageFileName") var HomeImageFileName: String? = null,
@SerializedName("HomeImageUniqueName" ) var HomeImageUniqueName : String? = null, @SerializedName("HomeImageUniqueName") var HomeImageUniqueName: String? = null,
@SerializedName("AwayImageId" ) var AwayImageId : Int? = null, @SerializedName("AwayImageId") var AwayImageId: Int? = null,
@SerializedName("AwayImageFileName" ) var AwayImageFileName : String? = null, @SerializedName("AwayImageFileName") var AwayImageFileName: String? = null,
@SerializedName("AwayImageUniqueName" ) var AwayImageUniqueName : String? = null, @SerializedName("AwayImageUniqueName") var AwayImageUniqueName: String? = null,
@SerializedName("HasTicketsAvailable" ) var HasTicketsAvailable : Boolean? = null, @SerializedName("HasTicketsAvailable") var HasTicketsAvailable: Boolean? = null,
@SerializedName("HasMarketplaceTicketsAvailable" ) var HasMarketplaceTicketsAvailable : Boolean? = null, @SerializedName("HasMarketplaceTicketsAvailable") var HasMarketplaceTicketsAvailable: Boolean? = null,
@SerializedName("HasPossibleTicketsInFuture" ) var HasPossibleTicketsInFuture : Boolean? = null, @SerializedName("HasPossibleTicketsInFuture") var HasPossibleTicketsInFuture: Boolean? = null,
@SerializedName("CurrentlyOnSaleForUser" ) var CurrentlyOnSaleForUser : Boolean? = null, @SerializedName("CurrentlyOnSaleForUser") var CurrentlyOnSaleForUser: Boolean? = null,
@SerializedName("PurchaseRightAvailableAfterLogin" ) var PurchaseRightAvailableAfterLogin : Boolean? = null, @SerializedName("PurchaseRightAvailableAfterLogin") var PurchaseRightAvailableAfterLogin: Boolean? = null,
@SerializedName("ImageUrl" ) var ImageUrl : String? = null, @SerializedName("ImageUrl") var ImageUrl: String? = null,
@SerializedName("HomeImageUrl" ) var HomeImageUrl : String? = null, @SerializedName("HomeImageUrl") var HomeImageUrl: String? = null,
@SerializedName("AwayImageUrl" ) var AwayImageUrl : String? = null, @SerializedName("AwayImageUrl") var AwayImageUrl: String? = null,
@SerializedName("EventTypeName" ) var EventTypeName : String? = null, @SerializedName("EventTypeName") var EventTypeName: String? = null,
@SerializedName("EventTypeLogoId" ) var EventTypeLogoId : Int? = null, @SerializedName("EventTypeLogoId") var EventTypeLogoId: Int? = null,
@SerializedName("EventTypeLogoUrl" ) var EventTypeLogoUrl : String? = null, @SerializedName("EventTypeLogoUrl") var EventTypeLogoUrl: String? = null,
@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("EventStartDateTimeFormatted") var EventStartDateTimeFormatted: EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
@SerializedName("EventEndDateTimeFormatted" ) var EventEndDateTimeFormatted : EventEndDateTimeFormatted? = EventEndDateTimeFormatted(), @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,
@SerializedName("MarketplaceButtonTextColor" ) var MarketplaceButtonTextColor : String? = null, @SerializedName("MarketplaceButtonTextColor") var MarketplaceButtonTextColor: String? = null,
@SerializedName("MarketplaceButtonBackgroundColor" ) var MarketplaceButtonBackgroundColor : String? = null, @SerializedName("MarketplaceButtonBackgroundColor") var MarketplaceButtonBackgroundColor: String? = null,
@SerializedName("DeepLinkRoute" ) var DeepLinkRoute : String? = null @SerializedName("DeepLinkRoute") var DeepLinkRoute: String? = null
) )

View File

@@ -0,0 +1,16 @@
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

@@ -0,0 +1,62 @@
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,4 +1,4 @@
package com.mitchelbv.thuis_c.network.card.responses package com.mitchelbv.thuis_c.network.thuis.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.card.responses package com.mitchelbv.thuis_c.network.thuis.responses
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName

View File

@@ -0,0 +1,9 @@
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

@@ -0,0 +1,14 @@
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

@@ -0,0 +1,8 @@
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

@@ -0,0 +1,13 @@
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

@@ -0,0 +1,7 @@
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

@@ -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.card.CardRetrofitHelper import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper
import com.mitchelbv.thuis_c.network.card.CardService import com.mitchelbv.thuis_c.network.thuis.ThuisService
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 = CardRetrofitHelper.getInstance().create(CardService::class.java) // val cApiClient = ThuisRetrofitHelper.getInstance().create(ThuisService::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

@@ -1,14 +1,15 @@
package com.mitchelbv.thuis_c.ui.card package com.mitchelbv.thuis_c.ui.card
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.material.Text import androidx.compose.material3.*
import androidx.compose.runtime.Composable 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(cardViewModel: CardViewModel = viewModel()) { fun CardsScreen(navHostController: NavHostController, 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

@@ -3,7 +3,7 @@ package com.mitchelbv.thuis_c.ui.feyenoord
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Text import androidx.compose.material3.*
import androidx.compose.runtime.Composable 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
@@ -15,11 +15,12 @@ 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
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import coil.compose.AsyncImage import coil.compose.AsyncImage
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.R
@Composable @Composable
fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel()) { fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel(), navHostController: NavHostController) {
val feyenoordUiState by feyenoordViewModel.uiState.collectAsState() val feyenoordUiState by feyenoordViewModel.uiState.collectAsState()
Column( Column(
modifier = Modifier modifier = Modifier
@@ -45,7 +46,7 @@ fun TeamNameWithLogo(team_name: String, team_logo_url: String, modifier: Modifie
AsyncImage( AsyncImage(
model = team_logo_url, model = team_logo_url,
contentDescription = team_name, contentDescription = team_name,
placeholder = painterResource(id = R.drawable.ic_launcher_foreground), placeholder = painterResource(id = R.drawable.placeholder),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
modifier = modifier.size(64.dp) modifier = modifier.size(64.dp)
) )

View File

@@ -29,12 +29,9 @@ class FeyenoordViewModel : ViewModel() {
} }
private fun fillMatches() { private fun fillMatches() {
// TODO Get data from the internet
val tempMatches = mutableListOf<Match>() val tempMatches = mutableListOf<Match>()
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val fApiClient = val apiResponse = FeyenoordRetrofitHelper.feyenoord.getEvents()
FeyenoordRetrofitHelper.getInstance().create(FeyenoordService::class.java)
val apiResponse = fApiClient.getEvents()
for (tabItem in apiResponse.TabItems) { for (tabItem in apiResponse.TabItems) {
val test = arrayOf(tabItem).filter { it.CategoryId == 2 } val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
test.forEach { test.forEach {

View File

@@ -0,0 +1,108 @@
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

@@ -0,0 +1,39 @@
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

@@ -0,0 +1,10 @@
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

@@ -0,0 +1,30 @@
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

@@ -0,0 +1,30 @@
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,23 +1,56 @@
package com.mitchelbv.thuis_c.ui.home package com.mitchelbv.thuis_c.ui.home
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Column import androidx.compose.material3.*
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
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() { fun HomeScreen(navController: NavHostController) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) { Column(
Text("De thuis app!", style = Typography.body1) modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
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)
// }
} }
} }
@Preview(showBackground = true) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun HomeScreenPreview() { fun HomeCard(cardId: Int, cardText: Int, routeTo: String, navController: NavHostController) {
HomeScreen() 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

@@ -0,0 +1,49 @@
package com.mitchelbv.thuis_c.ui.home
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mitchelbv.thuis_c.Screen
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordService
import com.mitchelbv.thuis_c.ui.feyenoord.Match
import kotlinx.coroutines.Dispatchers
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(
home_team = notNullHandler(apiResponse.NameHomeTeam),
away_team = notNullHandler(apiResponse.NameAwayTeam),
date = notNullHandler(apiResponse.EventStartDateTimeFormatted?.Full),
begin_time = notNullHandler(apiResponse.EventStartDateTimeFormatted?.Time),
end_time = notNullHandler(apiResponse.EventEndDateTimeFormatted?.Time),
away_image = notNullHandler(apiResponse.AwayImageUrl),
home_image = notNullHandler(apiResponse.HomeImageUrl)
)
_uiState.value = HomeUiState(upcomingMatch = match)
}
}
}

View File

@@ -1,8 +1,6 @@
package com.mitchelbv.thuis_c.ui.recipe package com.mitchelbv.thuis_c.ui.recipe
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.graphics.Bitmap
import android.util.Log
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
@@ -11,10 +9,11 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.navigation.NavHostController
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Composable @Composable
fun RecipeScreen() { fun RecipeScreen(navHostController: NavHostController) {
var backEnabled by remember { mutableStateOf(true)} var backEnabled by remember { mutableStateOf(true)}
var webView: WebView? = null var webView: WebView? = null
AndroidView(modifier = Modifier.fillMaxSize(), AndroidView(modifier = Modifier.fillMaxSize(),
@@ -32,6 +31,7 @@ fun RecipeScreen() {
} }
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

@@ -2,7 +2,10 @@ package com.mitchelbv.thuis_c.ui.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val Purple200 = Color(0xFFBB86FC) val Purple80 = Color(0xFFD0BCFF)
val Purple500 = Color(0xFF6200EE) val PurpleGrey80 = Color(0xFFCCC2DC)
val Purple700 = Color(0xFF3700B3) val Pink80 = Color(0xFFEFB8C8)
val Teal200 = Color(0xFF03DAC5)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

View File

@@ -1,11 +0,0 @@
package com.mitchelbv.thuis_c.ui.theme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.ui.unit.dp
val Shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
)

View File

@@ -1,44 +1,44 @@
package com.mitchelbv.thuis_c.ui.theme package com.mitchelbv.thuis_c.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material.darkColors import androidx.compose.material3.darkColorScheme
import androidx.compose.material.lightColors import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
private val DarkColorPalette = darkColors( private val DarkColorScheme = darkColorScheme(
primary = Purple200, primary = Purple80,
primaryVariant = Purple700, secondary = PurpleGrey80,
secondary = Teal200 tertiary = Pink80
) )
private val LightColorPalette = lightColors( private val LightColorScheme = lightColorScheme(
primary = Purple500, primary = Purple40,
primaryVariant = Purple700, secondary = PurpleGrey40,
secondary = Teal200 tertiary = Pink40
/* Other default colors to override /* Other default colors to override
background = Color.White, background = Color(0xFFFFFBFE),
surface = Color.White, surface = Color(0xFFFFFBFE),
onPrimary = Color.White, onPrimary = Color.White,
onSecondary = Color.Black, onSecondary = Color.White,
onBackground = Color.Black, onTertiary = Color.White,
onSurface = Color.Black, onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/ */
) )
@Composable @Composable
fun ThuisTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { fun ThuisTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) { val colors = if (darkTheme) {
DarkColorPalette DarkColorScheme
} else { } else {
LightColorPalette LightColorScheme
} }
MaterialTheme( MaterialTheme(
colors = colors, colorScheme = colors,
typography = Typography, typography = Typography,
shapes = Shapes,
content = content content = content
) )
} }

View File

@@ -1,6 +1,6 @@
package com.mitchelbv.thuis_c.ui.theme package com.mitchelbv.thuis_c.ui.theme
import androidx.compose.material.Typography import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
@@ -8,21 +8,27 @@ import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with // Set of Material typography styles to start with
val Typography = Typography( val Typography = Typography(
body1 = TextStyle( bodyLarge = TextStyle(
fontFamily = FontFamily.Default, fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 16.sp fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
) )
/* Other default text styles to override /* Other default text styles to override
button = TextStyle( titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.W500,
fontSize = 14.sp
),
caption = TextStyle(
fontFamily = FontFamily.Default, fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 12.sp fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
) )
*/ */
) )

View File

@@ -1,30 +0,0 @@
<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

@@ -0,0 +1,14 @@
<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,170 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" <resources xmlns:tools="http://schemas.android.com/tools"
android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
android:height="108dp" <color android:name="ic_launcher_background"
android:viewportWidth="108" tools:ignore="ExtraText">#FFFFFF</color>
android:viewportHeight="108"> </resources>
<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.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,4 @@
<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="@drawable/ic_launcher_background" /> <background android:drawable="@color/white"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/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="@drawable/ic_launcher_background" /> <background android:drawable="@color/white"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 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: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 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: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -1,3 +1,13 @@
<resources> <resources>
<string name="app_name">Thuis</string> <string name="app_name">Thuis</string>
<string name="nav_feyenoord">Wedstrijden</string>
<string name="nav_recipes">Recepten</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>
</resources> </resources>

View File

@@ -1,10 +1,10 @@
buildscript { buildscript {
ext { ext {
compose_ui_version = '1.2.1' compose_version = '1.3.3'
} }
}// 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 '7.3.1' apply false id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.3.1' apply false id 'com.android.library' version '7.4.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false id 'org.jetbrains.kotlin.android' version '1.7.20' apply 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-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME