Architecture changes, updated MainActivity.kt to be simpler.

Updated colors

Changed main language to english.

Updated kotlin version.
This commit is contained in:
KaasKop-
2023-04-06 14:39:32 +02:00
parent bf071914a4
commit 0630cd048e
27 changed files with 396 additions and 166 deletions

123
.idea/codeStyles/Project.xml generated Normal file
View File

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

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

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

View File

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

2
.idea/gradle.xml generated
View File

@@ -7,7 +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="gradleJvm" value="Android Studio default JDK" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@@ -37,7 +37,7 @@ android {
compose true compose true
} }
composeOptions { composeOptions {
kotlinCompilerExtensionVersion '1.3.2' kotlinCompilerExtensionVersion '1.4.4'
} }
packagingOptions { packagingOptions {
resources { resources {
@@ -56,18 +56,18 @@ dependencies {
implementation "io.coil-kt:coil-compose:2.2.2" implementation "io.coil-kt:coil-compose:2.2.2"
// Database // Database
implementation "androidx.room:room-runtime:2.5.0" implementation "androidx.room:room-runtime:2.5.1"
annotationProcessor("androidx.room:room-compiler:2.5.0") annotationProcessor("androidx.room:room-compiler:2.5.1")
// Navigation // Navigation
implementation "androidx.navigation:navigation-compose:2.5.3" implementation "androidx.navigation:navigation-compose:2.5.3"
// ViewModel // ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1"
implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.6.1' implementation 'androidx.activity:activity-compose:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.compose.material3:material3:1.0.1' implementation 'androidx.compose.material3:material3:1.0.1'

View File

@@ -1,90 +1,80 @@
package com.mitchelbv.thuis_c package com.mitchelbv.thuis_c
import android.os.Bundle import android.os.Bundle
import android.util.Log
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.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.* import androidx.compose.material3.*
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.res.stringResource 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.NavHost
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController import androidx.navigation.compose.rememberNavController
import com.mitchelbv.thuis_c.ui.card.CardsScreen
import com.mitchelbv.thuis_c.ui.feyenoord.FeyenoordScreen
import com.mitchelbv.thuis_c.ui.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
import com.mitchelbv.thuis_c.views.feyenoord.MatchesScreen
import com.mitchelbv.thuis_c.views.home.HomeScreen
import com.mitchelbv.thuis_c.views.recipe.RecipeScreen
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
val navigationBarItems = listOf(Home, Recipes, Matches)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContent { setContent {
ThuisTheme { ThuisTheme {
// A surface container using the 'background' color from the theme LayoutWithNavSetup();
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
ThuisApp()
} }
} }
} }
}
}
val screenItems = listOf( @OptIn(ExperimentalMaterial3Api::class)
Screen.Home, @Composable
Screen.Recipes, fun LayoutWithNavSetup() {
Screen.Feyenoord,
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ThuisApp() {
val navController = rememberNavController() val navController = rememberNavController()
val navBackStackEntry by navController.currentBackStackEntryAsState() var selectedItem by remember { mutableStateOf(0) }
Scaffold( Scaffold(
topBar = { topBar = {
TopAppBar(title = { Text(stringResource(id = R.string.app_name))}) TopAppBar(title = {
Text(stringResource(id = R.string.app_name))
})
}, },
bottomBar = { bottomBar = {
NavigationBar { NavigationBar {
val currentDestination = navBackStackEntry?.destination navigationBarItems.forEachIndexed { index, screen ->
screenItems.forEach { screen ->
NavigationBarItem( NavigationBarItem(
icon = { Icon(screen.icon, contentDescription = stringResource(id = screen.resourceId))}, icon = {
label = { Text(stringResource(id = screen.resourceId))}, Icon(
selected = currentDestination?.hierarchy?.any {it.route == screen.route} == true, screen.icon,
contentDescription = stringResource(id = screen.destinationName)
)
},
label = { Text(stringResource(id = screen.destinationName)) },
selected = selectedItem == index,
onClick = { onClick = {
navController.navigate(screen.route) { navController.navigate(screen.route)
popUpTo(navController.graph.findStartDestination().id) { selectedItem = index
saveState = true
}
launchSingleTop = true
restoreState = true
}
}) })
} }
} }
} }
) { innerPadding -> ) { innerPadding ->
NavHost(navController = navController, startDestination = "home", Modifier.padding(innerPadding)) { NavHost(
composable("home") { HomeScreen(navController) } navController = navController,
composable("feyenoord") { FeyenoordScreen(navHostController = navController) } startDestination = Home.route,
composable("recipes") { RecipeScreen(navHostController = navController)} modifier = Modifier.padding(innerPadding)
composable("freezer") {FreezerScreen(navHostController = navController)} ) {
composable("cards") { CardsScreen(navHostController = navController) } composable(route = Home.route) {
composable("freezer-details/{freezerId}") { backStackEntry -> FreezerDetailedScreen(navHostController = navController, freezerId = backStackEntry.arguments?.getString("freezerId")) } HomeScreen(onClickFreezers = {
composable("freezer-edit") { CardsScreen(navHostController = navController) } navController.navigate(
Home.route
)
})
}
composable(route = Recipes.route) { RecipeScreen() }
composable(route = Matches.route) { MatchesScreen() }
}
} }
} }
} }

View File

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

View File

@@ -0,0 +1,29 @@
package com.mitchelbv.thuis_c
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.ui.graphics.vector.ImageVector
interface ThuisDestination {
val icon: ImageVector
val destinationName: Int
val route: String
}
object Home : ThuisDestination {
override val icon = Icons.Default.Home
override val destinationName = R.string.nav_home
override val route = "home"
}
object Recipes : ThuisDestination {
override val icon = Icons.Default.List
override val destinationName = R.string.nav_recipes
override val route = "recipes"
}
object Matches : ThuisDestination {
override val icon = Icons.Default.DateRange
override val destinationName = R.string.nav_matches
override val route = "matches"
}

View File

@@ -2,10 +2,67 @@ package com.mitchelbv.thuis_c.ui.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF) val md_theme_light_primary = Color(0xFF9F3087)
val PurpleGrey80 = Color(0xFFCCC2DC) val md_theme_light_onPrimary = Color(0xFFFFFFFF)
val Pink80 = Color(0xFFEFB8C8) val md_theme_light_primaryContainer = Color(0xFFFFD8EE)
val md_theme_light_onPrimaryContainer = Color(0xFF3A0030)
val md_theme_light_secondary = Color(0xFF3154C8)
val md_theme_light_onSecondary = Color(0xFFFFFFFF)
val md_theme_light_secondaryContainer = Color(0xFFDCE1FF)
val md_theme_light_onSecondaryContainer = Color(0xFF001551)
val md_theme_light_tertiary = Color(0xFF425AA9)
val md_theme_light_onTertiary = Color(0xFFFFFFFF)
val md_theme_light_tertiaryContainer = Color(0xFFDCE1FF)
val md_theme_light_onTertiaryContainer = Color(0xFF00164F)
val md_theme_light_error = Color(0xFFBA1A1A)
val md_theme_light_errorContainer = Color(0xFFFFDAD6)
val md_theme_light_onError = Color(0xFFFFFFFF)
val md_theme_light_onErrorContainer = Color(0xFF410002)
val md_theme_light_background = Color(0xFFFFFBFF)
val md_theme_light_onBackground = Color(0xFF231A00)
val md_theme_light_surface = Color(0xFFFFFBFF)
val md_theme_light_onSurface = Color(0xFF231A00)
val md_theme_light_surfaceVariant = Color(0xFFEFDEE6)
val md_theme_light_onSurfaceVariant = Color(0xFF4F444A)
val md_theme_light_outline = Color(0xFF81737A)
val md_theme_light_inverseOnSurface = Color(0xFFFFF0CB)
val md_theme_light_inverseSurface = Color(0xFF3C2F00)
val md_theme_light_inversePrimary = Color(0xFFFFADE4)
val md_theme_light_shadow = Color(0xFF000000)
val md_theme_light_surfaceTint = Color(0xFF9F3087)
val md_theme_light_outlineVariant = Color(0xFFD2C2CA)
val md_theme_light_scrim = Color(0xFF000000)
val Purple40 = Color(0xFF6650a4) val md_theme_dark_primary = Color(0xFFFFADE4)
val PurpleGrey40 = Color(0xFF625b71) val md_theme_dark_onPrimary = Color(0xFF5F004F)
val Pink40 = Color(0xFF7D5260) val md_theme_dark_primaryContainer = Color(0xFF81126D)
val md_theme_dark_onPrimaryContainer = Color(0xFFFFD8EE)
val md_theme_dark_secondary = Color(0xFFB7C4FF)
val md_theme_dark_onSecondary = Color(0xFF002681)
val md_theme_dark_secondaryContainer = Color(0xFF0A3AB0)
val md_theme_dark_onSecondaryContainer = Color(0xFFDCE1FF)
val md_theme_dark_tertiary = Color(0xFFB6C4FF)
val md_theme_dark_onTertiary = Color(0xFF082978)
val md_theme_dark_tertiaryContainer = Color(0xFF284190)
val md_theme_dark_onTertiaryContainer = Color(0xFFDCE1FF)
val md_theme_dark_error = Color(0xFFFFB4AB)
val md_theme_dark_errorContainer = Color(0xFF93000A)
val md_theme_dark_onError = Color(0xFF690005)
val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6)
val md_theme_dark_background = Color(0xFF231A00)
val md_theme_dark_onBackground = Color(0xFFFFE086)
val md_theme_dark_surface = Color(0xFF231A00)
val md_theme_dark_onSurface = Color(0xFFFFE086)
val md_theme_dark_surfaceVariant = Color(0xFF4F444A)
val md_theme_dark_onSurfaceVariant = Color(0xFFD2C2CA)
val md_theme_dark_outline = Color(0xFF9B8D94)
val md_theme_dark_inverseOnSurface = Color(0xFF231A00)
val md_theme_dark_inverseSurface = Color(0xFFFFE086)
val md_theme_dark_inversePrimary = Color(0xFF9F3087)
val md_theme_dark_shadow = Color(0xFF000000)
val md_theme_dark_surfaceTint = Color(0xFFFFADE4)
val md_theme_dark_outlineVariant = Color(0xFF4F444A)
val md_theme_dark_scrim = Color(0xFF000000)
val seed = Color(0xFF9F3087)

