Skip to content

Commit

Permalink
Performance optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
NickP0is0n committed Sep 25, 2021
1 parent 5196e72 commit 06883ea
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions src/main/kotlin/me/nickp0is0n/easylocalize/ui/MainWindowView.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.nickp0is0n.easylocalize.ui

import androidx.compose.desktop.AppWindow
import androidx.compose.desktop.LocalAppWindow
import androidx.compose.foundation.BoxWithTooltip
import androidx.compose.foundation.ExperimentalFoundationApi
Expand Down Expand Up @@ -89,41 +90,46 @@ class MainWindowView {
if (selectedID == -1) {
setTextFieldDefaultValues()
}
Column {
StringTextField()
CommentTextField()
Row (modifier = Modifier.padding(top = 10.dp)) {
Button (
onClick = {
controller.onExportButtonClick(stringList, window)
if (controller.exportedSuccessfully) {
val notifier = Notifier()
notifier.notify("Success", "Localization file has been successfully exported.")
controller.exportedSuccessfully = false // resets the value
}
},
colors = ButtonDefaults.buttonColors(backgroundColor = Color(30, 144, 255)),
) {
Text(text ="Export translations to file...", color = Color.White)
}
Button (
onClick = {
val selection = StringSelection(stringList[selectedID].toString())
Toolkit.getDefaultToolkit().systemClipboard.setContents(selection, null)
},
colors = ButtonDefaults.buttonColors(backgroundColor = Color(30, 144, 255)),
modifier = Modifier.padding(start = 6.dp)
) {
Text(text ="Copy string to clipboard", color = Color.White)
}
}
}
EditingSpace(window)
checkIfOpenButtonClicked()
checkIfSaveButtonClicked()
checkIfParserSettingsButtonClicked()
}
}

@Composable
private fun EditingSpace(window: AppWindow) {
Column {
StringTextField()
CommentTextField()
Row(modifier = Modifier.padding(top = 10.dp)) {
Button(
onClick = {
controller.onExportButtonClick(stringList, window)
if (controller.exportedSuccessfully) {
val notifier = Notifier()
notifier.notify("Success", "Localization file has been successfully exported.")
controller.exportedSuccessfully = false // resets the value
}
},
colors = ButtonDefaults.buttonColors(backgroundColor = Color(30, 144, 255)),
) {
Text(text = "Export translations to file...", color = Color.White)
}
Button(
onClick = {
val selection = StringSelection(stringList[selectedID].toString())
Toolkit.getDefaultToolkit().systemClipboard.setContents(selection, null)
},
colors = ButtonDefaults.buttonColors(backgroundColor = Color(30, 144, 255)),
modifier = Modifier.padding(start = 6.dp)
) {
Text(text = "Copy string to clipboard", color = Color.White)
}
}
}
}

@Composable
private fun SearchBar() {
OutlinedTextField(
Expand Down

0 comments on commit 06883ea

Please sign in to comment.