generated from JetBrains/compose-multiplatform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:Reorganize the project structure
- Loading branch information
Showing
43 changed files
with
141 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
progressIndicator/src/androidMain/kotlin/com/multiplatform/progressindicator/main.android.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../kotlin/com/myapplication/MainActivity.kt → .../kotlin/com/myapplication/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
desktopApp/src/jvmMain/kotlin/main.kt → sample/desktopApp/src/jvmMain/kotlin/main.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
iosApp/iosApp/ContentView.swift → sample/iosApp/iosApp/ContentView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
plugins { | ||
kotlin("multiplatform") | ||
id("org.jetbrains.compose") | ||
id("com.android.library") | ||
} | ||
|
||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) | ||
kotlin { | ||
targetHierarchy.default() | ||
|
||
android { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
jvm("desktop") | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "shared" | ||
isStatic = true | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(compose.runtime) | ||
implementation(compose.foundation) | ||
implementation(compose.material) | ||
implementation(project(":progressIndicator")) | ||
} | ||
} | ||
val androidMain by getting { | ||
dependencies { | ||
api("androidx.activity:activity-compose:1.7.2") | ||
api("androidx.appcompat:appcompat:1.6.1") | ||
api("androidx.core:core-ktx:1.10.1") | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
} | ||
} | ||
val desktopMain by getting { | ||
dependencies { | ||
implementation(compose.desktop.common) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.kevinnzou.sample.shared" | ||
compileSdk = 33 | ||
defaultConfig { | ||
minSdk = 24 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
sample/shared/src/androidMain/kotlin/com/kevinnzou/sample/shared/Platform.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.kevinnzou.sample.shared | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
class AndroidPlatform : Platform { | ||
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() | ||
|
||
@Composable | ||
fun MainView() = App() |
9 changes: 5 additions & 4 deletions
9
...om/multiplatform/progressindicator/App.kt → ...kotlin/com/kevinnzou/sample/shared/App.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
package com.multiplatform.progressindicator | ||
package com.kevinnzou.sample.shared | ||
|
||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import sample.BasicProgressIndicatorSample | ||
|
||
/** | ||
* Created By Kevin Zou On 2023/10/9 | ||
*/ | ||
@Composable | ||
fun App() { | ||
MaterialTheme { | ||
BasicProgressIndicatorSample() | ||
} | ||
} | ||
|
||
expect fun getPlatformName(): String | ||
} |
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
sample/shared/src/commonMain/kotlin/com/kevinnzou/sample/shared/Greeting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.kevinnzou.sample.shared | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
sample/shared/src/commonMain/kotlin/com/kevinnzou/sample/shared/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.kevinnzou.sample.shared | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
9 changes: 7 additions & 2 deletions
9
...latform/progressindicator/main.desktop.kt → ...om/kevinnzou/sample/shared/getPlatform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
sample/shared/src/iosMain/kotlin/com/kevinnzou/sample/shared/Platform.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.kevinnzou.sample.shared | ||
|
||
import androidx.compose.ui.window.ComposeUIViewController | ||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() | ||
|
7 changes: 4 additions & 3 deletions
7
...ltiplatform/progressindicator/main.ios.kt → ...n/com/kevinnzou/sample/shared/main.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package com.multiplatform.progressindicator | ||
package com.kevinnzou.sample.shared | ||
|
||
import androidx.compose.ui.window.ComposeUIViewController | ||
|
||
actual fun getPlatformName(): String = "iOS" | ||
|
||
/** | ||
* Created By Kevin Zou On 2023/10/9 | ||
*/ | ||
fun MainViewController() = ComposeUIViewController { App() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters