Restructure project

* use modules instead of source sets
* Kotlin JVM instead of multiplatform (for now) to make things simpler
* Warning: GameCell doesn't use mutableState anymore, this needs to be
           fixed for the UI to work!
This commit is contained in:
2024-07-02 10:53:04 +02:00
parent 767dc018c6
commit 1f588e6596
65 changed files with 248 additions and 484 deletions

51
android/build.gradle.kts Normal file
View File

@@ -0,0 +1,51 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinCompose)
alias(libs.plugins.jetbrainsCompose)
}
android {
namespace = "ch.dissem.yaep"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
applicationId = "ch.dissem.yaep"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
dependencies {
implementation(compose.components.resources)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(libs.androidx.activity.compose)
// implementation(libs.compose.ui.text.googlefonts)
implementation(projects.commonUI)
implementation(compose.components.uiToolingPreview)
testImplementation(libs.kotlin.test)
testImplementation(libs.atrium)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
packaging {
resources {
merges += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

View File

@@ -5,13 +5,12 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar"> android:theme="@android:style/Theme.Material.Light.NoActionBar">
<activity <activity
android:exported="true" android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode" android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:name=".MainActivity"> android:name="ch.dissem.android.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -1,11 +1,11 @@
package ch.dissem.yaep package ch.dissem.android
import App
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview import ch.dissem.yaep.ui.common.App
import org.jetbrains.compose.ui.tooling.preview.Preview
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View File

@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFBCF">
<group android:scaleX="0.5568"
android:scaleY="0.5568"
android:translateX="5.3184"
android:translateY="5.3184">
<path
android:fillColor="@android:color/white"
android:pathData="M9,21c0,0.5 0.4,1 1,1h4c0.6,0 1,-0.5 1,-1v-1L9,20v1zM12,2C8.1,2 5,5.1 5,9c0,2.4 1.2,4.5 3,5.7L8,17c0,0.5 0.4,1 1,1h6c0.6,0 1,-0.5 1,-1v-2.3c1.8,-1.3 3,-3.4 3,-5.7 0,-3.9 -3.1,-7 -7,-7z"/>
</group>
</vector>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#165295</color>
</resources>

View File

@@ -1,9 +1,18 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins { plugins {
// this is necessary to avoid the plugins to be loaded multiple times // this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader // in each subproject's classloader
alias(libs.plugins.androidApplication) apply false alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.jetbrainsKotlinJvm) apply false alias(libs.plugins.kotlin.jvm) apply false
}
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
} }

28
commonUI/build.gradle.kts Normal file
View File

@@ -0,0 +1,28 @@
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.jetbrainsKotlinCompose)
alias(libs.plugins.jetbrainsCompose)
}
kotlin {
jvmToolchain(11)
dependencies {
implementation(compose.components.resources)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
// implementation(libs.compose.ui.text.googlefonts)
implementation(projects.domain)
testImplementation(libs.kotlin.test)
testImplementation(libs.atrium)
}
}
compose.resources {
publicResClass = true
}

View File

