Compare commits
7 Commits
8b7efbae4e
...
thuis_api
| Author | SHA1 | Date | |
|---|---|---|---|
| a80118fea7 | |||
| f7236485c0 | |||
| 78b0d3aac7 | |||
| ec4fcc0ec2 | |||
| c5cb18abb4 | |||
| 2d35065226 | |||
| 7d1742fbf7 |
1
.gitignore
vendored
@@ -13,3 +13,4 @@
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
app/release
|
||||
|
||||
17
.idea/deploymentTargetDropDown.xml
generated
Normal 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
@@ -7,6 +7,7 @@
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="Embedded JDK" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
@@ -5,12 +5,12 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace 'com.mitchelbv.thuis_c'
|
||||
compileSdk 32
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.mitchelbv.thuis_c"
|
||||
minSdk 30
|
||||
targetSdk 32
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -37,7 +37,7 @@ android {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.1.1'
|
||||
kotlinCompilerExtensionVersion '1.3.2'
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
@@ -47,23 +47,34 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//Network
|
||||
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("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'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
|
||||
implementation 'androidx.activity:activity-compose:1.5.1'
|
||||
implementation "androidx.compose.ui:ui:$compose_ui_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
|
||||
implementation "androidx.compose.material:material:$compose_ui_version"
|
||||
// Database
|
||||
implementation "androidx.room:room-runtime:2.5.0"
|
||||
annotationProcessor("androidx.room:room-compiler:2.5.0")
|
||||
|
||||
// Navigation
|
||||
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'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
}
|
||||
BIN
app/src/debug/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -18,7 +18,6 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Thuis">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -1,16 +1,27 @@
|
||||
package com.mitchelbv.thuis_c
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Favorite
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
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
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -21,7 +32,7 @@ class MainActivity : ComponentActivity() {
|
||||
// A surface container using the 'background' color from the theme
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colors.background
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
ThuisApp()
|
||||
}
|
||||
@@ -30,25 +41,50 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
|
||||
val screenItems = listOf(
|
||||
Screen.Home,
|
||||
Screen.Recipes,
|
||||
Screen.Feyenoord,
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ThuisApp() {
|
||||
var currentScreen: ThuisDestination by remember { mutableStateOf(Home) }
|
||||
return Scaffold(bottomBar = {
|
||||
BottomNavigation() {
|
||||
destinations.forEachIndexed { index, item ->
|
||||
BottomNavigationItem(
|
||||
selected = currentScreen.route == destinations[index].route,
|
||||
onClick = { currentScreen = destinations[index] },
|
||||
icon = {
|
||||
Icon(
|
||||
destinations[index].icon,
|
||||
contentDescription = null
|
||||
)
|
||||
val navController = rememberNavController()
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(title = { Text(stringResource(id = R.string.app_name))})
|
||||
},
|
||||
bottomBar = {
|
||||
NavigationBar {
|
||||
val currentDestination = navBackStackEntry?.destination
|
||||
screenItems.forEach { screen ->
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}) {
|
||||
currentScreen.screen()
|
||||
}
|
||||
) { innerPadding ->
|
||||
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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
17
app/src/main/java/com/mitchelbv/thuis_c/Screens.kt
Normal 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)
|
||||
}
|
||||
@@ -1,37 +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.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
|
||||
|
||||
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() }
|
||||
}
|
||||
|
||||
val destinations = listOf(Home, FeyenoordMatches)
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import retrofit2.converter.gson.GsonConverterFactory
|
||||
object FeyenoordRetrofitHelper {
|
||||
val baseUrl = "https://tickets-api.feyenoord.nl/api/"
|
||||
|
||||
fun getInstance(): Retrofit {
|
||||
return Retrofit.Builder()
|
||||
private val retrofit = Retrofit.Builder()
|
||||
.baseUrl(baseUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build()
|
||||
}
|
||||
|
||||
val feyenoord = retrofit.create(FeyenoordService::class.java)
|
||||
}
|
||||
@@ -4,9 +4,7 @@ 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
|
||||
|
||||
)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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
|
||||
|
||||
)
|
||||
@@ -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()
|
||||
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -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()
|
||||
)
|
||||
@@ -2,8 +2,8 @@ package com.mitchelbv.thuis_c.ui.card
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.mitchelbv.thuis_c.network.card.CardRetrofitHelper
|
||||
import com.mitchelbv.thuis_c.network.card.CardService
|
||||
import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper
|
||||
import com.mitchelbv.thuis_c.network.thuis.ThuisService
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@@ -22,18 +22,18 @@ class CardViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
private fun fillCards() {
|
||||
val tempCards = mutableListOf<Card>()
|
||||
viewModelScope.launch {
|
||||
val cApiClient = CardRetrofitHelper.getInstance().create(CardService::class.java)
|
||||
val apiResponse = cApiClient.getCards()
|
||||
for (card in apiResponse.cards) {
|
||||
tempCards.add(Card(
|
||||
id = card.id!!,
|
||||
code = card.code!!,
|
||||
issuer = card.issuer!!
|
||||
))
|
||||
}
|
||||
}
|
||||
_uiState.value = CardUiState(tempCards)
|
||||
// val tempCards = mutableListOf<Card>()
|
||||
// viewModelScope.launch {
|
||||
// val cApiClient = ThuisRetrofitHelper.getInstance().create(ThuisService::class.java)
|
||||
// val apiResponse = cApiClient.getCards()
|
||||
// for (card in apiResponse.cards) {
|
||||
// tempCards.add(Card(
|
||||
// id = card.id!!,
|
||||
// code = card.code!!,
|
||||
// issuer = card.issuer!!
|
||||
// ))
|
||||
// }
|
||||
// }
|
||||
// _uiState.value = CardUiState(tempCards)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.mitchelbv.thuis_c.ui.card
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavHostController
|
||||
|
||||
@Composable
|
||||
fun CardsScreen(cardViewModel: CardViewModel = viewModel()) {
|
||||
fun CardsScreen(navHostController: NavHostController, cardViewModel: CardViewModel = viewModel()) {
|
||||
val cardUiState by cardViewModel.uiState.collectAsState()
|
||||
Column() {
|
||||
cardUiState.cards.forEach {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mitchelbv.thuis_c.ui.feyenoord
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
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.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavHostController
|
||||
import coil.compose.AsyncImage
|
||||
import com.mitchelbv.thuis_c.R
|
||||
|
||||
@Composable
|
||||
fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel()) {
|
||||
fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel(), navHostController: NavHostController) {
|
||||
val feyenoordUiState by feyenoordViewModel.uiState.collectAsState()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@@ -45,7 +46,7 @@ fun TeamNameWithLogo(team_name: String, team_logo_url: String, modifier: Modifie
|
||||
AsyncImage(
|
||||
model = team_logo_url,
|
||||
contentDescription = team_name,
|
||||
placeholder = painterResource(id = R.drawable.ic_launcher_foreground),
|
||||
placeholder = painterResource(id = R.drawable.placeholder),
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = modifier.size(64.dp)
|
||||
)
|
||||
|
||||
@@ -29,12 +29,9 @@ class FeyenoordViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
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()
|
||||
val apiResponse = FeyenoordRetrofitHelper.feyenoord.getEvents()
|
||||
for (tabItem in apiResponse.TabItems) {
|
||||
val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
|
||||
test.forEach {
|
||||
|
||||
@@ -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 = {})
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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 */ }) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,56 @@
|
||||
package com.mitchelbv.thuis_c.ui.home
|
||||
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
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.R
|
||||
import com.mitchelbv.thuis_c.Screen
|
||||
|
||||
@Composable
|
||||
fun HomeScreen() {
|
||||
return Text(text = "Hello!")
|
||||
fun HomeScreen(navController: NavHostController) {
|
||||
Column(
|
||||
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)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@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))
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.mitchelbv.thuis_c.ui.recipe
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.navigation.NavHostController
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Composable
|
||||
fun RecipeScreen(navHostController: NavHostController) {
|
||||
var backEnabled by remember { mutableStateOf(true)}
|
||||
var webView: WebView? = null
|
||||
AndroidView(modifier = Modifier.fillMaxSize(),
|
||||
factory = { context ->
|
||||
WebView(context).apply {
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
webViewClient = object : WebViewClient() {
|
||||
override fun onPageFinished(view: WebView, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
backEnabled = view.canGoBack()
|
||||
}
|
||||
}
|
||||
settings.javaScriptEnabled = true
|
||||
settings.domStorageEnabled = true
|
||||
settings.safeBrowsingEnabled = false
|
||||
loadUrl("https://rs.mitchelbv.nl/")
|
||||
webView = this
|
||||
}
|
||||
}, update = { webView = it}
|
||||
)
|
||||
BackHandler(enabled = backEnabled) {
|
||||
webView?.goBack()
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package com.mitchelbv.thuis_c.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val Purple200 = Color(0xFFBB86FC)
|
||||
val Purple500 = Color(0xFF6200EE)
|
||||
val Purple700 = Color(0xFF3700B3)
|
||||
val Teal200 = Color(0xFF03DAC5)
|
||||
val Purple80 = Color(0xFFD0BCFF)
|
||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||
val Pink80 = Color(0xFFEFB8C8)
|
||||
|
||||
val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -1,44 +1,44 @@
|
||||
package com.mitchelbv.thuis_c.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
private val DarkColorPalette = darkColors(
|
||||
primary = Purple200,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Purple80,
|
||||
secondary = PurpleGrey80,
|
||||
tertiary = Pink80
|
||||
)
|
||||
|
||||
private val LightColorPalette = lightColors(
|
||||
primary = Purple500,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Purple40,
|
||||
secondary = PurpleGrey40,
|
||||
tertiary = Pink40
|
||||
|
||||
/* Other default colors to override
|
||||
background = Color.White,
|
||||
surface = Color.White,
|
||||
background = Color(0xFFFFFBFE),
|
||||
surface = Color(0xFFFFFBFE),
|
||||
onPrimary = Color.White,
|
||||
onSecondary = Color.Black,
|
||||
onBackground = Color.Black,
|
||||
onSurface = Color.Black,
|
||||
onSecondary = Color.White,
|
||||
onTertiary = Color.White,
|
||||
onBackground = Color(0xFF1C1B1F),
|
||||
onSurface = Color(0xFF1C1B1F),
|
||||
*/
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun ThuisTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||
val colors = if (darkTheme) {
|
||||
DarkColorPalette
|
||||
DarkColorScheme
|
||||
} else {
|
||||
LightColorPalette
|
||||
LightColorScheme
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colors = colors,
|
||||
colorScheme = colors,
|
||||
typography = Typography,
|
||||
shapes = Shapes,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
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.font.FontFamily
|
||||
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
|
||||
val Typography = Typography(
|
||||
body1 = TextStyle(
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
button = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.W500,
|
||||
fontSize = 14.sp
|
||||
),
|
||||
caption = TextStyle(
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
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
|
||||
)
|
||||
*/
|
||||
)
|
||||
@@ -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>
|
||||
14
app/src/main/res/drawable/arrow.xml
Normal 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>
|
||||
@@ -1,170 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
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>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<color android:name="ic_launcher_background"
|
||||
tools:ignore="ExtraText">#FFFFFF</color>
|
||||
</resources>
|
||||
BIN
app/src/main/res/drawable/placeholder.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
4
app/src/main/res/drawable/storefront.xml
Normal 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>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/white"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/white"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
@@ -1,3 +1,13 @@
|
||||
<resources>
|
||||
<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>
|
||||
@@ -1,10 +1,10 @@
|
||||
buildscript {
|
||||
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.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.3.1' apply false
|
||||
id 'com.android.library' version '7.3.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
||||
id 'com.android.application' version '7.4.0' apply false
|
||||
id 'com.android.library' version '7.4.0' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
|
||||
}
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Mon Oct 31 14:59:45 CET 2022
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||