Skip to content

Commit

Permalink
Updated Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
NickP0is0n committed Aug 25, 2021
1 parent 4029442 commit bdb4e38
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.5.10"
id("org.jetbrains.compose") version "0.4.0"
kotlin("jvm") version "1.5.21"
id("org.jetbrains.compose") version "1.0.0-alpha3"
}

group = "me.nickp0is0n"
Expand All @@ -13,12 +13,14 @@ version = "0.1.0"
repositories {
jcenter()
mavenCentral()
google()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
}

dependencies {
implementation(compose.desktop.currentOs)
implementation("org.junit.jupiter:junit-jupiter:5.7.0")
//implementation("androidx.annotation:annotation:1.2.0")
}

tasks.withType<KotlinCompile>() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/me/nickp0is0n/easylocalize/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun main() {
Window (
title = AppInfo.windowTitle,
resizable = false,
size = IntSize(780, 455)
size = IntSize(780, 470)
) {
System.setProperty("apple.laf.useScreenMenuBar", "true")
val currentView = MainWindowView()
Expand Down
24 changes: 20 additions & 4 deletions src/main/kotlin/me/nickp0is0n/easylocalize/ui/MainWindowView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.*
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.*
Expand Down Expand Up @@ -174,6 +175,7 @@ class MainWindowView {
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun StringTextField() {
Column {
Expand All @@ -196,8 +198,21 @@ class MainWindowView {
}
} },
modifier = Modifier
.padding(top = 0.dp)
.size(width = 450.dp, height = 160.dp))
.padding(top = 10.dp)
.size(width = 450.dp, height = 160.dp)
.onPreviewKeyEvent {
when {
(it.isAltPressed && it.key == Key.DirectionDown) -> {
if (selectedID != -1 && selectedID + 1 < stringList.size) {
selectedID++
fieldValuesModel.stringFieldValue.value = stringList[selectedID].text
fieldValuesModel.commentFieldValue.value = stringList[selectedID].comment
}
true
}
else -> false
}
})
}
}

Expand All @@ -224,7 +239,7 @@ class MainWindowView {
} },
readOnly = true,
modifier = Modifier
.padding(top = 0.dp)
.padding(top = 10.dp)
.size(width = 450.dp, height = 160.dp))
}
}
Expand Down Expand Up @@ -314,6 +329,7 @@ class MainWindowView {
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun AppMenuBar(): MenuBar =
MenuBar(
Expand Down

0 comments on commit bdb4e38

Please sign in to comment.