Stub out the welcome screen

This commit is contained in:
Z. Charles Dziura 2025-05-27 12:08:45 -04:00
parent 224d9efd64
commit b6627ee4db
10 changed files with 185 additions and 52 deletions

View file

@ -2,16 +2,17 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.jetbrains.kotlin.serialization)
}
android {
namespace = "ing.bikeshedengineer.aisle17"
compileSdk = 35
compileSdk = 36
defaultConfig {
applicationId = "ing.bikeshedengineer.aisle17"
minSdk = 34
targetSdk = 35
targetSdk = 36
versionCode = 1
versionName = "1.0"
@ -40,7 +41,12 @@ android {
}
dependencies {
implementation(libs.androidx.navigation3.runtime)
implementation(libs.androidx.navigation3.ui)
implementation(libs.androidx.lifecycle.viewmodel.navigation3)
implementation(libs.androidx.material3.navigation3)
implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.json)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)

View file

@ -15,7 +15,7 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/title_activity_main"
android:colorMode="wideColorGamut"
android:theme="@style/Theme.Aisle17">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View file

@ -9,8 +9,12 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import ing.bikeshedengineer.aisle17.theme.Aisle17Theme
class MainActivity : ComponentActivity() {
@ -18,30 +22,15 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
val backStack = rememberNavBackStack(Destination.Welcome)
Aisle17Theme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding)
)
}
NavDisplay(
backStack = backStack,
onBack = { backStack.removeLastOrNull() },
entryProvider = ::entryProvider
)
}
}
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
Aisle17Theme {
Greeting("Android")
}
}

View file

@ -0,0 +1,20 @@
package ing.bikeshedengineer.aisle17
import androidx.navigation3.runtime.NavEntry
import androidx.navigation3.runtime.NavKey
import ing.bikeshedengineer.aisle17.welcome.WelcomeScreen
import kotlinx.serialization.Serializable
@Serializable
sealed class Destination : NavKey {
@Serializable
data object Welcome : Destination()
}
fun entryProvider(destination: NavKey): NavEntry<NavKey> {
return when (destination as Destination) {
is Destination.Welcome -> NavEntry(destination) {
WelcomeScreen()
}
}
}

View file

@ -1,6 +1,49 @@
package ing.bikeshedengineer.aisle17.theme
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.colorspace.ColorSpaces
val RoyalBlue = Color(
red = 0.17f,
green = 0.38f,
blue = 0.74f,
colorSpace = ColorSpaces.DisplayP3
)
val CornFlowerBlue = Color(
red = 0.45f,
green = 0.54f,
blue = 0.82f,
colorSpace = ColorSpaces.DisplayP3
)
val Chocolate = Color(
red = 0.72f,
green = 0.43f,
blue = 0.16f,
colorSpace = ColorSpaces.DisplayP3
)
val MidnightBlue = Color(
red = 0.1f,
green = 0.14f,
blue = 0.24f,
colorSpace = ColorSpaces.DisplayP3
)
val DarkSlateBlue = Color(
red = 0.27f,
green = 0.33f,
blue = 0.52f,
colorSpace = ColorSpaces.DisplayP3
)
val SaddleBrown = Color(
red = 0.5f,
green = 0.36f,
blue = 0.16f,
colorSpace = ColorSpaces.DisplayP3
)
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)

View file

@ -9,16 +9,10 @@ import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
primary = RoyalBlue,
secondary = CornFlowerBlue,
tertiary = Chocolate
/* Other default colors to override
background = Color(0xFFFFFBFE),
@ -31,6 +25,12 @@ private val LightColorScheme = lightColorScheme(
*/
)
private val DarkColorScheme = darkColorScheme(
primary = MidnightBlue,
secondary = DarkSlateBlue,
tertiary = SaddleBrown
)
@Composable
fun Aisle17Theme(
darkTheme: Boolean = isSystemInDarkTheme(),

View file

@ -0,0 +1,50 @@
package ing.bikeshedengineer.aisle17.welcome
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import ing.bikeshedengineer.aisle17.R
import ing.bikeshedengineer.aisle17.theme.Aisle17Theme
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WelcomeScreen() {
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.testing), maxLines = 1, overflow = TextOverflow.Ellipsis) },
colors = TopAppBarDefaults.topAppBarColors().copy(
containerColor = MaterialTheme.colorScheme.primary
)
)
},
modifier = Modifier.fillMaxSize()
) { innerPadding ->
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.padding(innerPadding)
) {
Text("Hello, world!")
}
}
}
@Preview(showBackground = true)
@Composable
fun WelcomeScreenPreview() {
Aisle17Theme {
WelcomeScreen()
}
}

View file

@ -1,4 +1,6 @@
<resources>
<string name="app_name">Aisle17</string>
<string name="title_activity_main">MainActivity</string>
<!-- Welcome Screen -->
<string name="testing">Testing</string>
</resources>

View file

@ -1,36 +1,50 @@
[versions]
activityCompose = "1.10.1"
agp = "8.10.0"
kotlin = "2.0.21"
appcompat = "1.7.0"
composeBom = "2025.05.01"
coreKtx = "1.16.0"
espressoCore = "3.6.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
kotlin = "2.0.21"
kotlinSerialization = "2.1.21"
kotlinxSerializationCore = "1.8.1"
lifecycleRuntimeKtx = "2.9.0"
material = "1.12.0"
lifecycleRuntimeKtx = "2.6.1"
activityCompose = "1.8.0"
composeBom = "2024.09.00"
material3 = "1.4.0-alpha15"
nav3Core = "1.0.0-alpha02"
nav3Lifecycle = "1.0.0-alpha01"
nav3Material = "1.0.0-SNAPSHOT"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel-navigation3 = { module = "androidx.lifecycle:lifecycle-viewmodel-navigation3", version.ref = "nav3Lifecycle" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
androidx-material3-navigation3 = { group = "androidx.compose.material3.adaptive", name = "adaptive-navigation3", version.ref = "nav3Material" }
androidx-navigation3-runtime = { module = "androidx.navigation3:navigation3-runtime", version.ref = "nav3Core" }
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "nav3Core" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinxSerializationCore" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationCore" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
jetbrains-kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinSerialization"}
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

View file

@ -1,3 +1,5 @@
@file:Suppress("UnstableApiUsage")
pluginManagement {
repositories {
google {
@ -9,13 +11,20 @@ pluginManagement {
}
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://androidx.dev/snapshots/builds/13555495/artifacts/repository")
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://androidx.dev/snapshots/builds/13555495/artifacts/repository")
}
}
}