Skip to content

Commit 1011e06

Browse files
committed
Initial commit
0 parents  commit 1011e06

98 files changed

Lines changed: 8088 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.iml
2+
.kotlin
3+
.gradle
4+
**/build/
5+
xcuserdata
6+
!src/**/build/
7+
local.properties
8+
.idea
9+
.DS_Store
10+
captures
11+
.externalNativeBuild
12+
.cxx
13+
*.xcodeproj/*
14+
!*.xcodeproj/project.pbxproj
15+
!*.xcodeproj/xcshareddata/
16+
!*.xcodeproj/project.xcworkspace/
17+
!*.xcworkspace/contents.xcworkspacedata
18+
**/xcshareddata/WorkspaceSettings.xcsettings
19+
node_modules/

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
This is a Kotlin Multiplatform project targeting Android, iOS, Web, Desktop (JVM).
2+
3+
* [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications.
4+
It contains several subfolders:
5+
- [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets.
6+
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
7+
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
8+
the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls.
9+
Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin)
10+
folder is the appropriate location.
11+
12+
* [/iosApp](./iosApp/iosApp) contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
13+
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
14+
15+
### Build and Run Android Application
16+
17+
To build and run the development version of the Android app, use the run configuration from the run widget
18+
in your IDE’s toolbar or build it directly from the terminal:
19+
- on macOS/Linux
20+
```shell
21+
./gradlew :composeApp:assembleDebug
22+
```
23+
- on Windows
24+
```shell
25+
.\gradlew.bat :composeApp:assembleDebug
26+
```
27+
28+
### Build and Run Desktop (JVM) Application
29+
30+
To build and run the development version of the desktop app, use the run configuration from the run widget
31+
in your IDE’s toolbar or run it directly from the terminal:
32+
- on macOS/Linux
33+
```shell
34+
./gradlew :composeApp:run
35+
```
36+
- on Windows
37+
```shell
38+
.\gradlew.bat :composeApp:run
39+
```
40+
41+
### Build and Run Web Application
42+
43+
To build and run the development version of the web app, use the run configuration from the run widget
44+
in your IDE's toolbar or run it directly from the terminal:
45+
- for the Wasm target (faster, modern browsers):
46+
- on macOS/Linux
47+
```shell
48+
./gradlew :composeApp:wasmJsBrowserDevelopmentRun
49+
```
50+
- on Windows
51+
```shell
52+
.\gradlew.bat :composeApp:wasmJsBrowserDevelopmentRun
53+
```
54+
- for the JS target (slower, supports older browsers):
55+
- on macOS/Linux
56+
```shell
57+
./gradlew :composeApp:jsBrowserDevelopmentRun
58+
```
59+
- on Windows
60+
```shell
61+
.\gradlew.bat :composeApp:jsBrowserDevelopmentRun
62+
```
63+
64+
### Build and Run iOS Application
65+
66+
To build and run the development version of the iOS app, use the run configuration from the run widget
67+
in your IDE’s toolbar or open the [/iosApp](./iosApp) directory in Xcode and run it from there.
68+
69+
---
70+
71+
Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html),
72+
[Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform/#compose-multiplatform),
73+
[Kotlin/Wasm](https://kotl.in/wasm/)…
74+
75+
We would appreciate your feedback on Compose/Web and Kotlin/Wasm in the public Slack channel [#compose-web](https://slack-chats.kotlinlang.org/c/compose-web).
76+
If you face any issues, please report them on [YouTrack](https://youtrack.jetbrains.com/newIssue?project=CMP).

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plugins {
2+
// this is necessary to avoid the plugins to be loaded multiple times
3+
// in each subproject's classloader
4+
alias(libs.plugins.androidApplication) apply false
5+
alias(libs.plugins.androidLibrary) apply false
6+
alias(libs.plugins.composeHotReload) apply false
7+
alias(libs.plugins.composeMultiplatform) apply false
8+
alias(libs.plugins.composeCompiler) apply false
9+
alias(libs.plugins.kotlinMultiplatform) apply false
10+
alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false
11+
alias(libs.plugins.androidLint) apply false
12+
}

composeApp/build.gradle.kts

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
2+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
3+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
5+
plugins {
6+
alias(libs.plugins.kotlinMultiplatform)
7+
alias(libs.plugins.androidApplication)
8+
alias(libs.plugins.composeMultiplatform)
9+
alias(libs.plugins.composeCompiler)
10+
alias(libs.plugins.composeHotReload)
11+
alias(libs.plugins.kotlinSerialization)
12+
}
13+
14+
kotlin {
15+
androidTarget {
16+
compilerOptions {
17+
jvmTarget.set(JvmTarget.JVM_11)
18+
}
19+
20+
21+
22+
}
23+
24+
listOf(
25+
iosArm64(),
26+
iosSimulatorArm64()
27+
).forEach { iosTarget ->
28+
iosTarget.binaries.framework {
29+
baseName = "ComposeApp"
30+
isStatic = true
31+
}
32+
}
33+
34+
jvm()
35+
36+
js {
37+
browser()
38+
binaries.executable()
39+
}
40+
41+
@OptIn(ExperimentalWasmDsl::class)
42+
wasmJs {
43+
browser()
44+
binaries.executable()
45+
}
46+
47+
sourceSets {
48+
androidMain.dependencies {
49+
implementation(libs.compose.uiToolingPreview)
50+
implementation(libs.androidx.activity.compose)
51+
}
52+
commonMain.dependencies {
53+
implementation(libs.compose.runtime)
54+
implementation(libs.compose.foundation)
55+
implementation(libs.compose.material3)
56+
implementation(libs.compose.ui)
57+
implementation(libs.compose.components.resources)
58+
implementation(libs.compose.uiToolingPreview)
59+
implementation(libs.androidx.lifecycle.viewmodelCompose)
60+
implementation(libs.androidx.lifecycle.runtimeCompose)
61+
62+
63+
implementation(project(":filemapper"))
64+
}
65+
commonTest.dependencies {
66+
implementation(libs.kotlin.test)
67+
}
68+
jvmMain.dependencies {
69+
implementation(compose.desktop.currentOs)
70+
implementation(libs.kotlinx.coroutinesSwing)
71+
}
72+
}
73+
}
74+
75+
android {
76+
namespace = "com.mamon.filemapper"
77+
compileSdk = libs.versions.android.compileSdk.get().toInt()
78+
79+
80+
81+
82+
defaultConfig {
83+
applicationId = "com.mamon.filemapper"
84+
minSdk = libs.versions.android.minSdk.get().toInt()
85+
targetSdk = libs.versions.android.targetSdk.get().toInt()
86+
versionCode = 1
87+
versionName = "1.0"
88+
89+
90+
androidResources {
91+
localeFilters += listOf("en", "ar")
92+
}
93+
94+
95+
}
96+
packaging {
97+
resources {
98+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
99+
}
100+
}
101+
buildTypes {
102+
getByName("release") {
103+
isMinifyEnabled = false
104+
}
105+
}
106+
compileOptions {
107+
sourceCompatibility = JavaVersion.VERSION_11
108+
targetCompatibility = JavaVersion.VERSION_11
109+
}
110+
}
111+
112+
dependencies {
113+
debugImplementation(libs.compose.uiTooling)
114+
}
115+
116+
compose.desktop {
117+
application {
118+
mainClass = "com.mamon.filemapper.MainKt"
119+
120+
nativeDistributions {
121+
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
122+
packageName = "com.mamon.filemapper"
123+
packageVersion = "1.0.0"
124+
}
125+
}
126+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:roundIcon="@mipmap/ic_launcher_round"
9+
android:supportsRtl="true"
10+
android:theme="@android:style/Theme.Material.Light.NoActionBar">
11+
<activity
12+
android:exported="true"
13+
android:name="io.mamon.filemapper.MainActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.mamon.filemapper
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.activity.enableEdgeToEdge
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.tooling.preview.Preview
9+
10+
class MainActivity : ComponentActivity() {
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
enableEdgeToEdge()
13+
super.onCreate(savedInstanceState)
14+
15+
setContent {
16+
App()
17+
}
18+
}
19+
}
20+
21+
@Preview
22+
@Composable
23+
fun AppAndroidPreview() {
24+
App()
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.mamon.filemapper
2+
3+
import android.os.Build
4+
5+
class AndroidPlatform : Platform {
6+
override val name: String = "Android ${Build.VERSION.SDK_INT}"
7+
}
8+
9+
actual fun getPlatform(): Platform = AndroidPlatform()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<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">
8+
<aapt:attr name="android:fillColor">
9+
<gradient
10+
android:endX="85.84757"
11+
android:endY="92.4963"
12+
android:startX="42.9492"
13+
android:startY="49.59793"
14+
android:type="linear">
15+
<item
16+
android:color="#44000000"
17+
android:offset="0.0" />
18+
<item
19+
android:color="#00000000"
20+
android:offset="1.0" />
21+
</gradient>
22+
</aapt:attr>
23+
</path>
24+
<path
25+
android:fillColor="#FFFFFF"
26+
android:fillType="nonZero"
27+
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"
28+
android:strokeWidth="1"
29+
android:strokeColor="#00000000" />
30+
</vector>

0 commit comments

Comments
 (0)