Skip to content

Commit bb298ee

Browse files
authored
Merge pull request #37 from kotlin-hands-on/new_wizard_jc_starter
New wizard starter
2 parents 1b158cb + fd9096d commit bb298ee

Some content is hidden

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

56 files changed

+862
-878
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
22
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
33

4+
# Create a multiplatform app using Ktor and SQLDelight – tutorial
45

5-
# Networking and data storage with Kotlin Multiplatform Mobile
6-
7-
This repository is the code corresponding to the hands-on lab [Networking and data storage with Kotlin Multiplatform Mobile](https://play.kotlinlang.org/hands-on/Networking%20and%20Data%20Storage%20with%20Kotlin%20Multiplatfrom%20Mobile/01_Introduction).
6+
This repository is the code corresponding to the hands-on lab [Create a multiplatform app using Ktor and SQLDelight – tutorial](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-ktor-sqldelight.html).

androidApp/build.gradle.kts

-35
This file was deleted.

androidApp/src/main/AndroidManifest.xml

-17
This file was deleted.

androidApp/src/main/java/com/jetbrains/handson/androidApp/MainActivity.kt

-17
This file was deleted.

androidApp/src/main/res/layout/activity_main.xml

-21
This file was deleted.

androidApp/src/main/res/values/colors.xml

-6
This file was deleted.

androidApp/src/main/res/values/styles.xml

-10
This file was deleted.

build.gradle.kts

+7-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
1-
buildscript {
2-
repositories {
3-
gradlePluginPortal()
4-
google()
5-
mavenCentral()
6-
}
7-
dependencies {
8-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
9-
classpath("com.android.tools.build:gradle:8.0.2")
10-
}
11-
}
12-
13-
allprojects {
14-
repositories {
15-
google()
16-
mavenCentral()
17-
}
18-
}
19-
20-
tasks.register("clean", Delete::class) {
21-
delete(rootProject.buildDir)
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.jetbrainsCompose) apply false
7+
alias(libs.plugins.kotlinMultiplatform) apply false
228
}

composeApp/build.gradle.kts

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import org.jetbrains.compose.ExperimentalComposeLibrary
2+
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
3+
4+
plugins {
5+
alias(libs.plugins.kotlinMultiplatform)
6+
alias(libs.plugins.androidApplication)
7+
alias(libs.plugins.jetbrainsCompose)
8+
}
9+
10+
kotlin {
11+
androidTarget {
12+
compilations.all {
13+
kotlinOptions {
14+
jvmTarget = "1.8"
15+
}
16+
}
17+
}
18+
19+
sourceSets {
20+
21+
androidMain.dependencies {
22+
implementation(libs.compose.ui.tooling.preview)
23+
implementation(libs.androidx.activity.compose)
24+
}
25+
commonMain.dependencies {
26+
implementation(compose.runtime)
27+
implementation(compose.foundation)
28+
implementation(compose.material)
29+
implementation(compose.ui)
30+
@OptIn(ExperimentalComposeLibrary::class)
31+
implementation(compose.components.resources)
32+
implementation(projects.shared)
33+
}
34+
}
35+
}
36+
37+
android {
38+
namespace = "com.jetbrains.spacetutorial"
39+
compileSdk = libs.versions.android.compileSdk.get().toInt()
40+
41+
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
42+
sourceSets["main"].res.srcDirs("src/androidMain/res")
43+
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
44+
45+
defaultConfig {
46+
applicationId = "com.jetbrains.spacetutorial"
47+
minSdk = libs.versions.android.minSdk.get().toInt()
48+
targetSdk = libs.versions.android.targetSdk.get().toInt()
49+
versionCode = 1
50+
versionName = "1.0"
51+
}
52+
packaging {
53+
resources {
54+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
55+
}
56+
}
57+
buildTypes {
58+
getByName("release") {
59+
isMinifyEnabled = false
60+
}
61+
}
62+
compileOptions {
63+
sourceCompatibility = JavaVersion.VERSION_1_8
64+
targetCompatibility = JavaVersion.VERSION_1_8
65+
}
66+
dependencies {
67+
debugImplementation(libs.compose.ui.tooling)
68+
}
69+
}
70+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
14+
android:name=".MainActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
</application>
22+
23+
</manifest>
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import androidx.compose.animation.AnimatedVisibility
2+
import androidx.compose.foundation.Image
3+
import androidx.compose.foundation.layout.Column
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.material.Button
6+
import androidx.compose.material.MaterialTheme
7+
import androidx.compose.material.Text
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.runtime.getValue
10+
import androidx.compose.runtime.mutableStateOf
11+
import androidx.compose.runtime.remember
12+
import androidx.compose.runtime.setValue
13+
import androidx.compose.ui.Alignment
14+
import androidx.compose.ui.Modifier
15+
import org.jetbrains.compose.resources.DrawableResource
16+
import org.jetbrains.compose.resources.ExperimentalResourceApi
17+
import org.jetbrains.compose.resources.painterResource
18+
19+
@OptIn(ExperimentalResourceApi::class)
20+
@Composable
21+
fun App() {
22+
MaterialTheme {
23+
var showContent by remember { mutableStateOf(false) }
24+
val greeting = remember { Greeting().greet() }
25+
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
26+
Button(onClick = { showContent = !showContent }) {
27+
Text("Click me!")
28+
}
29+
AnimatedVisibility(showContent) {
30+
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
31+
Image(painterResource(DrawableResource("compose-multiplatform.xml")), null)
32+
Text("Compose: $greeting")
33+
}
34+
}
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.jetbrains.spacetutorial
2+
3+
import App
4+
import android.os.Bundle
5+
import androidx.activity.ComponentActivity
6+
import androidx.activity.compose.setContent
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+
super.onCreate(savedInstanceState)
13+
14+
setContent {
15+
App()
16+
}
17+
}
18+
}
19+
20+
@Preview
21+
@Composable
22+
fun AppAndroidPreview() {
23+
App()
24+
}
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)