feat(android): init basic maps

This commit is contained in:
LavaDesu 2025-04-13 01:27:49 +10:00
parent aebc802b88
commit 89ffc02e1d
Signed by: cilly
GPG key ID: 6500251E087653C9
8 changed files with 36 additions and 17 deletions

2
.gitignore vendored
View file

@ -16,3 +16,5 @@ captures
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
secrets.properties

View file

@ -7,4 +7,10 @@ plugins {
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinJvm) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
}
}
buildscript {
dependencies {
classpath(libs.secrets.gradle.plugin)
}
}

View file

@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.secretsGradle)
}
kotlin {
@ -33,6 +34,8 @@ kotlin {
androidMain.dependencies {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.play.services.maps)
implementation(libs.maps.compose)
}
commonMain.dependencies {
implementation(compose.runtime)
@ -79,3 +82,6 @@ dependencies {
debugImplementation(compose.uiTooling)
}
secrets {
propertiesFileName = "secrets.properties"
}

View file

@ -8,6 +8,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
<activity
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"

View file

@ -2,11 +2,12 @@ package moe.lava.banksia.native.maps
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.google.maps.android.compose.GoogleMap
@Composable
actual fun Maps(
modifier: Modifier,
markers: List<Marker>
) {
TODO("Not yet implemented")
GoogleMap()
}

View file

@ -3,9 +3,12 @@ package moe.lava.banksia
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.BottomSheetScaffold
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
@ -15,23 +18,14 @@ import org.jetbrains.compose.ui.tooling.preview.Preview
import banksia.composeapp.generated.resources.Res
import banksia.composeapp.generated.resources.compose_multiplatform
import moe.lava.banksia.native.maps.Maps
@Composable
@Preview
fun App() {
MaterialTheme {
var showContent by remember { mutableStateOf(false) }
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Button(onClick = { showContent = !showContent }) {
Text("Click me!")
}
AnimatedVisibility(showContent) {
val greeting = remember { Greeting().greet() }
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Image(painterResource(Res.drawable.compose_multiplatform), null)
Text("Compose: $greeting")
}
}
Scaffold {
Maps(modifier = Modifier.fillMaxSize())
}
}
}

View file

@ -7,6 +7,6 @@ data class Marker(val name: String)
@Composable
expect fun Maps(
modifier: Modifier,
markers: List<Marker>
modifier: Modifier = Modifier,
markers: List<Marker> = listOf()
)

View file

@ -16,6 +16,9 @@ junit = "4.13.2"
kotlin = "2.1.10"
ktor = "3.1.1"
logback = "1.5.17"
mapsCompose = "6.4.1"
playServicesMaps = "19.1.0"
secretsGradlePlugin = "2.0.1"
[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
@ -34,6 +37,9 @@ logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" }
ktor-server-tests = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
maps-compose = { module = "com.google.maps.android:maps-compose", version.ref = "mapsCompose" }
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secretsGradlePlugin" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
@ -42,4 +48,5 @@ composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-mu
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
secretsGradle = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin" }