- Room DB (ArtLegendDatabase, SessionDao, SessionEntity) wired up - SessionRepository saves scores and queries last 7 sessions per module - ProgressViewModel exposes sessions as StateFlow - ProgressScreen replaced with real bar chart + session history list - MainActivity now persists each game result to Room on return - build.gradle.kts + gradle.properties: KSP and Room 2.6.1 added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
110 lines
3.3 KiB
Kotlin
110 lines
3.3 KiB
Kotlin
plugins {
|
|
kotlin("android")
|
|
id("com.android.application")
|
|
id("com.google.devtools.ksp")
|
|
}
|
|
|
|
val gdxVersion: String by project
|
|
val composeBom: String by project
|
|
val composeCompilerExtension: String by project
|
|
val roomVersion: String by project
|
|
val natives: Configuration by configurations.creating
|
|
|
|
android {
|
|
namespace = "com.artlegend"
|
|
compileSdk = 34
|
|
|
|
defaultConfig {
|
|
applicationId = "com.artlegend"
|
|
minSdk = 26
|
|
targetSdk = 34
|
|
versionCode = 1
|
|
versionName = "0.1.0"
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
}
|
|
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion = composeCompilerExtension
|
|
}
|
|
|
|
sourceSets {
|
|
getByName("main") {
|
|
assets.srcDirs(rootProject.file("assets"))
|
|
jniLibs.srcDirs("libs")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":core"))
|
|
implementation(project(":shared"))
|
|
|
|
// LibGDX
|
|
implementation("com.badlogicgames.gdx:gdx-backend-android:$gdxVersion")
|
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a")
|
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a")
|
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86")
|
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64")
|
|
|
|
// Compose BOM
|
|
val composeBomDep = platform("androidx.compose:compose-bom:$composeBom")
|
|
implementation(composeBomDep)
|
|
implementation("androidx.compose.ui:ui")
|
|
implementation("androidx.compose.ui:ui-tooling-preview")
|
|
implementation("androidx.compose.material3:material3")
|
|
implementation("androidx.compose.material:material-icons-core")
|
|
|
|
// Activity + Navigation + Lifecycle
|
|
implementation("androidx.activity:activity-compose:1.9.2")
|
|
implementation("androidx.navigation:navigation-compose:2.8.0")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4")
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4")
|
|
|
|
// Material XML themes (for Activity window styling)
|
|
implementation("com.google.android.material:material:1.12.0")
|
|
|
|
// Room
|
|
implementation("androidx.room:room-runtime:$roomVersion")
|
|
implementation("androidx.room:room-ktx:$roomVersion")
|
|
ksp("androidx.room:room-compiler:$roomVersion")
|
|
}
|
|
|
|
tasks.register("copyAndroidNatives") {
|
|
doFirst {
|
|
val validAbis = setOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
|
|
natives.files.forEach { jar ->
|
|
// Extract ABI from classifier, e.g. "gdx-platform-1.12.1-natives-arm64-v8a.jar" → "arm64-v8a"
|
|
val abi = jar.name.substringAfter("natives-").removeSuffix(".jar")
|
|
if (abi in validAbis) {
|
|
val outputDir = file("libs/$abi")
|
|
outputDir.mkdirs()
|
|
copy {
|
|
from(zipTree(jar))
|
|
into(outputDir)
|
|
include("*.so")
|
|
eachFile { path = name }
|
|
includeEmptyDirs = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.whenTaskAdded {
|
|
if (name.contains("package") || name.contains("assemble") || name.contains("bundle")) {
|
|
dependsOn("copyAndroidNatives")
|
|
}
|
|
}
|