Initial commit

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-06-02 15:21:28 +05:30
commit 29c374859b
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
27 changed files with 823 additions and 0 deletions

46
common/build.gradle.kts Normal file
View file

@ -0,0 +1,46 @@
import org.jetbrains.compose.compose
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "0.4.0"
id("com.android.library")
}
group = "dev.msfjarvis.claw"
version = "1.0"
repositories { google() }
kotlin {
android()
jvm("desktop") { compilations.all { kotlinOptions.jvmTarget = "11" } }
sourceSets {
val commonMain by getting {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
}
}
val commonTest by getting { dependencies { implementation(kotlin("test")) } }
val androidMain by getting {
dependencies {
api("androidx.appcompat:appcompat:1.3.0")
api("androidx.core:core-ktx:1.5.0")
}
}
val androidTest by getting { dependencies { implementation("junit:junit:4.13.2") } }
val desktopMain by getting
val desktopTest by getting
}
}
android {
compileSdkVersion(30)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(23)
targetSdkVersion(30)
}
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.msfjarvis.claw.common"
/>

View file

@ -0,0 +1,5 @@
package dev.msfjarvis.claw.common
actual fun getPlatformName(): String {
return "Android"
}

View file

@ -0,0 +1,17 @@
package dev.msfjarvis.claw.common
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
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
@Composable
fun App() {
var text by remember { mutableStateOf("Hello, World!") }
MaterialTheme { Button(onClick = { text = "Hello, ${getPlatformName()}" }) { Text(text) } }
}

View file

@ -0,0 +1,3 @@
package dev.msfjarvis.claw.common
expect fun getPlatformName(): String

View file

@ -0,0 +1,5 @@
package dev.msfjarvis.claw.common
actual fun getPlatformName(): String {
return "Desktop"
}