View File

@@ -6,39 +6,85 @@ import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
private val DarkColorScheme = darkColorScheme( private val LightColors = lightColorScheme(
primary = Purple80, primary = md_theme_light_primary,
secondary = PurpleGrey80, onPrimary = md_theme_light_onPrimary,
tertiary = Pink80 primaryContainer = md_theme_light_primaryContainer,
onPrimaryContainer = md_theme_light_onPrimaryContainer,
secondary = md_theme_light_secondary,
onSecondary = md_theme_light_onSecondary,
secondaryContainer = md_theme_light_secondaryContainer,
onSecondaryContainer = md_theme_light_onSecondaryContainer,
tertiary = md_theme_light_tertiary,
onTertiary = md_theme_light_onTertiary,
tertiaryContainer = md_theme_light_tertiaryContainer,
onTertiaryContainer = md_theme_light_onTertiaryContainer,
error = md_theme_light_error,
errorContainer = md_theme_light_errorContainer,
onError = md_theme_light_onError,
onErrorContainer = md_theme_light_onErrorContainer,
background = md_theme_light_background,
onBackground = md_theme_light_onBackground,
surface = md_theme_light_surface,
onSurface = md_theme_light_onSurface,
surfaceVariant = md_theme_light_surfaceVariant,
onSurfaceVariant = md_theme_light_onSurfaceVariant,
outline = md_theme_light_outline,
inverseOnSurface = md_theme_light_inverseOnSurface,
inverseSurface = md_theme_light_inverseSurface,
inversePrimary = md_theme_light_inversePrimary,
surfaceTint = md_theme_light_surfaceTint,
outlineVariant = md_theme_light_outlineVariant,
scrim = md_theme_light_scrim,
) )
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override private val DarkColors = darkColorScheme(
background = Color(0xFFFFFBFE), primary = md_theme_dark_primary,
surface = Color(0xFFFFFBFE), onPrimary = md_theme_dark_onPrimary,
onPrimary = Color.White, primaryContainer = md_theme_dark_primaryContainer,
onSecondary = Color.White, onPrimaryContainer = md_theme_dark_onPrimaryContainer,
onTertiary = Color.White, secondary = md_theme_dark_secondary,
onBackground = Color(0xFF1C1B1F), onSecondary = md_theme_dark_onSecondary,
onSurface = Color(0xFF1C1B1F), secondaryContainer = md_theme_dark_secondaryContainer,
*/ onSecondaryContainer = md_theme_dark_onSecondaryContainer,
tertiary = md_theme_dark_tertiary,
onTertiary = md_theme_dark_onTertiary,
tertiaryContainer = md_theme_dark_tertiaryContainer,
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
error = md_theme_dark_error,
errorContainer = md_theme_dark_errorContainer,
onError = md_theme_dark_onError,
onErrorContainer = md_theme_dark_onErrorContainer,
background = md_theme_dark_background,
onBackground = md_theme_dark_onBackground,
surface = md_theme_dark_surface,
onSurface = md_theme_dark_onSurface,
surfaceVariant = md_theme_dark_surfaceVariant,
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
outline = md_theme_dark_outline,
inverseOnSurface = md_theme_dark_inverseOnSurface,
inverseSurface = md_theme_dark_inverseSurface,
inversePrimary = md_theme_dark_inversePrimary,
surfaceTint = md_theme_dark_surfaceTint,
outlineVariant = md_theme_dark_outlineVariant,
scrim = md_theme_dark_scrim,
) )
@Composable @Composable
fun ThuisTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { fun ThuisTheme(
val colors = if (darkTheme) { useDarkTheme: Boolean = isSystemInDarkTheme(),
DarkColorScheme content: @Composable() () -> Unit
) {
val colors = if (!useDarkTheme) {
LightColors
} else { } else {
LightColorScheme DarkColors
} }
MaterialTheme( MaterialTheme(
colorScheme = colors, colorScheme = colors,
typography = Typography, content = content,
content = content typography = ThuisTypography
) )
} }

