feat: support compose multiplatform
1
samples/androidApp/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
45
samples/androidApp/build.gradle.kts
Normal file
@@ -0,0 +1,45 @@
|
||||
plugins {
|
||||
autowire(libs.plugins.kotlin.multiplatform)
|
||||
autowire(libs.plugins.android.application)
|
||||
autowire(libs.plugins.jetbrains.compose)
|
||||
}
|
||||
|
||||
group = property.project.groupName
|
||||
|
||||
kotlin {
|
||||
androidTarget()
|
||||
jvmToolchain(17)
|
||||
sourceSets {
|
||||
val androidMain by getting {
|
||||
dependencies {
|
||||
implementation(projects.samples.shared)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = property.project.groupName
|
||||
compileSdk = property.project.android.compileSdk
|
||||
|
||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
||||
|
||||
defaultConfig {
|
||||
applicationId = property.project.groupName
|
||||
minSdk = property.project.android.minSdk
|
||||
targetSdk = property.project.android.targetSdk
|
||||
versionName = property.project.samples.androidApp.versionName
|
||||
versionCode = property.project.samples.androidApp.versionCode
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
}
|
21
samples/androidApp/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
23
samples/androidApp/src/androidMain/AndroidManifest.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.PageCurl">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.PageCurl">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
samples/androidApp/src/androidMain/ic_launcher-playstore.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,26 @@
|
||||
package eu.wewox.pagecurl
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.layout.safeDrawingPadding
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.core.view.WindowCompat
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
setContent { App(Modifier.safeDrawingPadding()) }
|
||||
val callback = onBackPressedDispatcher.addCallback(enabled = false) {
|
||||
isEnabled = false
|
||||
PageStateHandler.navToMain()
|
||||
}
|
||||
PageStateHandler.onLeftMain { callback.isEnabled = true }
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group
|
||||
android:scaleX="2.475"
|
||||
android:scaleY="2.475"
|
||||
android:translateX="34.2"
|
||||
android:translateY="34.2">
|
||||
<path
|
||||
android:fillColor="#FFF281"
|
||||
android:pathData="M4,0.375H12C14.002,0.375 15.625,1.9981 15.625,4.0001V4.0052V4.0103V4.0154V4.0205V4.0256V4.0307V4.0358V4.0409V4.046V4.0511V4.0561V4.0612V4.0663V4.0714V4.0765V4.0816V4.0867V4.0917V4.0968V4.1019V4.107V4.1121V4.1171V4.1222V4.1273V4.1324V4.1374V4.1425V4.1476V4.1526V4.1577V4.1628V4.1678V4.1729V4.178V4.183V4.1881V4.1932V4.1982V4.2033V4.2083V4.2134V4.2184V4.2235V4.2285V4.2336V4.2386V4.2437V4.2487V4.2538V4.2588V4.2639V4.2689V4.274V4.279V4.284V4.2891V4.2941V4.2991V4.3042V4.3092V4.3142V4.3193V4.3243V4.3293V4.3343V4.3394V4.3444V4.3494V4.3544V4.3594V4.3644V4.3695V4.3745V4.3795V4.3845V4.3895V4.3945V4.3995V4.4045V4.4095V4.4145V4.4195V4.4245V4.4295V4.4345V4.4395V4.4445V4.4495V4.4545V4.4595V4.4644V4.4694V4.4744V4.4794V4.4844V4.4893V4.4943V4.4993V4.5043V4.5092V4.5142V4.5192V4.5241V4.5291V4.5341V4.539V4.544V4.5489V4.5539V4.5588V4.5638V4.5687V4.5737V4.5786V4.5836V4.5885V4.5934V4.5984V4.6033V4.6083V4.6132V4.6181V4.623V4.628V4.6329V4.6378V4.6427V4.6476V4.6526V4.6575V4.6624V4.6673V4.6722V4.6771V4.682V4.6869V4.6918V4.6967V4.7016V4.7065V4.7114V4.7163V4.7211V4.726V4.7309V4.7358V4.7407V4.7456V4.7504V4.7553V4.7602V4.765V4.7699V4.7748V4.7796V4.7845V4.7893V4.7942V4.799V4.8039V4.8087V4.8136V4.8184V4.8232V4.8281V4.8329V4.8377V4.8426V4.8474V4.8522V4.8571V4.8619V4.8667V4.8715V4.8763V4.8811V4.8859V4.8907V4.8955V4.9004V4.9051V4.9099V4.9147V4.9195V4.9243V4.9291V4.9339V4.9387V4.9434V4.9482V4.953V4.9578V4.9625V4.9673V4.9721V4.9768V4.9816V4.9863V4.9911V4.9958V5.0006V5.0053V5.01V5.0148V5.0195V5.0243V5.029V5.0337V5.0384V5.0432V5.0479V5.0526V5.0573V5.062V5.0667V5.0714V5.0761V5.0808V5.0855V5.0902V5.0949V5.0996V5.1043V5.109V5.1136V5.1183V5.123V5.1277V5.1323V5.137V5.1417V5.1463V5.151V5.1556V5.1603V5.1649V5.1696V5.1742V5.1788V5.1835V5.1881V5.1927V5.1974V5.202V5.2066V5.2112V5.2158V5.2204V5.225V5.2296V5.2342V5.2388V5.2434V5.248V5.2526V5.2572V5.2618V5.2663V5.2709V5.2755V5.2801V5.2846V5.2892V5.2937V5.2983V5.3029V5.3074V5.312V5.3165V5.321V5.3256V5.3301V5.3346V5.3391V5.3437V5.3482V5.3527V5.3572V5.3617V5.3662V5.3707V5.3752V5.3797V5.3842V5.3887V5.3932V5.3977V5.4021V5.4066V5.4111V5.4155V5.42V5.4245V5.4289V5.4334V5.4378V5.4423V5.4467V5.4511V5.4556V5.46V5.4644V5.4689V5.4733V5.4777V5.4821V5.4865V5.4909V5.4953V5.4997V5.5041V5.5085V5.5129V5.5173V5.5216V5.526V5.5304V5.5348V5.5391V5.5435V5.5478V5.5522V5.5565V5.5609V5.5652V5.5696V5.5739V5.5782V5.5826V5.5869V5.5912V5.5955V5.5998V5.6041V5.6084V5.6127V5.617V5.6213V5.6256V5.6299V5.6341V5.6384V5.6427V5.6469V5.6512V5.6555V5.6597V5.664V5.6682V5.6725V5.6767V5.6809V5.6852V5.6894V5.6936V5.6978V5.702V5.7062V5.7104V5.7146V5.7188V5.723V5.7272V5.7314V5.7356V5.7397V5.7439V5.7481V5.7523V5.7564V5.7606V5.7647V5.7689V5.773V5.7771V5.7813V5.7854V5.7895V5.7936V5.7977V5.8019V5.806V5.8101V5.8142V5.8183V5.8223V5.8264V5.8305V5.8346V5.8387V5.8427V5.8468V5.8508V5.8549V5.8589V5.863V5.867V5.871V5.8751V5.8791V5.8831V5.8871V5.8911V5.8952V5.8992V5.9032V5.9071V5.9111V5.9151V5.9191V5.9231V5.927V5.931V5.935V5.9389V5.9429V5.9468V5.9508V5.9547V5.9586V5.9626V5.9665V5.9704V5.9743V5.9782V5.9821V5.986V5.9899V5.9938V5.9977V6.0016V6.0054V6.0093V6.0132V6.017V6.0209V6.0247V6.0286V6.0324V6.0363V6.0401V6.0439V6.0477V6.0515V6.0554V6.0592V6.063V6.0668V6.0705V6.0743V6.0781V6.0819V6.0857V6.0894V6.0932V6.0969V6.1007V6.1044V6.1082V6.1119V6.1156V6.1194V6.1231V6.1268V6.1305V6.1342V6.1379V6.1416V6.1453V6.149V6.1526V6.1563V6.16V6.1636V6.1673V6.1709V6.1746V6.1782V6.1819V6.1855V6.1891V6.1927V6.1964V6.2V6.2036V6.2072V6.2108V6.2144V6.2179V6.2215V6.2251V6.2287V6.2322V6.2358V6.2393V6.2428V6.2464V6.2499V6.2534V6.257V6.2605V6.264V6.2675V6.271V6.2745V6.278V6.2815V6.2849V6.2884V6.2919V6.2954C15.625,6.6481 15.4851,6.9846 15.2348,7.2348L7.2348,15.2348C6.985,15.4847 6.6462,15.625 6.2929,15.625H4C1.998,15.625 0.375,14.002 0.375,12V4C0.375,1.998 1.998,0.375 4,0.375Z"
|
||||
android:strokeWidth="0.75"
|
||||
android:strokeColor="#000000" />
|
||||
<path
|
||||
android:fillColor="#FFF9C2"
|
||||
android:pathData="M10,6.375H15.5902C15.5151,6.7764 15.3206,7.1491 15.0277,7.4419L11.7348,10.7348L7.4419,15.0277C7.1491,15.3206 6.7764,15.5151 6.375,15.5902V10C6.375,7.998 7.998,6.375 10,6.375Z"
|
||||
android:strokeWidth="0.75"
|
||||
android:strokeColor="#000000" />
|
||||
<path
|
||||
android:fillColor="#6DD3FF"
|
||||
android:pathData="M7.4057,15.1246L15.1251,7.4053V11.4979C15.1251,13.4994 13.503,15.1221 11.5016,15.1229L7.4057,15.1246Z"
|
||||
android:strokeWidth="0.75"
|
||||
android:strokeColor="#000000" />
|
||||
</group>
|
||||
</vector>
|
BIN
samples/androidApp/src/androidMain/res/drawable/img_sit.jpg
Normal file
After Width: | Height: | Size: 286 KiB |
BIN
samples/androidApp/src/androidMain/res/drawable/img_sleep.jpg
Normal file
After Width: | Height: | Size: 607 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 12 KiB |
4
samples/androidApp/src/androidMain/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">PageCurl</string>
|
||||
</resources>
|
7
samples/androidApp/src/androidMain/res/values/themes.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.PageCurl" parent="android:Theme.Material.Light.NoActionBar">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|