-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9796a8f
Showing
30 changed files
with
1,215 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
.idea | ||
.DS_Store | ||
build | ||
captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
xcuserdata |
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,49 @@ | ||
plugins { | ||
alias(libs.plugins.androidApplication) | ||
alias(libs.plugins.kotlinAndroid) | ||
} | ||
|
||
android { | ||
namespace = "org.noise_planet.noisecapture.android" | ||
compileSdk = 34 | ||
defaultConfig { | ||
applicationId = "org.noise_planet.noisecapture.android" | ||
minSdk = 23 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() | ||
} | ||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
buildToolsVersion = "34.0.0" | ||
} | ||
|
||
dependencies { | ||
implementation(projects.noiseCaptureCommon) | ||
implementation(libs.compose.ui) | ||
implementation(libs.compose.ui.tooling.preview) | ||
implementation(libs.compose.material3) | ||
implementation(libs.androidx.activity.compose) | ||
debugImplementation(libs.compose.ui.tooling) | ||
} |
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application | ||
android:allowBackup="false" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
40 changes: 40 additions & 0 deletions
40
NoiseCaptureAndroid/src/main/java/org/noise_planet/noisecapture/android/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.noise_planet.noisecapture.android | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import org.noise_planet.noisecapture.Greeting | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
MyApplicationTheme { | ||
Surface( | ||
modifier = Modifier.fillMaxSize(), | ||
color = MaterialTheme.colorScheme.background | ||
) { | ||
GreetingView(Greeting().greet()) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun GreetingView(text: String) { | ||
Text(text = text) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun DefaultPreview() { | ||
MyApplicationTheme { | ||
GreetingView("Hello, Android!") | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...eCaptureAndroid/src/main/java/org/noise_planet/noisecapture/android/MyApplicationTheme.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,55 @@ | ||
package org.noise_planet.noisecapture.android | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Shapes | ||
import androidx.compose.material3.Typography | ||
import androidx.compose.material3.darkColorScheme | ||
import androidx.compose.material3.lightColorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun MyApplicationTheme( | ||
darkTheme: Boolean = isSystemInDarkTheme(), | ||
content: @Composable () -> Unit | ||
) { | ||
val colors = if (darkTheme) { | ||
darkColorScheme( | ||
primary = Color(0xFFBB86FC), | ||
secondary = Color(0xFF03DAC5), | ||
tertiary = Color(0xFF3700B3) | ||
) | ||
} else { | ||
lightColorScheme( | ||
primary = Color(0xFF6200EE), | ||
secondary = Color(0xFF03DAC5), | ||
tertiary = Color(0xFF3700B3) | ||
) | ||
} | ||
val typography = Typography( | ||
bodyMedium = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp | ||
) | ||
) | ||
val shapes = Shapes( | ||
small = RoundedCornerShape(4.dp), | ||
medium = RoundedCornerShape(4.dp), | ||
large = RoundedCornerShape(0.dp) | ||
) | ||
|
||
MaterialTheme( | ||
colorScheme = colors, | ||
typography = typography, | ||
shapes = shapes, | ||
content = content | ||
) | ||
} |
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,3 @@ | ||
<resources> | ||
<style name="AppTheme" parent="android:Theme.Material.NoActionBar"/> | ||
</resources> |
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,48 @@ | ||
plugins { | ||
alias(libs.plugins.kotlinMultiplatform) | ||
alias(libs.plugins.androidLibrary) | ||
} | ||
|
||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) | ||
kotlin { | ||
targetHierarchy.default() | ||
|
||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "NoiseCaptureCommon" | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
//put your multiplatform dependencies here | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(libs.kotlin.test) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "org.noise_planet.noisecapture" | ||
compileSdk = 34 | ||
defaultConfig { | ||
minSdk = 23 | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
NoiseCaptureCommon/src/androidMain/kotlin/org/noise_planet/noisecapture/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,7 @@ | ||
package org.noise_planet.noisecapture | ||
|
||
class AndroidPlatform : Platform { | ||
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() |
12 changes: 12 additions & 0 deletions
12
NoiseCaptureCommon/src/androidUnitTest/kotlin/org/noise_planet/noisecapture/Test.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 org.noise_planet.noisecapture | ||
|
||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
|
||
class AndroidGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
NoiseCaptureCommon/src/commonMain/kotlin/org/noise_planet/noisecapture/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 org.noise_planet.noisecapture | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
NoiseCaptureCommon/src/commonMain/kotlin/org/noise_planet/noisecapture/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 org.noise_planet.noisecapture | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
12 changes: 12 additions & 0 deletions
12
NoiseCaptureCommon/src/commonTest/kotlin/org/noise_planet/noisecapture/Test.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 org.noise_planet.noisecapture | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class CommonGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
NoiseCaptureCommon/src/iosMain/kotlin/org/noise_planet/noisecapture/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,9 @@ | ||
package org.noise_planet.noisecapture | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() |
12 changes: 12 additions & 0 deletions
12
NoiseCaptureCommon/src/iosTest/kotlin/org/noise_planet/noisecapture/Test.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,12 @@ | ||
package org.noise_planet.noisecapture | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class IosGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") | ||
} | ||
} |
Oops, something went wrong.