View File

@@ -7,15 +7,14 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp 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 ThuisTypography = Typography(
bodyLarge = TextStyle( bodyLarge = TextStyle(
fontFamily = FontFamily.Default, fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 16.sp, fontSize = 16.sp,
lineHeight = 24.sp, lineHeight = 24.sp,
letterSpacing = 0.5.sp letterSpacing = 0.5.sp
) ),
/* Other default text styles to override
titleLarge = TextStyle( titleLarge = TextStyle(
fontFamily = FontFamily.Default, fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
@@ -30,5 +29,4 @@ val Typography = Typography(
lineHeight = 16.sp, lineHeight = 16.sp,
letterSpacing = 0.5.sp letterSpacing = 0.5.sp
) )
*/
) )

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.card package com.mitchelbv.thuis_c.views.card
data class Card( data class Card(
val id: Int, val id: Int,

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.card package com.mitchelbv.thuis_c.views.card
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.card package com.mitchelbv.thuis_c.views.card
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.material3.* import androidx.compose.material3.*

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.feyenoord package com.mitchelbv.thuis_c.views.feyenoord
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
@@ -20,7 +20,7 @@ import coil.compose.AsyncImage
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.R
@Composable @Composable
fun FeyenoordScreen(feyenoordViewModel: FeyenoordViewModel = viewModel(), navHostController: NavHostController) { fun MatchesScreen(feyenoordViewModel: FeyenoordViewModel = viewModel()) {
val feyenoordUiState by feyenoordViewModel.uiState.collectAsState() val feyenoordUiState by feyenoordViewModel.uiState.collectAsState()
Column( Column(
modifier = Modifier modifier = Modifier

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.feyenoord package com.mitchelbv.thuis_c.views.feyenoord
import android.util.Log import android.util.Log
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
@@ -36,7 +36,8 @@ class FeyenoordViewModel : ViewModel() {
val test = arrayOf(tabItem).filter { it.CategoryId == 2 } val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
test.forEach { test.forEach {
for (item in it.Items) { for (item in it.Items) {
tempMatches.add(Match( tempMatches.add(
Match(
home_team = item.NameHomeTeam!!, home_team = item.NameHomeTeam!!,
away_team = item.NameAwayTeam!!, away_team = item.NameAwayTeam!!,
date = item.EventStartDateTimeFormatted?.Full!!, date = item.EventStartDateTimeFormatted?.Full!!,
@@ -44,7 +45,8 @@ class FeyenoordViewModel : ViewModel() {
end_time = item.EventEndDateTimeFormatted?.Time!!, end_time = item.EventEndDateTimeFormatted?.Time!!,
away_image = item.AwayImageUrl!!, away_image = item.AwayImageUrl!!,
home_image = item.HomeImageUrl!! home_image = item.HomeImageUrl!!
)) )
)
} }
} }
} }

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.feyenoord package com.mitchelbv.thuis_c.views.feyenoord
data class Match( data class Match(
val home_image: String, val home_image: String,

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.freezer package com.mitchelbv.thuis_c.views.freezer
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@@ -20,7 +20,6 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.R
import com.mitchelbv.thuis_c.Screen
import com.mitchelbv.thuis_c.network.thuis.responses.Freezer import com.mitchelbv.thuis_c.network.thuis.responses.Freezer
@Composable @Composable
@@ -40,11 +39,11 @@ fun FreezerList(freezers: List<Freezer>, navHostController: NavHostController, m
if (freezers.isNotEmpty()) { if (freezers.isNotEmpty()) {
LazyColumn { LazyColumn {
items(freezers) { freezer -> items(freezers) { freezer ->
FreezerListItem( // FreezerListItem(
freezer = freezer, // freezer = freezer,
navigateTo = { navHostController.navigate("${Screen.FreezerDetails.route}/${freezer.freezerId}") }, // navigateTo = { navHostController.navigate("${Screen.FreezerDetails.route}/${freezer.freezerId}") },
modifier = modifier // modifier = modifier
) // )
} }
} }

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.freezer package com.mitchelbv.thuis_c.views.freezer
import android.util.Log import android.util.Log
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.freezer.detailed package com.mitchelbv.thuis_c.views.freezer.detailed
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.freezer.detailed package com.mitchelbv.thuis_c.views.freezer.detailed
import android.util.Log import android.util.Log
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.freezer.edit package com.mitchelbv.thuis_c.views.freezer.edit
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button import androidx.compose.material3.Button
@@ -9,7 +9,7 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.ui.freezer.detailed.FreezerEditViewModel import com.mitchelbv.thuis_c.views.freezer.detailed.FreezerEditViewModel
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.home package com.mitchelbv.thuis_c.views.home
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material3.* import androidx.compose.material3.*
@@ -9,23 +9,22 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import com.mitchelbv.thuis_c.ui.theme.Typography import com.mitchelbv.thuis_c.ui.theme.ThuisTypography
import com.mitchelbv.thuis_c.R import com.mitchelbv.thuis_c.R
import com.mitchelbv.thuis_c.Screen
@Composable @Composable
fun HomeScreen(navController: NavHostController) { fun HomeScreen(onClickFreezers: () -> Unit) {
Column( Column(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center
) { ) {
Text("De thuis app!", style = Typography.bodySmall) Text(stringResource(id = R.string.app_name), style = ThuisTypography.bodySmall)
// Row(modifier = Modifier.height(100.dp).width(180.dp)) { // 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.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) // 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_cards, routeTo = Screen.Cards.route, navController = navController)
HomeButton(buttonText = R.string.home_card_freezer, routeTo = Screen.Freezer.route, navController = navController) // HomeButton(buttonText = R.string.home_card_freezer, routeTo = Screen.Freezer.route, navController = navController)
// } // }
} }
} }

View File

@@ -1,11 +1,10 @@
package com.mitchelbv.thuis_c.ui.home package com.mitchelbv.thuis_c.views.home
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope 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.FeyenoordRetrofitHelper
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordService import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordService
import com.mitchelbv.thuis_c.ui.feyenoord.Match import com.mitchelbv.thuis_c.views.feyenoord.Match
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow

View File

@@ -1,4 +1,4 @@
package com.mitchelbv.thuis_c.ui.recipe package com.mitchelbv.thuis_c.views.recipe
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.view.ViewGroup import android.view.ViewGroup
@@ -13,7 +13,7 @@ import androidx.navigation.NavHostController
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Composable @Composable
fun RecipeScreen(navHostController: NavHostController) { fun RecipeScreen() {
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(),

View File

@@ -1,13 +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_matches">Matches</string>
<string name="nav_recipes">Recepten</string> <string name="nav_recipes">Recipes</string>
<string name="nav_home">Home</string> <string name="nav_home">Home</string>
<string name="home_card_cards">Kaarten</string> <string name="home_card_cards">Cards</string>
<string name="home_card_freezer">Vriezer</string> <string name="home_card_freezer">Freezer</string>
<string name="freezer_list_empty">Er zijn geen vriezers</string> <string name="freezer_list_empty">No freezer(s)</string>
<string name="edit_freezer">Vriezer aanpassen</string> <string name="edit_freezer">Edit freezer</string>
</resources> </resources>

View File

@@ -1,10 +1,10 @@
buildscript { buildscript {
ext { ext {
compose_version = '1.3.3' compose_version = '1.4.0'
} }
}// 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.4.0' apply false id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.0' apply false id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
} }