@@ -1,3 +1,5 @@
package ch.dissem.yaep.ui.common
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -17,21 +19,19 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import domain.Clue import ch.dissem.yaep.domain.Clue
import domain.Grid import ch.dissem.yaep.domain.Grid
import domain.HorizontalClue import ch.dissem.yaep.domain.HorizontalClue
import domain.ItemClass import ch.dissem.yaep.domain.ItemClass
import domain.NeighbourClue import ch.dissem.yaep.domain.NeighbourClue
import domain.OrderClue import ch.dissem.yaep.domain.OrderClue
import domain.SameColumnClue import ch.dissem.yaep.domain.SameColumnClue
import domain.TripletClue import ch.dissem.yaep.domain.TripletClue
import domain.generateGame import ch.dissem.yaep.domain.generateGame
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
import ui.DrawItem import yaep.commonui.generated.resources.Res
import ui.Selector import yaep.commonui.generated.resources.neighbour
import yaep.composeapp.generated.resources.Res import yaep.commonui.generated.resources.order
import yaep.composeapp.generated.resources.neighbour
import yaep.composeapp.generated.resources.order
class DisplayClue<C : Clue>(val clue: C) { class DisplayClue<C : Clue>(val clue: C) {
var isActive by mutableStateOf(true) var isActive by mutableStateOf(true)

View File

@@ -1,4 +1,4 @@
package ui package ch.dissem.yaep.ui.common
import androidx.compose.foundation.Canvas import androidx.compose.foundation.Canvas
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@@ -9,21 +9,15 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.material3.OutlinedCard import androidx.compose.material3.OutlinedCard
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.drawText import androidx.compose.ui.text.drawText
import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.text.rememberTextMeasurer
import domain.Animals import ch.dissem.yaep.domain.Item
import domain.Item import ch.dissem.yaep.domain.ItemClass
import domain.ItemClass import ch.dissem.yaep.domain.ItemClassCompanion
import domain.ItemClassCompanion import ch.dissem.yaep.ui.common.theme.emojiFontFamily
import org.jetbrains.compose.ui.tooling.preview.Preview
import ui.theme.emojiFontFamily
import kotlin.math.min import kotlin.math.min
@Composable @Composable

View File

@@ -1,4 +1,4 @@
package ui.theme package ch.dissem.yaep.ui.common.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val primaryLight = Color(0xFF6D5E0F) val primaryLight = Color(0xFF6D5E0F)

View File

@@ -1,4 +1,4 @@
package ui.theme package ch.dissem.yaep.ui.common.theme
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme import androidx.compose.material3.darkColorScheme

View File

@@ -1,4 +1,4 @@
package ui.theme package ch.dissem.yaep.ui.common.theme
//import androidx.compose.material3.Typography //import androidx.compose.material3.Typography
//import androidx.compose.ui.text.TextStyle //import androidx.compose.ui.text.TextStyle

View File

@@ -0,0 +1,5 @@
package ch.dissem.yaep.ui.common.theme
import androidx.compose.ui.text.font.FontFamily
var emojiFontFamily: FontFamily? = null

View File

@@ -1,113 +0,0 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.jetbrainsKotlinCompose)
}
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
kotlin {
androidTarget()
jvm("desktop")
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
sourceSets {
val androidUnitTest by getting
val desktopMain by getting
val desktopTest by getting
androidMain.dependencies {
implementation(libs.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.compose.ui.text.googlefonts)
}
desktopMain.dependencies {
implementation(compose.desktop.currentOs)
}
androidUnitTest.dependencies {
implementation(libs.kotlin.test)
implementation(compose.uiTest)
implementation(libs.atrium)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
implementation(libs.atrium)
}
desktopTest.dependencies {
implementation(libs.kotlin.test)
implementation(libs.atrium)
implementation(compose.desktop.uiTestJUnit4)
implementation(compose.desktop.currentOs)
}
}
}
android {
namespace = "ch.dissem.yaep"
compileSdk = libs.versions.android.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
defaultConfig {
applicationId = "ch.dissem.yaep"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
debugImplementation(libs.compose.ui.tooling)
}
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ch.dissem.yaep"
packageVersion = "1.0.0"
buildTypes.release.proguard {
configurationFiles.from(project.file("proguard-rules.pro"))
isEnabled.set(true)
obfuscate.set(true)
}
}
}
}

View File

@@ -1,7 +0,0 @@
import android.os.Build
class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()

View File

@@ -1,5 +0,0 @@
package ui.theme
import androidx.compose.ui.text.font.FontFamily
actual val emojiFontFamily: FontFamily? = null

View File

@@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDB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jQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>

View File

@@ -1,7 +0,0 @@
class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}

View File

@@ -1,5 +0,0 @@
interface Platform {
val name: String
}
expect fun getPlatform(): Platform

View File

@@ -1,5 +0,0 @@
package ui.theme
import androidx.compose.ui.text.font.FontFamily
expect val emojiFontFamily: FontFamily?

View File

@@ -1,5 +0,0 @@
class JVMPlatform: Platform {
override val name: String = "Java ${System.getProperty("java.version")}"
}
actual fun getPlatform(): Platform = JVMPlatform()

