Compare commits
12 Commits
adding_rep
...
update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ac5fe7392 | ||
|
|
a1d17919e5 | ||
|
|
e401b3e34b | ||
|
|
159d96f7f3 | ||
|
|
28f5c22bf2 | ||
|
|
5a00cd8f32 | ||
|
|
da2c98ce83 | ||
|
|
79ed64760c | ||
|
|
0630cd048e | ||
| bf071914a4 | |||
| a80118fea7 | |||
| f7236485c0 |
123
.idea/codeStyles/Project.xml
generated
Normal 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
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="11" />
|
<bytecodeTargetLevel target="17" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
17
.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +0,0 @@
|
|||||||
<?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="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="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|||||||
8
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -3,27 +3,35 @@
|
|||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
6
.idea/kotlinc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.8.10" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
3
.idea/misc.xml
generated
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'com.mitchelbv.thuis_c'
|
namespace 'com.mitchelbv.thuis_c'
|
||||||
compileSdk 32
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.mitchelbv.thuis_c"
|
applicationId "com.mitchelbv.thuis_c"
|
||||||
minSdk 30
|
minSdk 30
|
||||||
targetSdk 32
|
targetSdk 34
|
||||||
versionCode 1
|
versionCode 2
|
||||||
versionName "1.0"
|
versionName "1.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
@@ -37,7 +37,7 @@ android {
|
|||||||
compose true
|
compose true
|
||||||
}
|
}
|
||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion '1.1.1'
|
kotlinCompilerExtensionVersion '1.4.4'
|
||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources {
|
resources {
|
||||||
@@ -49,33 +49,34 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
//Network
|
//Network
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.google.code.gson:gson:2.9.0'
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
|
|
||||||
// Display images from the internet
|
// Display images from the internet
|
||||||
implementation "io.coil-kt:coil-compose:2.2.2"
|
implementation 'io.coil-kt:coil-compose:2.5.0'
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
implementation "androidx.room:room-runtime:2.4.3"
|
implementation 'androidx.room:room-runtime:2.6.0'
|
||||||
annotationProcessor("androidx.room:room-compiler:2.4.3")
|
annotationProcessor('androidx.room:room-compiler:2.6.0')
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
implementation "androidx.navigation:navigation-compose:2.5.3"
|
implementation 'androidx.navigation:navigation-compose:2.7.5'
|
||||||
|
|
||||||
// ViewModel and livedata
|
// ViewModel
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
|
implementation('androidx.lifecycle:lifecycle-runtime-compose:2.6.2')
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
|
implementation('androidx.compose.runtime:runtime-livedata:1.5.4')
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
|
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
|
||||||
implementation 'androidx.activity:activity-compose:1.3.1'
|
implementation 'androidx.core:core-ktx:1.12.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
||||||
|
implementation 'androidx.activity:activity-compose:1.8.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.0-alpha02'
|
implementation 'androidx.compose.material3:material3:1.1.2'
|
||||||
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_version"
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||||
|
|||||||
BIN
app/src/debug/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -14,6 +14,7 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Thuis"
|
android:theme="@style/Theme.Thuis"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|||||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -1,95 +1,151 @@
|
|||||||
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.annotation.StringRes
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.DateRange
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Home
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.List
|
|
||||||
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.graphics.vector.ImageVector
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.navigation.NavDestination.Companion.hierarchy
|
import androidx.navigation.NavType
|
||||||
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.feyenoord.FeyenoordScreen
|
import androidx.navigation.navArgument
|
||||||
import com.mitchelbv.thuis_c.ui.home.HomeScreen
|
import com.mitchelbv.thuis_c.network.thuis.responses.FreezerItem
|
||||||
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.freezer.FreezerScreen
|
||||||
|
import com.mitchelbv.thuis_c.views.freezer.item_list.FreezerItemListScreen
|
||||||
|
import com.mitchelbv.thuis_c.views.freezer.item_list.edit_item.FreezerItemEditScreen
|
||||||
|
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(HomeDestination, RecipesDestination, MatchesDestination)
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class Screen(val route: String, @StringRes val resourceId: Int, val icon: ImageVector) {
|
|
||||||
object Feyenoord : Screen("feyenoord", R.string.nav_feyenoord, Icons.Default.DateRange)
|
|
||||||
object Recipes : Screen("recipes", R.string.nav_recipes, Icons.Default.List)
|
|
||||||
object Home : Screen("home", R.string.nav_home, Icons.Default.Home)
|
|
||||||
}
|
|
||||||
|
|
||||||
val screenItems = listOf(
|
|
||||||
Screen.Home,
|
|
||||||
Screen.Recipes,
|
|
||||||
Screen.Feyenoord,
|
|
||||||
)
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ThuisApp() {
|
fun LayoutWithNavSetup() {
|
||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
|
var selectedItem by remember { mutableStateOf(0) }
|
||||||
|
val currentRoute = navController
|
||||||
|
.currentBackStackEntryFlow
|
||||||
|
.collectAsState(initial = navController.currentBackStackEntry)
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
SmallTopAppBar(title = { Text(stringResource(id = R.string.app_name))})
|
TopAppBar(title = {
|
||||||
|
Text(stringResource(id = R.string.app_name))
|
||||||
|
})
|
||||||
},
|
},
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
NavigationBar {
|
NavigationBar {
|
||||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
navigationBarItems.forEachIndexed { index, screen ->
|
||||||
val currentDestination = navBackStackEntry?.destination
|
|
||||||
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
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
floatingActionButton = {
|
||||||
|
when (currentRoute.value?.destination?.route?.substringBefore("/")) {
|
||||||
|
FreezerListDestination.route -> {
|
||||||
|
FloatingActionButton(onClick = {
|
||||||
|
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.Add, contentDescription = "idk")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
FreezerItemListDestination.route -> {
|
||||||
|
FloatingActionButton(onClick = {
|
||||||
|
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.Add, contentDescription = "idk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
floatingActionButtonPosition = FabPosition.End
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
NavHost(navController = navController, startDestination = "home", Modifier.padding(innerPadding)) {
|
NavHost(
|
||||||
composable("home") { HomeScreen(navController) }
|
navController = navController,
|
||||||
composable("feyenoord") { FeyenoordScreen(navHostController = navController) }
|
startDestination = HomeDestination.route,
|
||||||
composable("recipes") { RecipeScreen(navHostController = navController)}
|
modifier = Modifier.padding(innerPadding)
|
||||||
|
) {
|
||||||
|
// Navigation items
|
||||||
|
composable(route = HomeDestination.route) {
|
||||||
|
HomeScreen(onClickFreezers = {
|
||||||
|
navController.navigate(
|
||||||
|
FreezerListDestination.route
|
||||||
|
)
|
||||||
|
}, onClickCards = { navController.navigate(CardsDestination.route) })
|
||||||
|
}
|
||||||
|
composable(route = RecipesDestination.route) { RecipeScreen() }
|
||||||
|
composable(route = MatchesDestination.route) { MatchesScreen() }
|
||||||
|
|
||||||
|
// Freezer screens
|
||||||
|
composable(route = FreezerListDestination.route) {
|
||||||
|
FreezerScreen(
|
||||||
|
onClickToFreezer = { freezer_id ->
|
||||||
|
navController.navigate("${FreezerItemListDestination.route}/${freezer_id}")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Items list
|
||||||
|
composable(
|
||||||
|
route = "${FreezerItemListDestination.route}/{freezer_id}", arguments = listOf(
|
||||||
|
navArgument("freezer_id") {
|
||||||
|
this.type = NavType.IntType
|
||||||
|
this.nullable = false
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
// this is called everytime you enter AND leave the view, so update the freezerlist like this?
|
||||||
|
val test = it.savedStateHandle.getLiveData<FreezerItem>("updatedFreezer")
|
||||||
|
Log.d("IDK", "${test.value?.item}")
|
||||||
|
FreezerItemListScreen(
|
||||||
|
onEditItem = { freezerItem ->
|
||||||
|
// I want onEditItem to open a modal dialog, so not sure if this is needed here...
|
||||||
|
navController.navigate("${FreezerItemDetailDestination.route}/${freezerItem}")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit items
|
||||||
|
composable(route = "${FreezerItemDetailDestination.route}/{freezer_id}",
|
||||||
|
arguments = listOf(
|
||||||
|
navArgument("freezer_id") {
|
||||||
|
this.type = NavType.IntType
|
||||||
|
this.nullable = false
|
||||||
|
}
|
||||||
|
)) {
|
||||||
|
FreezerItemEditScreen { navController.popBackStack() }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
55
app/src/main/java/com/mitchelbv/thuis_c/ThuisDestination.kt
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
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 HomeDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.Home
|
||||||
|
override val destinationName = R.string.nav_home
|
||||||
|
override val route = "home"
|
||||||
|
}
|
||||||
|
|
||||||
|
object RecipesDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.List
|
||||||
|
override val destinationName = R.string.nav_recipes
|
||||||
|
override val route = "recipes"
|
||||||
|
}
|
||||||
|
|
||||||
|
object MatchesDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.DateRange
|
||||||
|
override val destinationName = R.string.nav_matches
|
||||||
|
override val route = "matches"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Freezers
|
||||||
|
object FreezerListDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.DateRange
|
||||||
|
override val destinationName = R.string.home_card_freezer
|
||||||
|
override val route = "freezer_list"
|
||||||
|
}
|
||||||
|
|
||||||
|
object FreezerItemListDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.DateRange
|
||||||
|
override val destinationName = R.string.home_card_freezer
|
||||||
|
override val route = "freezer_item_list"
|
||||||
|
}
|
||||||
|
|
||||||
|
object FreezerItemDetailDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.DateRange
|
||||||
|
override val destinationName = R.string.home_card_freezer
|
||||||
|
override val route = "freezer_item_detail"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cards
|
||||||
|
object CardsDestination : ThuisDestination {
|
||||||
|
override val icon = Icons.Default.DateRange
|
||||||
|
override val destinationName = R.string.home_card_cards
|
||||||
|
override val route = "cards"
|
||||||
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.database
|
|
||||||
|
|
||||||
import androidx.room.Entity
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
import com.mitchelbv.thuis_c.ui.feyenoord.Match
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
data class DatabaseMatches constructor(
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
|
||||||
val id: Int,
|
|
||||||
val home_team: String,
|
|
||||||
val away_team: String,
|
|
||||||
val date: String,
|
|
||||||
val begin_time: String,
|
|
||||||
val end_time: String,
|
|
||||||
val home_image: String,
|
|
||||||
val away_image: String
|
|
||||||
)
|
|
||||||
|
|
||||||
fun List<DatabaseMatches>.asDomainModel(): List<Match> {
|
|
||||||
return map {
|
|
||||||
Match(
|
|
||||||
home_team = it.home_team,
|
|
||||||
away_team = it.away_team,
|
|
||||||
date = it.date,
|
|
||||||
begin_time = it.begin_time,
|
|
||||||
end_time = it.end_time,
|
|
||||||
home_image = it.home_image,
|
|
||||||
away_image = it.away_image
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.database
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.room.*
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
@Dao
|
|
||||||
interface MatchDao {
|
|
||||||
@Query("select * from databasematches")
|
|
||||||
fun getMatches(): LiveData<List<DatabaseMatches>>
|
|
||||||
|
|
||||||
@Query("select * from databasematches order by id ASC")
|
|
||||||
fun getUpcomingMatch(): LiveData<DatabaseMatches>
|
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
||||||
fun insertAll(matches: List<DatabaseMatches>)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Database(entities = [DatabaseMatches::class], version = 1)
|
|
||||||
abstract class MatchesDatabase : RoomDatabase() {
|
|
||||||
abstract val matchDao: MatchDao
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@Volatile
|
|
||||||
private lateinit var INSTANCE: MatchesDatabase
|
|
||||||
|
|
||||||
fun getDatabase(context: Context): MatchesDatabase {
|
|
||||||
synchronized(MatchesDatabase::class.java) {
|
|
||||||
if (!::INSTANCE.isInitialized) {
|
|
||||||
INSTANCE = Room.databaseBuilder(
|
|
||||||
context.applicationContext,
|
|
||||||
MatchesDatabase::class.java,
|
|
||||||
"matches"
|
|
||||||
).build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return INSTANCE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ import retrofit2.Retrofit
|
|||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
|
||||||
object FeyenoordRetrofitHelper {
|
object FeyenoordRetrofitHelper {
|
||||||
val baseUrl = "https://tickets-api.feyenoord.nl/api/"
|
val baseUrl = "https://feyenoord.api.tymes4-infra.com/v2/"
|
||||||
|
|
||||||
private val retrofit = Retrofit.Builder()
|
private val retrofit = Retrofit.Builder()
|
||||||
.baseUrl(baseUrl)
|
.baseUrl(baseUrl)
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
package com.mitchelbv.thuis_c.network.feyenoord
|
package com.mitchelbv.thuis_c.network.feyenoord
|
||||||
|
|
||||||
import com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
|
import com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordEventResponse
|
||||||
|
import com.mitchelbv.thuis_c.network.feyenoord.responses.FeyenoordTokenResponse
|
||||||
|
import retrofit2.Call
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
|
||||||
interface FeyenoordService {
|
interface FeyenoordService {
|
||||||
@GET("event")
|
@GET("Event")
|
||||||
suspend fun getEvents(): FeyenoordEventResponse
|
suspend fun getEvents(@Header("Authorization") token: String): FeyenoordEventResponse
|
||||||
|
|
||||||
|
@GET("Account/default-token")
|
||||||
|
suspend fun getDefaultToken(): FeyenoordTokenResponse
|
||||||
}
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.network.feyenoord.responses
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
|
|
||||||
data class ButtonData(
|
|
||||||
|
|
||||||
@SerializedName("EventId") var EventId: Int? = null,
|
|
||||||
@SerializedName("SaleCategoryId") var SaleCategoryId: Int? = null,
|
|
||||||
@SerializedName("TranslationCode") var TranslationCode: String? = null,
|
|
||||||
@SerializedName("ButtonStyle") var ButtonStyle: Int? = null,
|
|
||||||
@SerializedName("ActionType") var ActionType: Int? = null,
|
|
||||||
@SerializedName("Action") var Action: String? = null,
|
|
||||||
@SerializedName("ActiveFrom") var ActiveFrom: String? = null,
|
|
||||||
@SerializedName("ActiveTill") var ActiveTill: String? = null,
|
|
||||||
@SerializedName("OpenInNewTab") var OpenInNewTab: Boolean? = null,
|
|
||||||
@SerializedName("InitiativeId") var InitiativeId: String? = null,
|
|
||||||
@SerializedName("Id") var Id: Int? = null,
|
|
||||||
@SerializedName("Created") var Created: String? = null,
|
|
||||||
@SerializedName("Modified") var Modified: String? = null,
|
|
||||||
@SerializedName("Deleted") var Deleted: String? = null
|
|
||||||
|
|
||||||
)
|
|
||||||
@@ -1,62 +1,10 @@
|
|||||||
package com.mitchelbv.thuis_c.network.feyenoord.responses
|
package com.mitchelbv.thuis_c.network.feyenoord.responses
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
import com.mitchelbv.thuis_c.database.DatabaseMatches
|
|
||||||
import com.mitchelbv.thuis_c.ui.feyenoord.Match
|
|
||||||
|
|
||||||
|
|
||||||
data class FeyenoordEventResponse(
|
data class FeyenoordEventResponse(
|
||||||
@SerializedName("HeaderItem") var HeaderItem: HeaderItem? = HeaderItem(),
|
@Transient @SerializedName("HeaderItem") var HeaderItem: Nothing? = null,
|
||||||
@SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(),
|
@SerializedName("TabItems") var TabItems: ArrayList<TabItems> = arrayListOf(),
|
||||||
@SerializedName("CrossSellInfo") var CrossSellInfo: String? = null
|
@Transient @SerializedName("CrossSellInfo") var CrossSellInfo: Nothing? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
fun notNullHandler(test: String?): String {
|
|
||||||
if (!test.isNullOrEmpty()) {
|
|
||||||
return test;
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
fun FeyenoordEventResponse.asDomainModel(): List<Match> {
|
|
||||||
val tempMatches = mutableListOf<Match>()
|
|
||||||
val test2 = TabItems.filter { it.CategoryId == 2 }
|
|
||||||
test2.forEach { items ->
|
|
||||||
for (item in items.Items) {
|
|
||||||
tempMatches.add(
|
|
||||||
Match(
|
|
||||||
home_team = notNullHandler(item.NameHomeTeam),
|
|
||||||
away_team = notNullHandler(item.NameAwayTeam),
|
|
||||||
date = notNullHandler(item.EventStartDateTimeFormatted?.Full),
|
|
||||||
begin_time = notNullHandler(item.EventStartDateTimeFormatted?.Time),
|
|
||||||
end_time = notNullHandler(item.EventEndDateTimeFormatted?.Time),
|
|
||||||
away_image = notNullHandler(item.AwayImageUrl),
|
|
||||||
home_image = notNullHandler(item.HomeImageUrl)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tempMatches
|
|
||||||
}
|
|
||||||
|
|
||||||
fun FeyenoordEventResponse.asDatabaseModel(): List<DatabaseMatches> {
|
|
||||||
val tempMatches = mutableListOf<DatabaseMatches>()
|
|
||||||
val test2 = TabItems.filter { it.CategoryId == 2 }
|
|
||||||
test2.forEach { items ->
|
|
||||||
for (item in items.Items) {
|
|
||||||
tempMatches.add(
|
|
||||||
DatabaseMatches(
|
|
||||||
id = item.EventId!!,
|
|
||||||
home_team = notNullHandler(item.NameHomeTeam),
|
|
||||||
away_team = notNullHandler(item.NameAwayTeam),
|
|
||||||
date = notNullHandler(item.EventStartDateTimeFormatted?.Full),
|
|
||||||
begin_time = notNullHandler(item.EventStartDateTimeFormatted?.Time),
|
|
||||||
end_time = notNullHandler(item.EventEndDateTimeFormatted?.Time),
|
|
||||||
away_image = notNullHandler(item.AwayImageUrl),
|
|
||||||
home_image = notNullHandler(item.HomeImageUrl)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tempMatches
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.mitchelbv.thuis_c.network.feyenoord.responses
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
|
||||||
|
data class FeyenoordTokenResponse(
|
||||||
|
|
||||||
|
@SerializedName("AuthResult") var AuthResult: Int? = null,
|
||||||
|
@SerializedName("Token") var Token: String? = null,
|
||||||
|
@Transient @SerializedName("CurrentChannel") var CurrentChannel: Nothing? = null,
|
||||||
|
@Transient @SerializedName("SalesChannels") var SalesChannels: Nothing? = null,
|
||||||
|
|
||||||
|
)
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.network.feyenoord.responses
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
|
|
||||||
data class HeaderItem (
|
|
||||||
|
|
||||||
@SerializedName("DisplayCountdown" ) var DisplayCountdown : Boolean? = null,
|
|
||||||
@SerializedName("ShowResellInHeader" ) var ShowResellInHeader : Boolean? = null,
|
|
||||||
@SerializedName("ResellTicketsAllowed" ) var ResellTicketsAllowed : Boolean? = null,
|
|
||||||
@SerializedName("ResellTicketsFrom" ) var ResellTicketsFrom : String? = null,
|
|
||||||
@SerializedName("ResellTicketsTill" ) var ResellTicketsTill : String? = null,
|
|
||||||
@SerializedName("EventId" ) var EventId : Int? = null,
|
|
||||||
@SerializedName("SaleCategoryId" ) var SaleCategoryId : Int? = null,
|
|
||||||
@SerializedName("HasGeneralSale" ) var HasGeneralSale : Boolean? = null,
|
|
||||||
@SerializedName("VisibleInShop" ) var VisibleInShop : Boolean? = null,
|
|
||||||
@SerializedName("HighlightInShop" ) var HighlightInShop : Boolean? = null,
|
|
||||||
@SerializedName("HasSoldOut" ) var HasSoldOut : Boolean? = null,
|
|
||||||
@SerializedName("OnGeneralSaleFrom" ) var OnGeneralSaleFrom : String? = null,
|
|
||||||
@SerializedName("OnGeneralSaleTill" ) var OnGeneralSaleTill : String? = null,
|
|
||||||
@SerializedName("VisibleInShopFrom" ) var VisibleInShopFrom : String? = null,
|
|
||||||
@SerializedName("VisibleInShopTill" ) var VisibleInShopTill : String? = null,
|
|
||||||
@SerializedName("Name" ) var Name : String? = null,
|
|
||||||
@SerializedName("NameHomeTeam" ) var NameHomeTeam : String? = null,
|
|
||||||
@SerializedName("NameAwayTeam" ) var NameAwayTeam : String? = null,
|
|
||||||
@SerializedName("EventStartDateTime" ) var EventStartDateTime : String? = null,
|
|
||||||
@SerializedName("EventStartDateTimeOffset" ) var EventStartDateTimeOffset : String? = null,
|
|
||||||
@SerializedName("EventEndDateTime" ) var EventEndDateTime : String? = null,
|
|
||||||
@SerializedName("CategoryTranslationCode" ) var CategoryTranslationCode : String? = null,
|
|
||||||
@SerializedName("SaleCategoryOrder" ) var SaleCategoryOrder : Int? = null,
|
|
||||||
@SerializedName("ImageId" ) var ImageId : String? = null,
|
|
||||||
@SerializedName("ImageFileName" ) var ImageFileName : String? = null,
|
|
||||||
@SerializedName("ImageUniqueName" ) var ImageUniqueName : String? = null,
|
|
||||||
@SerializedName("HomeImageId" ) var HomeImageId : Int? = null,
|
|
||||||
@SerializedName("HomeImageFileName" ) var HomeImageFileName : String? = null,
|
|
||||||
@SerializedName("HomeImageUniqueName" ) var HomeImageUniqueName : String? = null,
|
|
||||||
@SerializedName("AwayImageId" ) var AwayImageId : Int? = null,
|
|
||||||
@SerializedName("AwayImageFileName" ) var AwayImageFileName : String? = null,
|
|
||||||
@SerializedName("AwayImageUniqueName" ) var AwayImageUniqueName : String? = null,
|
|
||||||
@SerializedName("HasTicketsAvailable" ) var HasTicketsAvailable : Boolean? = null,
|
|
||||||
@SerializedName("HasMarketplaceTicketsAvailable" ) var HasMarketplaceTicketsAvailable : Boolean? = null,
|
|
||||||
@SerializedName("HasPossibleTicketsInFuture" ) var HasPossibleTicketsInFuture : Boolean? = null,
|
|
||||||
@SerializedName("CurrentlyOnSaleForUser" ) var CurrentlyOnSaleForUser : Boolean? = null,
|
|
||||||
@SerializedName("PurchaseRightAvailableAfterLogin" ) var PurchaseRightAvailableAfterLogin : Boolean? = null,
|
|
||||||
@SerializedName("ImageUrl" ) var ImageUrl : String? = null,
|
|
||||||
@SerializedName("HomeImageUrl" ) var HomeImageUrl : String? = null,
|
|
||||||
@SerializedName("AwayImageUrl" ) var AwayImageUrl : String? = null,
|
|
||||||
@SerializedName("EventTypeName" ) var EventTypeName : String? = null,
|
|
||||||
@SerializedName("EventTypeLogoId" ) var EventTypeLogoId : Int? = null,
|
|
||||||
@SerializedName("EventTypeLogoUrl" ) var EventTypeLogoUrl : String? = null,
|
|
||||||
@SerializedName("EventTypeLogoFileName" ) var EventTypeLogoFileName : String? = null,
|
|
||||||
@SerializedName("EventTypeLogoUniqueName" ) var EventTypeLogoUniqueName : String? = null,
|
|
||||||
@SerializedName("InfoUrl" ) var InfoUrl : String? = null,
|
|
||||||
@SerializedName("EventStartDateTimeFormatted" ) var EventStartDateTimeFormatted : EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
|
|
||||||
@SerializedName("EventEndDateTimeFormatted" ) var EventEndDateTimeFormatted : EventEndDateTimeFormatted? = EventEndDateTimeFormatted(),
|
|
||||||
@SerializedName("ButtonData" ) var ButtonData : ButtonData? = ButtonData(),
|
|
||||||
@SerializedName("ShowMarketplaceForEvent" ) var ShowMarketplaceForEvent : Boolean? = null,
|
|
||||||
@SerializedName("RedirectToMarketplace" ) var RedirectToMarketplace : Boolean? = null,
|
|
||||||
@SerializedName("MarketplaceButtonTextColor" ) var MarketplaceButtonTextColor : String? = null,
|
|
||||||
@SerializedName("MarketplaceButtonBackgroundColor" ) var MarketplaceButtonBackgroundColor : String? = null,
|
|
||||||
@SerializedName("DeepLinkRoute" ) var DeepLinkRoute : String? = null
|
|
||||||
|
|
||||||
)
|
|
||||||
@@ -51,9 +51,7 @@ data class Items(
|
|||||||
@SerializedName("EventTypeLogoFileName") var EventTypeLogoFileName: String? = null,
|
@SerializedName("EventTypeLogoFileName") var EventTypeLogoFileName: String? = null,
|
||||||
@SerializedName("EventTypeLogoUniqueName") var EventTypeLogoUniqueName: String? = null,
|
@SerializedName("EventTypeLogoUniqueName") var EventTypeLogoUniqueName: String? = null,
|
||||||
@SerializedName("InfoUrl") var InfoUrl: String? = null,
|
@SerializedName("InfoUrl") var InfoUrl: String? = null,
|
||||||
@SerializedName("EventStartDateTimeFormatted") var EventStartDateTimeFormatted: EventStartDateTimeFormatted? = EventStartDateTimeFormatted(),
|
@Transient @SerializedName("ButtonData") var ButtonData: Nothing? = null,
|
||||||
@SerializedName("EventEndDateTimeFormatted") var EventEndDateTimeFormatted: EventEndDateTimeFormatted? = EventEndDateTimeFormatted(),
|
|
||||||
@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,
|
||||||
|
|||||||
@@ -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,63 @@
|
|||||||
|
package com.mitchelbv.thuis_c.network.thuis
|
||||||
|
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.*
|
||||||
|
import retrofit2.Response
|
||||||
|
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(@Path("id") id: Int): FreezerItem
|
||||||
|
|
||||||
|
@GET("api/FreezerItem/InFreezer/{id}")
|
||||||
|
suspend fun getFreezerItemsInFreezer(@Path("id") id: Int): List<FreezerItem>
|
||||||
|
|
||||||
|
// Post (used to create a new item)
|
||||||
|
@POST("api/FreezerItem")
|
||||||
|
suspend fun postFreezerItem(@Body freezerItem: FreezerItem): FreezerItem
|
||||||
|
|
||||||
|
// Put (used to update an item)
|
||||||
|
@PUT("api/FreezerItem/{id}")
|
||||||
|
suspend fun putFreezerItem(@Path("id") id: Int, @Body freezerItem: FreezerItem): List<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
|
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
|
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("name") var name: 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? = "",
|
||||||
|
@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,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()
|
||||||
|
)
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.repository
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.Transformations
|
|
||||||
import com.mitchelbv.thuis_c.database.MatchesDatabase
|
|
||||||
import com.mitchelbv.thuis_c.database.asDomainModel
|
|
||||||
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
|
|
||||||
import com.mitchelbv.thuis_c.network.feyenoord.responses.asDatabaseModel
|
|
||||||
import com.mitchelbv.thuis_c.ui.feyenoord.Match
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
|
|
||||||
class FeyenoordRepository(private val database: MatchesDatabase) {
|
|
||||||
val matches: LiveData<List<Match>> = Transformations.map(database.matchDao.getMatches()) {
|
|
||||||
it.asDomainModel()
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun refreshMatches() {
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val matches = FeyenoordRetrofitHelper.feyenoord.getEvents()
|
|
||||||
database.matchDao.insertAll(matches.asDatabaseModel())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
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 kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
data class CardUiState(
|
|
||||||
val cards: List<Card> = listOf()
|
|
||||||
)
|
|
||||||
|
|
||||||
class CardViewModel : ViewModel() {
|
|
||||||
private val _uiState = MutableStateFlow(CardUiState())
|
|
||||||
val uiState: StateFlow<CardUiState> = _uiState.asStateFlow()
|
|
||||||
|
|
||||||
init {
|
|
||||||
fillCards()
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.ui.feyenoord
|
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.mitchelbv.thuis_c.database.MatchesDatabase.Companion.getDatabase
|
|
||||||
import com.mitchelbv.thuis_c.repository.FeyenoordRepository
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
data class FeyenoordUiState(
|
|
||||||
val matches: List<Match> = listOf()
|
|
||||||
)
|
|
||||||
|
|
||||||
class FeyenoordViewModel(application: Application) : ViewModel() {
|
|
||||||
private val _uiState = MutableStateFlow(FeyenoordUiState())
|
|
||||||
val uiState: StateFlow<FeyenoordUiState> = _uiState.asStateFlow()
|
|
||||||
|
|
||||||
private val feyenoordRepository = FeyenoordRepository(getDatabase(application))
|
|
||||||
val matches = feyenoordRepository.matches
|
|
||||||
|
|
||||||
init {
|
|
||||||
refreshMatchesFromRepository()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refreshMatchesFromRepository() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
feyenoordRepository.refreshMatches()
|
|
||||||
_uiState.value = FeyenoordUiState(matches = matches.value!!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// private fun fillMatches() {
|
|
||||||
// // TODO Get data from the internet
|
|
||||||
// val tempMatches = mutableListOf<Match>()
|
|
||||||
// viewModelScope.launch(Dispatchers.IO) {
|
|
||||||
// val fApiClient =
|
|
||||||
// FeyenoordRetrofitHelper.getInstance().create(FeyenoordService::class.java)
|
|
||||||
// val apiResponse = fApiClient.getEvents()
|
|
||||||
// for (tabItem in apiResponse.TabItems) {
|
|
||||||
// val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
|
|
||||||
// test.forEach {
|
|
||||||
// for (item in it.Items) {
|
|
||||||
// tempMatches.add(Match(
|
|
||||||
// home_team = item.NameHomeTeam!!,
|
|
||||||
// away_team = item.NameAwayTeam!!,
|
|
||||||
// date = item.EventStartDateTimeFormatted?.Full!!,
|
|
||||||
// begin_time = item.EventStartDateTimeFormatted?.Time!!,
|
|
||||||
// end_time = item.EventEndDateTimeFormatted?.Time!!,
|
|
||||||
// away_image = item.AwayImageUrl!!,
|
|
||||||
// home_image = item.HomeImageUrl!!
|
|
||||||
// ))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// _uiState.value = FeyenoordUiState(matches = tempMatches)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.mitchelbv.thuis_c.ui.home
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.material3.*
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.navigation.NavHostController
|
|
||||||
import com.mitchelbv.thuis_c.ui.theme.Typography
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun HomeScreen(navController: NavHostController) {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
|
|
||||||
Text("De thuis app!", style = Typography.bodySmall)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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)
|
||||||
@@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
)
|
)
|
||||||
*/
|
|
||||||
)
|
)
|
||||||
@@ -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,
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.card
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
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
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
data class CardUiState(
|
||||||
|
val cards: List<Card> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
class CardViewModel : ViewModel() {
|
||||||
|
private val _uiState = MutableStateFlow(CardUiState())
|
||||||
|
val uiState: StateFlow<CardUiState> = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
init {
|
||||||
|
fillCards()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fillCards() {
|
||||||
|
// 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,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.*
|
||||||
@@ -6,9 +6,10 @@ 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 {
|
||||||
@@ -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
|
||||||
@@ -15,12 +15,11 @@ 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(), 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
|
||||||
@@ -41,20 +40,16 @@ fun MatchList(matches: List<Match>, modifier: Modifier) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TeamNameWithLogo(team_name: String, team_logo_url: String, modifier: Modifier) {
|
fun TeamNameWithLogo(teamName: String, teamLogoUrl: String, modifier: Modifier) {
|
||||||
Column(modifier = modifier
|
Column(modifier = modifier.size(128.dp).fillMaxWidth(), Arrangement.Center, Alignment.CenterHorizontally) {
|
||||||
.size(128.dp)
|
|
||||||
.fillMaxWidth(), Arrangement.Center, Alignment.CenterHorizontally) {
|
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = team_logo_url,
|
model = teamLogoUrl,
|
||||||
contentDescription = team_name,
|
contentDescription = teamName,
|
||||||
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)
|
||||||
)
|
)
|
||||||
Text(text = team_name, modifier = modifier
|
Text(text = teamName, modifier = modifier.fillMaxWidth().wrapContentWidth(Alignment.CenterHorizontally))
|
||||||
.fillMaxWidth()
|
|
||||||
.wrapContentWidth(Alignment.CenterHorizontally))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -70,8 +65,8 @@ fun MatchCard(match: Match, modifier: Modifier) {
|
|||||||
.height(128.dp)
|
.height(128.dp)
|
||||||
) {
|
) {
|
||||||
TeamNameWithLogo(
|
TeamNameWithLogo(
|
||||||
team_name = match.home_team,
|
teamName = match.home_team,
|
||||||
team_logo_url = match.home_image,
|
teamLogoUrl = match.home_image,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
Column(
|
Column(
|
||||||
@@ -86,8 +81,8 @@ fun MatchCard(match: Match, modifier: Modifier) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TeamNameWithLogo(
|
TeamNameWithLogo(
|
||||||
team_name = match.away_team,
|
teamName = match.away_team,
|
||||||
team_logo_url = match.away_image,
|
teamLogoUrl = match.away_image ?: "",
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -102,7 +97,7 @@ fun PreviewMatchCard() {
|
|||||||
away_image = "https://tymes4-cdn.azureedge.net/feyenoord/291-S.S._Lazio_badge.svg-min-original.png",
|
away_image = "https://tymes4-cdn.azureedge.net/feyenoord/291-S.S._Lazio_badge.svg-min-original.png",
|
||||||
home_team = "Feyenoord Vrouwen 1",
|
home_team = "Feyenoord Vrouwen 1",
|
||||||
away_team = "FC Twente Vrouwen 1",
|
away_team = "FC Twente Vrouwen 1",
|
||||||
date = "do 03 November 2023",
|
date = "03 Nov 2024",
|
||||||
begin_time = "18:03",
|
begin_time = "18:03",
|
||||||
end_time = "20:03"
|
end_time = "20:03"
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.feyenoord
|
||||||
|
|
||||||
|
import androidx.compose.ui.text.toLowerCase
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
|
||||||
|
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.time.LocalDateTime
|
||||||
|
import java.time.ZoneId
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
import java.time.format.FormatStyle
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
data class FeyenoordUiState(
|
||||||
|
val matches: List<Match> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
class FeyenoordViewModel : ViewModel() {
|
||||||
|
private val _uiState = MutableStateFlow(FeyenoordUiState())
|
||||||
|
val uiState: StateFlow<FeyenoordUiState> = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
init {
|
||||||
|
fillMatches()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fillMatches() {
|
||||||
|
val tempMatches = mutableListOf<Match>()
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val getToken = FeyenoordRetrofitHelper.feyenoord.getDefaultToken().Token
|
||||||
|
val apiResponse = FeyenoordRetrofitHelper.feyenoord.getEvents("Bearer $getToken")
|
||||||
|
val dayOfWeek = arrayOf("Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo")
|
||||||
|
for (tabItem in apiResponse.TabItems) {
|
||||||
|
val test = arrayOf(tabItem).filter { it.CategoryId == 2 }
|
||||||
|
test.forEach {
|
||||||
|
for (item in it.Items) {
|
||||||
|
val utcDateBegin = LocalDateTime.parse(item.EventStartDateTime)
|
||||||
|
val beginDate = utcDateBegin.atZone(ZoneId.of("UTC"))
|
||||||
|
.withZoneSameInstant(ZoneId.of("Europe/Amsterdam")).toLocalDateTime()
|
||||||
|
val utcDateEnd = LocalDateTime.parse(item.EventEndDateTime)
|
||||||
|
val endDate = utcDateEnd.atZone(ZoneId.of("UTC"))
|
||||||
|
.withZoneSameInstant(ZoneId.of("Europe/Amsterdam")).toLocalDateTime()
|
||||||
|
tempMatches.add(
|
||||||
|
Match(
|
||||||
|
home_team = item.NameHomeTeam!!,
|
||||||
|
away_team = item.NameAwayTeam!!,
|
||||||
|
date = "${dayOfWeek[beginDate.dayOfWeek.value - 1]} ${beginDate.dayOfMonth} ${beginDate.month.toString()
|
||||||
|
.lowercase(Locale.getDefault())}",
|
||||||
|
begin_time = "${beginDate.toLocalTime()}",
|
||||||
|
end_time = "${endDate.toLocalTime()}",
|
||||||
|
away_image = item.AwayImageUrl,
|
||||||
|
home_image = item.HomeImageUrl!!
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_uiState.value = FeyenoordUiState(matches = tempMatches)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
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,
|
||||||
val away_image: String,
|
val away_image: String?,
|
||||||
val home_team: String,
|
val home_team: String,
|
||||||
val away_team: String,
|
val away_team: String,
|
||||||
val date: String,
|
val date: String,
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.freezer
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
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.ArrowForward
|
||||||
|
import androidx.compose.material.icons.filled.Edit
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.State
|
||||||
|
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.network.thuis.responses.Freezer
|
||||||
|
import com.mitchelbv.thuis_c.ui.theme.ThuisTypography
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
||||||
|
lateinit var freezerUiState: State<FreezerUiState>
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FreezerScreen(
|
||||||
|
freezerViewModel: FreezerViewModel = viewModel(),
|
||||||
|
onClickToFreezer: (freezer_id: Int) -> Unit
|
||||||
|
) {
|
||||||
|
freezerUiState = freezerViewModel.uiState.collectAsState()
|
||||||
|
FreezerList(onClickToFreezer, Modifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FreezerList(
|
||||||
|
onClickToFreezer: (freezer_id: Int) -> Unit,
|
||||||
|
modifier: Modifier
|
||||||
|
) {
|
||||||
|
if (freezerUiState.value.loading) {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (freezerUiState.value.freezers.isNotEmpty() && !freezerUiState.value.loading) {
|
||||||
|
LazyColumn {
|
||||||
|
items(freezerUiState.value.freezers) { freezer ->
|
||||||
|
FreezerListItem(
|
||||||
|
freezer = freezer,
|
||||||
|
navigateTo = { freezer.freezerId?.let { onClickToFreezer(it) } },
|
||||||
|
modifier = modifier
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Text(stringResource(id = R.string.freezer_list_empty))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun FreezerListItem(freezer: Freezer, navigateTo: () -> Unit, modifier: Modifier) {
|
||||||
|
Column {
|
||||||
|
ListItem(
|
||||||
|
headlineContent = { Text(freezer.name!!) },
|
||||||
|
supportingContent = { Text(" ${freezer.amountInFreezer} " + stringResource(id = R.string.freezer_item_count_partial)) },
|
||||||
|
trailingContent = { Icon(Icons.Default.ArrowForward, "")},
|
||||||
|
modifier = modifier.clickable { navigateTo() }
|
||||||
|
)
|
||||||
|
Divider()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun FreezerCard(freezer: Freezer, navigateTo: () -> Unit) {
|
||||||
|
Card(
|
||||||
|
onClick = { navigateTo() }, modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(100.dp)
|
||||||
|
.padding(10.dp)
|
||||||
|
) {
|
||||||
|
Text(freezer.name!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(widthDp = 250, showBackground = true, heightDp = 300)
|
||||||
|
@Composable
|
||||||
|
fun FreezerListItemPreview() {
|
||||||
|
val freezer = Freezer(freezerId = 1, name = "Keuken", amountInFreezer = 5)
|
||||||
|
Column {
|
||||||
|
FreezerListItem(freezer = freezer, modifier = Modifier, navigateTo = {})
|
||||||
|
FreezerListItem(freezer = freezer, modifier = Modifier, navigateTo = {})
|
||||||
|
FreezerListItem(freezer = freezer, modifier = Modifier, navigateTo = {})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.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(),
|
||||||
|
val loading: Boolean = true
|
||||||
|
)
|
||||||
|
|
||||||
|
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(freezers = apiResponse, loading = false)
|
||||||
|
} catch (e: ConnectException) {
|
||||||
|
_uiState.value = FreezerUiState(listOf(), loading = false)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.freezer.item_list
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
import com.mitchelbv.thuis_c.R
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.FreezerItem
|
||||||
|
import com.mitchelbv.thuis_c.ui.theme.ThuisTypography
|
||||||
|
|
||||||
|
// Is the destination of FreezerItemListDestination
|
||||||
|
@Composable
|
||||||
|
fun FreezerItemListScreen(
|
||||||
|
freezerItemListViewModel: FreezerItemListViewModel = viewModel(),
|
||||||
|
onEditItem: (Int) -> Unit
|
||||||
|
) {
|
||||||
|
val freezerItemListUiState by freezerItemListViewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
val itemObserver = freezerItemListUiState.items.observeAsState()
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
itemObserver.value?.forEach { freezerItem ->
|
||||||
|
FreezerItemElement(
|
||||||
|
freezerItem = freezerItem,
|
||||||
|
arrowPressed = { item_id: Int, newAmount: Int ->
|
||||||
|
freezerItemListViewModel.UpdateItemAmount(
|
||||||
|
item_id,
|
||||||
|
newAmount
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onEditItem = onEditItem
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun FreezerItemElement(
|
||||||
|
freezerItem: FreezerItem,
|
||||||
|
arrowPressed: (Int, Int) -> Unit,
|
||||||
|
onEditItem: (Int) -> Unit
|
||||||
|
) {
|
||||||
|
ListItem(
|
||||||
|
headlineContent = { Text("${freezerItem.item}") },
|
||||||
|
supportingContent = { Text("${stringResource(R.string.freezer_item_drawer_partial)} ${freezerItem.drawer}") },
|
||||||
|
trailingContent = {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceEvenly
|
||||||
|
) {
|
||||||
|
TextButton(onClick = {
|
||||||
|
arrowPressed(
|
||||||
|
freezerItem.freezerItemId!!,
|
||||||
|
freezerItem.amount!!.minus(1)
|
||||||
|
)
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.KeyboardArrowDown, contentDescription = "Minus one")
|
||||||
|
}
|
||||||
|
Text("${freezerItem.amount}", style = ThuisTypography.bodyLarge)
|
||||||
|
TextButton(onClick = {
|
||||||
|
arrowPressed(
|
||||||
|
freezerItem.freezerItemId!!,
|
||||||
|
freezerItem.amount!!.plus(1)
|
||||||
|
)
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.KeyboardArrowUp, contentDescription = "Plus one")
|
||||||
|
}
|
||||||
|
TextButton(onClick = { onEditItem(freezerItem.freezerItemId!!) }) {
|
||||||
|
Icon(Icons.Default.Edit, contentDescription = "Edit ${freezerItem.item}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.freezer.item_list
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.lifecycle.*
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.ThuisRetrofitHelper
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.FreezerItem
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.flow.update
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import retrofit2.HttpException
|
||||||
|
import java.net.ConnectException
|
||||||
|
import java.net.SocketTimeoutException
|
||||||
|
|
||||||
|
data class FreezerItemListUiState(
|
||||||
|
val items: MutableLiveData<List<FreezerItem>> = MutableLiveData<List<FreezerItem>>(),
|
||||||
|
var error: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
class FreezerItemListViewModel(savedStateHandle: SavedStateHandle) : ViewModel() {
|
||||||
|
private val _uiState = MutableStateFlow(FreezerItemListUiState())
|
||||||
|
val uiState: StateFlow<FreezerItemListUiState> = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
init {
|
||||||
|
savedStateHandle.get<Int>("freezer_id")?.let { fillItemList(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fillItemList(freezer_id: Int) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val apiResponse =
|
||||||
|
ThuisRetrofitHelper.thuis.getFreezerItemsInFreezer(id = freezer_id)
|
||||||
|
_uiState.value = FreezerItemListUiState(MutableLiveData(apiResponse))
|
||||||
|
|
||||||
|
} catch (e: ConnectException) {
|
||||||
|
// _uiState.value = FreezerItemListUiState(listOf(FreezerItem(item = )))
|
||||||
|
_uiState.value = FreezerItemListUiState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// new model instead of this?
|
||||||
|
fun UpdateItemAmount(item_id: Int, newAmount: Int) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val itemList = _uiState.value.items.value!!.toMutableList()
|
||||||
|
val indexFreezerItem =
|
||||||
|
itemList.indexOf(uiState.value.items.value!!.find { a -> a.freezerItemId == item_id })
|
||||||
|
val freezerItemToUpdate = itemList[indexFreezerItem]
|
||||||
|
freezerItemToUpdate.amount = newAmount
|
||||||
|
// itemList[indexFreezerItem] = freezerItemToUpdate
|
||||||
|
val apiResponse =
|
||||||
|
ThuisRetrofitHelper.thuis.putFreezerItem(item_id, freezerItemToUpdate)
|
||||||
|
_uiState.update { currentState ->
|
||||||
|
currentState.copy(items = MutableLiveData(apiResponse))
|
||||||
|
}
|
||||||
|
} catch (e: HttpException) {
|
||||||
|
// TODO Display a snackbar...
|
||||||
|
Log.d(
|
||||||
|
this.javaClass.name.toString(),
|
||||||
|
"HttpException: ${e.code()} ${e.response()!!.errorBody()!!.string()}"
|
||||||
|
)
|
||||||
|
} catch (e: SocketTimeoutException) {
|
||||||
|
// TODO Also display a snackbar
|
||||||
|
Log.d(this.javaClass.name.toString(), "Timeout")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.freezer.item_list.edit_item
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.core.text.isDigitsOnly
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
import com.mitchelbv.thuis_c.R
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.Freezer
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.FreezerItem
|
||||||
|
import com.mitchelbv.thuis_c.network.thuis.responses.FreezerItems
|
||||||
|
import com.mitchelbv.thuis_c.views.freezer.freezerUiState
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FreezerItemEditScreen(
|
||||||
|
freezerItemEditViewModel: FreezerItemEditViewModel = viewModel(),
|
||||||
|
previousScreen: () -> Unit,
|
||||||
|
// updatedFreezerItem: FreezerItem? = null
|
||||||
|
) {
|
||||||
|
val freezerItemUiState by freezerItemEditViewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
if (freezerItemUiState.item != null && freezerItemUiState.freezers != null) {
|
||||||
|
BuildEditView(
|
||||||
|
freezerItem = freezerItemUiState.item!!,
|
||||||
|
freezerList = freezerItemUiState.freezers!!,
|
||||||
|
savePressed = { freezerItemEditViewModel.UpdateFreezerItem(it) },
|
||||||
|
returnScreen = previousScreen,
|
||||||
|
modifier = Modifier
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun BuildEditView(
|
||||||
|
freezerItem: FreezerItem,
|
||||||
|
freezerList: List<Freezer>,
|
||||||
|
savePressed: (FreezerItem) -> Unit,
|
||||||
|
returnScreen: () -> Unit,
|
||||||
|
modifier: Modifier
|
||||||
|
) {
|
||||||
|
var expanded by remember {
|
||||||
|
mutableStateOf(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
var freezerItemLifeCycle by remember {
|
||||||
|
mutableStateOf(freezerItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
var freezerItemAmount by remember {
|
||||||
|
mutableStateOf("${freezerItem.amount}")
|
||||||
|
}
|
||||||
|
var freezerItemDrawer by remember {
|
||||||
|
mutableStateOf("${freezerItem.drawer}")
|
||||||
|
}
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Top,
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
TextField(
|
||||||
|
label = { Text(stringResource(id = R.string.freezer_item_edit_description)) },
|
||||||
|
value = "${freezerItemLifeCycle.item}",
|
||||||
|
onValueChange = { value ->
|
||||||
|
freezerItemLifeCycle = freezerItemLifeCycle.copy(item = value)
|
||||||
|
},
|
||||||
|
maxLines = 2,
|
||||||
|
modifier = modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
Spacer(modifier = modifier.height(15.dp))
|
||||||
|
TextField(
|
||||||
|
label = { Text(stringResource(id = R.string.freezer_item_edit_amount)) },
|
||||||
|
value = freezerItemAmount,
|
||||||
|
onValueChange = { value ->
|
||||||
|
if (value.isBlank()) {
|
||||||
|
freezerItemAmount = ""
|
||||||
|
}
|
||||||
|
if (value.isDigitsOnly() && value.isNotBlank()) {
|
||||||
|
freezerItemAmount = value
|
||||||
|
freezerItemLifeCycle = freezerItemLifeCycle.copy(amount = value.toInt())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
|
maxLines = 1,
|
||||||
|
modifier = modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
Spacer(modifier = modifier.height(15.dp))
|
||||||
|
TextField(
|
||||||
|
label = { Text(stringResource(id = R.string.freezer_item_edit_drawer)) },
|
||||||
|
value = freezerItemDrawer,
|
||||||
|
onValueChange = { value ->
|
||||||
|
if (value.isBlank()) {
|
||||||
|
freezerItemDrawer = ""
|
||||||
|
}
|
||||||
|
if (value.isDigitsOnly() && value.isNotBlank()) {
|
||||||
|
freezerItemDrawer = value
|
||||||
|
freezerItemLifeCycle = freezerItemLifeCycle.copy(drawer = value.toInt())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
|
maxLines = 1,
|
||||||
|
modifier = modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
Spacer(modifier = modifier.height(15.dp))
|
||||||
|
ExposedDropdownMenuBox(
|
||||||
|
expanded = expanded,
|
||||||
|
onExpandedChange = { expanded = !expanded },
|
||||||
|
modifier = modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
TextField(
|
||||||
|
label = { Text(stringResource(id = R.string.freezer_item_edit_freezer)) },
|
||||||
|
value = "${freezerList[freezerItemLifeCycle.freezerId?.minus(1)!!].name}",
|
||||||
|
onValueChange = {},
|
||||||
|
readOnly = true,
|
||||||
|
modifier = modifier
|
||||||
|
.menuAnchor()
|
||||||
|
.fillMaxWidth(),
|
||||||
|
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
ExposedDropdownMenu(
|
||||||
|
expanded = expanded,
|
||||||
|
onDismissRequest = { expanded = false },
|
||||||
|
modifier = modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
freezerList.forEach { freezer ->
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { freezer.name?.let { Text(it) } },
|
||||||
|
onClick = {
|
||||||
|
freezerItemLifeCycle =
|
||||||
|
freezerItemLifeCycle.copy(freezerId = freezer.freezerId)
|
||||||
|
expanded = !expanded
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer(modifier = modifier.height(15.dp))
|
||||||
|
Row(modifier = modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||||
|
Button(onClick = {
|
||||||
|
// Save and return to overview
|
||||||
|
returnScreen()
|
||||||
|
savePressed(freezerItemLifeCycle)
|
||||||
|
}) {
|
||||||
|
Text(stringResource(id = R.string.com_save))
|
||||||
|
}
|
||||||
|
OutlinedButton(onClick = {
|
||||||
|
// Cancel all changes and return to last view
|
||||||
|
returnScreen()
|
||||||
|
}) {
|
||||||
|
Text(stringResource(id = R.string.com_cancel))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(showBackground = true)
|
||||||
|
@Composable
|
||||||
|
fun EditViewPreview() {
|
||||||
|
val test = FreezerItem(freezerItemId = 1, item = "Kip", 5, 5, "12-01-01", 1)
|
||||||
|
val kaas = listOf(
|
||||||
|
Freezer(freezerId = 1, amountInFreezer = 5, name = "Keuken"),
|
||||||
|
Freezer(freezerId = 2, amountInFreezer = 5, name = "Berging")
|
||||||
|
)
|
||||||
|
BuildEditView(freezerItem = test, kaas, {}, {}, Modifier)
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.freezer.item_list.edit_item
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.lifecycle.SavedStateHandle
|
||||||
|
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 com.mitchelbv.thuis_c.network.thuis.responses.FreezerItem
|
||||||
|
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 FreezerItemEditUiState(
|
||||||
|
val item: FreezerItem? = null,
|
||||||
|
var freezerItemAmount: String? = null,
|
||||||
|
var freezerItemDrawer: String? = null,
|
||||||
|
val freezers: List<Freezer>? = null,
|
||||||
|
var error: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
class FreezerItemEditViewModel(savedStateHandle: SavedStateHandle) : ViewModel() {
|
||||||
|
private val _uiState = MutableStateFlow(FreezerItemEditUiState())
|
||||||
|
private val stateHandle = savedStateHandle
|
||||||
|
val uiState: StateFlow<FreezerItemEditUiState> = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
init {
|
||||||
|
savedStateHandle.get<Int>("freezer_id")?.let { PopulateUiState(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun PopulateUiState(freezer_id: Int) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val getFreezers = ThuisRetrofitHelper.thuis.getFreezers()
|
||||||
|
if (freezer_id == 0) {
|
||||||
|
// This is when creating a new frezer item
|
||||||
|
_uiState.value =
|
||||||
|
FreezerItemEditUiState(item = FreezerItem(), freezers = getFreezers)
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
val getFreezerItems =
|
||||||
|
ThuisRetrofitHelper.thuis.getFreezerItem(id = freezer_id)
|
||||||
|
_uiState.value =
|
||||||
|
FreezerItemEditUiState(item = getFreezerItems, freezers = getFreezers)
|
||||||
|
|
||||||
|
} catch (e: ConnectException) {
|
||||||
|
_uiState.value = FreezerItemEditUiState(error = "Oeps")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun UpdateFreezerItem(freezerItem: FreezerItem) {
|
||||||
|
// Log.d("TESTINGGG", "hello ${freezerItem.item}")
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val putFreezerItem = ThuisRetrofitHelper.thuis.putFreezerItem(
|
||||||
|
id = freezerItem.freezerItemId!!,
|
||||||
|
freezerItem = freezerItem
|
||||||
|
)
|
||||||
|
// stateHandle["updatedFreezer"] = freezerItem
|
||||||
|
} catch (e: ConnectException) {
|
||||||
|
// Not sure yet..
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
51
app/src/main/java/com/mitchelbv/thuis_c/views/home/Home.kt
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.home
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
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.ThuisTypography
|
||||||
|
import com.mitchelbv.thuis_c.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun HomeScreen(onClickFreezers: () -> Unit, onClickCards: () -> Unit) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
Text(stringResource(id = R.string.app_name), style = ThuisTypography.bodySmall)
|
||||||
|
// HomeButton(buttonText = R.string.home_card_freezer, onButtonClick = onClickFreezers)
|
||||||
|
HomeCard(
|
||||||
|
cardText = R.string.home_card_freezer,
|
||||||
|
cardImage = "",
|
||||||
|
navigateTo = onClickFreezers
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun HomeButton(buttonText: Int, onButtonClick: () -> Unit) {
|
||||||
|
Button(onClick = { onButtonClick() }) {
|
||||||
|
Text(stringResource(id = buttonText))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun HomeCard(cardText: Int, cardImage: String, navigateTo: () -> Unit) {
|
||||||
|
Column {
|
||||||
|
Card(onClick = { navigateTo() }, modifier = Modifier.size(width = 180.dp, height = 100.dp)) {
|
||||||
|
Column {
|
||||||
|
// TODO Some sort of image here.
|
||||||
|
Text(stringResource(id = cardText), style = ThuisTypography.displayMedium)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.mitchelbv.thuis_c.views.home
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordRetrofitHelper
|
||||||
|
import com.mitchelbv.thuis_c.network.feyenoord.FeyenoordService
|
||||||
|
import com.mitchelbv.thuis_c.views.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)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -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(),
|
||||||
@@ -31,6 +31,7 @@ fun RecipeScreen(navHostController: NavHostController) {
|
|||||||
}
|
}
|
||||||
settings.javaScriptEnabled = true
|
settings.javaScriptEnabled = true
|
||||||
settings.domStorageEnabled = true
|
settings.domStorageEnabled = true
|
||||||
|
settings.safeBrowsingEnabled = false
|
||||||
loadUrl("https://rs.mitchelbv.nl/")
|
loadUrl("https://rs.mitchelbv.nl/")
|
||||||
webView = this
|
webView = this
|
||||||
}
|
}
|
||||||
@@ -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"?>
|
<?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>
|
|
||||||
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"?>
|
<?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>
|
||||||
@@ -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>
|
||||||
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 |
20
app/src/main/res/values-nl-rNL/strings.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Thuis</string>
|
||||||
|
<string name="com_connection_error">Verbindingsproblemen probeer later nog eens.</string>
|
||||||
|
<string name="com_save">Opslaan</string>
|
||||||
|
<string name="com_cancel">Annuleer</string>
|
||||||
|
<string name="nav_matches">Wedstijden</string>
|
||||||
|
<string name="nav_recipes">Recepten</string>
|
||||||
|
<string name="nav_home">Thuis</string>
|
||||||
|
<string name="home_card_cards">Kaarten</string>
|
||||||
|
<string name="home_card_freezer">Vriezers</string>
|
||||||
|
<string name="freezer_list_empty">Geen vriezer(s)</string>
|
||||||
|
<string name="edit_freezer">Vriezer aanpassen</string>
|
||||||
|
<string name="freezer_item_count_partial">Artikelen</string>
|
||||||
|
<string name="freezer_item_drawer_partial">La</string>
|
||||||
|
<string name="freezer_item_edit_description">Omschrijving</string>
|
||||||
|
<string name="freezer_item_edit_amount">Hoeveelheid</string>
|
||||||
|
<string name="freezer_item_edit_drawer">La</string>
|
||||||
|
<string name="freezer_item_edit_freezer">Vriezer</string>
|
||||||
|
</resources>
|
||||||
@@ -1,7 +1,27 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Thuis</string>
|
<string name="app_name">Thuis</string>
|
||||||
|
|
||||||
<string name="nav_feyenoord">Feyenoord</string>
|
<!-- Common errors -->
|
||||||
<string name="nav_recipes">Recepten</string>
|
<string name="com_connection_error">Connection error, try again later.</string>
|
||||||
|
<string name="com_save">Save</string>
|
||||||
|
<string name="com_cancel">Cancel</string>
|
||||||
|
|
||||||
|
<string name="nav_matches">Matches</string>
|
||||||
|
<string name="nav_recipes">Recipes</string>
|
||||||
<string name="nav_home">Home</string>
|
<string name="nav_home">Home</string>
|
||||||
|
|
||||||
|
<string name="home_card_cards">Cards</string>
|
||||||
|
<string name="home_card_freezer">Freezers</string>
|
||||||
|
|
||||||
|
<!-- Freezer item list -->
|
||||||
|
<string name="freezer_list_empty">No freezer(s)</string>
|
||||||
|
<string name="edit_freezer">Edit freezer</string>
|
||||||
|
<string name="freezer_item_count_partial">items</string>
|
||||||
|
<string name="freezer_item_drawer_partial">Drawer</string>
|
||||||
|
|
||||||
|
<!-- Freezer item edit view -->
|
||||||
|
<string name="freezer_item_edit_description">Description</string>
|
||||||
|
<string name="freezer_item_edit_amount">Amount</string>
|
||||||
|
<string name="freezer_item_edit_drawer">Drawer</string>
|
||||||
|
<string name="freezer_item_edit_freezer">Freezer</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
compose_version = '1.1.1'
|
compose_version = '1.5.4'
|
||||||
}
|
}
|
||||||
}// 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 '8.1.3' apply false
|
||||||
id 'com.android.library' version '7.3.1' apply false
|
id 'com.android.library' version '8.1.3' apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
|
||||||
}
|
}
|
||||||
@@ -21,3 +21,6 @@ kotlin.code.style=official
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
org.gradle.unsafe.configuration-cache=true
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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-8.0-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
4
temp.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#NavigationBar(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,androidx.compose.foundation.layout.WindowInsets,kotlin.Function1)
|
||||||
|
|
||||||
|
https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#Scaffold(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.material3.FabPosition,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.foundation.layout.WindowInsets,kotlin.Function1)
|
||||||