Added recipesage to the app.
This commit is contained in:
BIN
app/release/app-release.apk
Normal file
BIN
app/release/app-release.apk
Normal file
Binary file not shown.
20
app/release/output-metadata.json
Normal file
20
app/release/output-metadata.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.mitchelbv.thuis_c",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "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)
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user