View File

@@ -1,14 +0,0 @@
package ui.theme
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.platform.Font
actual val emojiFontFamily: FontFamily? = FontFamily(
Font(
resource = "NotoColorEmoji-Regular.ttf",
weight = FontWeight.W400,
style = FontStyle.Normal
)
)

42
desktop/build.gradle.kts Normal file
View File

@@ -0,0 +1,42 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.jetbrainsKotlinCompose)
alias(libs.plugins.jetbrainsCompose)
}
kotlin {
jvmToolchain(11)
dependencies {
implementation(compose.desktop.currentOs)
implementation(compose.material3)
implementation(compose.components.resources)
implementation(projects.commonUI)
implementation(compose.components.uiToolingPreview)
testImplementation(libs.kotlin.test)
testImplementation(libs.atrium)
testImplementation(compose.desktop.uiTestJUnit4)
testImplementation(compose.desktop.currentOs)
}
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ch.dissem.yaep"
packageVersion = "1.0.0"
buildTypes.release.proguard {
configurationFiles.from(project.file("proguard-rules.pro"))
isEnabled.set(true)
obfuscate.set(true)
}
}
}
}

View File

@@ -17,14 +17,14 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowPlacement
import androidx.compose.ui.window.WindowScope import androidx.compose.ui.window.WindowScope
import androidx.compose.ui.window.WindowState import androidx.compose.ui.window.WindowState
import ch.dissem.yaep.ui.common.theme.AppTheme
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
import ui.theme.AppTheme import yaep.commonui.generated.resources.Res
import yaep.composeapp.generated.resources.Res import yaep.commonui.generated.resources.moon
import yaep.composeapp.generated.resources.moon import yaep.commonui.generated.resources.sun
import yaep.composeapp.generated.resources.sun import yaep.commonui.generated.resources.window_close
import yaep.composeapp.generated.resources.window_close import yaep.commonui.generated.resources.window_maximize
import yaep.composeapp.generated.resources.window_maximize import yaep.commonui.generated.resources.window_minimize
import yaep.composeapp.generated.resources.window_minimize
@Composable @Composable
fun WindowScope.DesktopWindow( fun WindowScope.DesktopWindow(

View File

@@ -4,15 +4,29 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.platform.Font
import androidx.compose.ui.window.Window import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowPlacement
import androidx.compose.ui.window.application import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState import androidx.compose.ui.window.rememberWindowState
import ch.dissem.yaep.ui.common.App
import ch.dissem.yaep.ui.common.theme.emojiFontFamily
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
import yaep.composeapp.generated.resources.Res import yaep.commonui.generated.resources.Res
import yaep.composeapp.generated.resources.moon import yaep.commonui.generated.resources.moon
fun main() = application { fun main() = application {
emojiFontFamily = FontFamily(
Font(
resource = "NotoColorEmoji-Regular.ttf",
weight = FontWeight.W400,
style = FontStyle.Normal
)
)
Window( Window(
onCloseRequest = ::exitApplication, onCloseRequest = ::exitApplication,
undecorated = true, undecorated = true,

12
domain/build.gradle.kts Normal file
View File

@@ -0,0 +1,12 @@
plugins {
alias(libs.plugins.kotlin.jvm)
}
kotlin {
jvmToolchain(11)
dependencies {
testImplementation(libs.kotlin.test)
testImplementation(libs.atrium)
}
}

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
class Game( class Game(
val grid: Grid, val grid: Grid,

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
sealed class Clue { sealed class Clue {
abstract fun isRuleViolated(grid: Grid): Boolean abstract fun isRuleViolated(grid: Grid): Boolean

View File

@@ -1,8 +1,8 @@
package domain package ch.dissem.yaep.domain
import domain.PuzzleSolution.MULTIPLE_SOLUTIONS import ch.dissem.yaep.domain.PuzzleSolution.MULTIPLE_SOLUTIONS
import domain.PuzzleSolution.NO_SOLUTION import ch.dissem.yaep.domain.PuzzleSolution.NO_SOLUTION
import domain.PuzzleSolution.SOLVABLE import ch.dissem.yaep.domain.PuzzleSolution.SOLVABLE
import kotlin.random.Random import kotlin.random.Random
fun generateGame(size: Int = 6): Game { fun generateGame(size: Int = 6): Game {

View File

@@ -1,9 +1,4 @@
package domain package ch.dissem.yaep.domain
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList
class GameRow<C : ItemClass<C>>( class GameRow<C : ItemClass<C>>(
val category: ItemClassCompanion<C>, val category: ItemClassCompanion<C>,
@@ -59,14 +54,14 @@ fun List<List<Item<ItemClass<*>>>>.toGrid() = Grid(
) )
class GameCell<C : ItemClass<C>>( class GameCell<C : ItemClass<C>>(
selection: Item<C>?, var selection: Item<C>?,
val solution: Item<C>, val solution: Item<C>,
options: List<Item<C>> val options: MutableList<Item<C>>
) { )
val options = options.toMutableStateList() //{
var selection by mutableStateOf(selection) // val options = options.toMutableStateList()
// var selection by mutableStateOf(selection)
} //}
fun <C : ItemClass<C>> GameCell<C>?.mayBe(item: Item<C>) = fun <C : ItemClass<C>> GameCell<C>?.mayBe(item: Item<C>) =
this != null && (selection == item || (selection == null && options.contains(item))) this != null && (selection == item || (selection == null && options.contains(item)))

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
enum class Animals(symbol: String) : ItemClass<Animals> { enum class Animals(symbol: String) : ItemClass<Animals> {
ZEBRA("🦓"), ZEBRA("🦓"),

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
abstract class ClueTest { abstract class ClueTest {
protected val size = 6 protected val size = 6

View File

@@ -1,14 +1,8 @@
package domain package ch.dissem.yaep.domain
import androidx.compose.runtime.TestOnly
import ch.tutteli.atrium.api.fluent.en_GB.extractSubject
import ch.tutteli.atrium.api.fluent.en_GB.feature import ch.tutteli.atrium.api.fluent.en_GB.feature
import ch.tutteli.atrium.api.fluent.en_GB.size
import ch.tutteli.atrium.api.fluent.en_GB.toBeLessThan import ch.tutteli.atrium.api.fluent.en_GB.toBeLessThan
import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.fluent.en_GB.toHaveElementsAndAll
import ch.tutteli.atrium.api.fluent.en_GB.toHaveElementsAndNone
import ch.tutteli.atrium.api.fluent.en_GB.toHaveSize
import ch.tutteli.atrium.api.verbs.expect import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test import kotlin.test.Test

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect import ch.tutteli.atrium.api.verbs.expect

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect import ch.tutteli.atrium.api.verbs.expect

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect import ch.tutteli.atrium.api.verbs.expect

View File

@@ -1,4 +1,4 @@
package domain package ch.dissem.yaep.domain
import ch.tutteli.atrium.api.fluent.en_GB.toEqual import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect import ch.tutteli.atrium.api.verbs.expect

View File

@@ -1,5 +1,5 @@
[versions] [versions]
agp = "8.3.2" agp = "8.5.0"
android-compileSdk = "34" android-compileSdk = "34"
android-minSdk = "24" android-minSdk = "24"
android-targetSdk = "34" android-targetSdk = "34"
@@ -10,9 +10,6 @@ kotlin = "2.0.0"
[libraries] [libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-ui-text-googlefonts = { module = "androidx.compose.ui:ui-text-google-fonts", version.ref = "compose" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
atrium = { module = "ch.tutteli.atrium:atrium-fluent", version = "1.2.0" } atrium = { module = "ch.tutteli.atrium:atrium-fluent", version = "1.2.0" }
@@ -21,5 +18,5 @@ androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" } androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsKotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } jetbrainsKotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
jetbrainsKotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

View File

@@ -30,4 +30,7 @@ dependencyResolutionManagement {
} }
} }
include(":composeApp") include(":domain")
include(":commonUI")
include(":desktop")
include(":android")