Compare commits

...

2 Commits

Author SHA1 Message Date
2d35065226 Whoops, do not push built app 2022-11-04 11:21:42 +01:00
7d1742fbf7 Added recipesage to the app. 2022-11-04 11:21:03 +01:00
4 changed files with 68 additions and 2 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@
.externalNativeBuild
.cxx
local.properties
app/release

View File

@@ -3,12 +3,14 @@ package com.mitchelbv.thuis_c
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import com.mitchelbv.thuis_c.ui.card.CardsScreen
import com.mitchelbv.thuis_c.ui.feyenoord.FeyenoordScreen
import com.mitchelbv.thuis_c.ui.home.HomeScreen
import com.mitchelbv.thuis_c.ui.recipe.RecipeScreen
interface ThuisDestination {
val route: String
@@ -34,4 +36,10 @@ object Card : ThuisDestination {
override val screen: @Composable () -> Unit = { CardsScreen() }
}
val destinations = listOf(Home, FeyenoordMatches)
object Recipe : ThuisDestination {
override val icon = Icons.Filled.List
override val route = "recipe"
override val screen: @Composable () -> Unit = { RecipeScreen() }
}
val destinations = listOf(Home, Recipe, FeyenoordMatches)

View File

@@ -1,9 +1,23 @@
package com.mitchelbv.thuis_c.ui.home
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.tooling.preview.Preview
import com.mitchelbv.thuis_c.ui.theme.Typography
@Composable
fun HomeScreen() {
return Text(text = "Hello!")
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text("De thuis app!", style = Typography.body1)
}
}
@Preview(showBackground = true)
@Composable
fun HomeScreenPreview() {
HomeScreen()
}

View File

@@ -0,0 +1,43 @@
package com.mitchelbv.thuis_c.ui.recipe
import android.annotation.SuppressLint
import android.graphics.Bitmap
import android.util.Log
import android.view.ViewGroup
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
@SuppressLint("SetJavaScriptEnabled")
@Composable
fun RecipeScreen() {
var backEnabled by remember { mutableStateOf(true)}
var webView: WebView? = null
AndroidView(modifier = Modifier.fillMaxSize(),
factory = { context ->
WebView(context).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView, url: String?) {
super.onPageFinished(view, url)
backEnabled = view.canGoBack()
}
}
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
loadUrl("https://rs.mitchelbv.nl/")
webView = this
}
}, update = { webView = it}
)
BackHandler(enabled = backEnabled) {
webView?.goBack()
}
}