This commit is contained in:
InsanusMokrassar 2022-01-04 19:46:47 +06:00
parent ac87a140cc
commit c880d8e657
7 changed files with 64 additions and 61 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ build/
out/
local.properties
kotlin-js-store/

View File

@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"

View File

@ -10,7 +10,6 @@ kotlin {
jvm {
compilations.main.kotlinOptions {
jvmTarget = "11"
useIR = true
}
}
sourceSets {

View File

@ -1,6 +1,5 @@
package dev.inmo.kmppscriptbuilder.desktop
import androidx.compose.desktop.Window
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.material.Colors
@ -8,6 +7,8 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import dev.inmo.kmppscriptbuilder.desktop.utils.init
import dev.inmo.kmppscriptbuilder.desktop.utils.loadConfigFile
import dev.inmo.kmppscriptbuilder.desktop.views.BuilderView
@ -16,49 +17,51 @@ import java.io.File
//private val uncaughtExceptionsBC = BroadcastChannel<DefaultErrorHandler.ErrorEvent>(Channel.CONFLATED)
//val uncaughtExceptionsFlow: Flow<DefaultErrorHandler.ErrorEvent> = uncaughtExceptionsBC.asFlow()
fun main(args: Array<String>) = Window(title = "Kotlin Multiplatform Publishing Builder") {
val builder = BuilderView()
MaterialTheme(
Colors(
primary = Color(0x01, 0x57, 0x9b),
primaryVariant = Color(0x00, 0x2f, 0x6c),
secondary = Color(0xb2, 0xeb, 0xf2),
secondaryVariant = Color(0x81, 0xb9, 0xbf),
background = Color(0xe1, 0xe2, 0xe1),
surface = Color(0xf5, 0xf5, 0xf6),
error = Color(0xb7, 0x1c, 0x1c),
onPrimary = Color.White,
onSecondary = Color.Black,
onBackground = Color.Black,
onSurface = Color.Black,
onError = Color.White,
isLight = MaterialTheme.colors.isLight,
)
) {
Box(
Modifier.fillMaxSize()
.background(color = Color(245, 245, 245))
) {
val stateVertical = rememberScrollState(0)
Box(
modifier = Modifier
.fillMaxSize()
.verticalScroll(stateVertical)
) {
builder.init()
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(stateVertical)
fun main(args: Array<String>) = application {
Window(onCloseRequest = ::exitApplication, title = "Kotlin Multiplatform Publishing Builder") {
val builder = BuilderView()
MaterialTheme(
Colors(
primary = Color(0x01, 0x57, 0x9b),
primaryVariant = Color(0x00, 0x2f, 0x6c),
secondary = Color(0xb2, 0xeb, 0xf2),
secondaryVariant = Color(0x81, 0xb9, 0xbf),
background = Color(0xe1, 0xe2, 0xe1),
surface = Color(0xf5, 0xf5, 0xf6),
error = Color(0xb7, 0x1c, 0x1c),
onPrimary = Color.White,
onSecondary = Color.Black,
onBackground = Color.Black,
onSurface = Color.Black,
onError = Color.White,
isLight = MaterialTheme.colors.isLight,
)
) {
Box(
Modifier.fillMaxSize()
.background(color = Color(245, 245, 245))
) {
val stateVertical = rememberScrollState(0)
Box(
modifier = Modifier
.fillMaxSize()
.verticalScroll(stateVertical)
) {
builder.init()
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(stateVertical)
)
}
}
if (args.isNotEmpty()) {
val config = loadConfigFile(File(args.first()))
builder.config = config
}
}
if (args.isNotEmpty()) {
val config = loadConfigFile(File(args.first()))
builder.config = config
}
}

View File

@ -6,27 +6,27 @@ kotlin.incremental.js=true
android.useAndroidX=true
android.enableJetifier=true
kotlin_version=1.5.21
kotlin_coroutines_version=1.5.2
kotlin_serialisation_core_version=1.2.2
ktor_version=1.6.3
micro_utils_version=0.5.24
kotlin_version=1.6.10
kotlin_coroutines_version=1.6.0
kotlin_serialisation_core_version=1.3.2
ktor_version=1.6.7
micro_utils_version=0.9.0
compose_version=1.0.0-alpha3
compose_version=1.0.1
# ANDROID
android_minSdkVersion=21
android_compileSdkVersion=30
android_buildToolsVersion=30.0.3
dexcount_version=3.0.0
android_compileSdkVersion=32
android_buildToolsVersion=32.0.0
dexcount_version=3.0.1
junit_version=4.12
test_ext_junit_version=1.1.2
espresso_core=3.3.0
# Dokka
dokka_version=1.5.0
dokka_version=1.6.0
# Project data

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

View File

@ -48,7 +48,7 @@ class LicensesView(
emptyList()
} else {
licensesTemplates.filter {
val lowercasedTitle = it.title.toLowerCase()
val lowercasedTitle = it.title.lowercase()
lowercased.all { it in lowercasedTitle }
}
}
@ -57,12 +57,12 @@ class LicensesView(
}
private val searchElement = rootElement.createTextField("Quick add", "Type some license name part to find it").apply {
oninput = {
changeActor.offer(Unit)
changeActor.trySend(Unit)
false
}
}
private var searchString: String
get() = searchElement.value.toLowerCase()
get() = searchElement.value.lowercase()
set(value) {
searchElement.value = value
}
@ -71,7 +71,7 @@ class LicensesView(
createCommonButton(value.title).onclick = {
searchString = ""
licensesView.licenses += value
changeActor.offer(Unit)
changeActor.trySend(Unit)
false
}
}
@ -110,4 +110,4 @@ class LicensesView(
titleElement.value = to.title
urlElement.value = to.url ?: ""
}
}
}