Skip to content

Commit 9a78be5

Browse files
committed
code move to particular screen file
1 parent 6152d47 commit 9a78be5

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

src/main/kotlin/App.kt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import androidx.compose.desktop.ui.tooling.preview.Preview
32
import androidx.compose.foundation.layout.Arrangement
43
import androidx.compose.foundation.layout.Column
@@ -78,35 +77,38 @@ fun App() {
7877
modifier = Modifier.weight(1f).height(50.dp),
7978
"Translate",
8079
onClick = {
81-
if (stringState.isEmpty()){
80+
if (stringState.isEmpty()) {
8281
isShowToast = true
8382
toastMessage = "Error: Please enter the source strings"
8483
CoroutineScope(Dispatchers.IO).launch {
8584
delay(3000)
8685
isShowToast = false
8786
}
88-
}else if (!isValidXml(stringState)){
87+
} else if (!isValidXml(stringState)) {
8988
isShowToast = true
90-
toastMessage ="Error: Please enter the source strings in XML format into the provided text field."
89+
toastMessage =
90+
"Error: Please enter the source strings in XML format into the provided text field."
9191
CoroutineScope(Dispatchers.IO).launch {
9292
delay(3000)
9393
isShowToast = false
9494
}
95-
} else if (folderState.isEmpty()){
95+
} else if (folderState.isEmpty()) {
9696
isShowToast = true
97-
toastMessage ="Error: Enter the folder name where you want to store the translated strings."
97+
toastMessage =
98+
"Error: Enter the folder name where you want to store the translated strings."
9899
CoroutineScope(Dispatchers.IO).launch {
99100
delay(3000)
100101
isShowToast = false
101102
}
102-
} else if (!countryListState.any { it.isChecked }){
103+
} else if (!countryListState.any { it.isChecked }) {
103104
isShowToast = true
104-
toastMessage = "Error: Please select at least one target language before translating."
105+
toastMessage =
106+
"Error: Please select at least one target language before translating."
105107
CoroutineScope(Dispatchers.IO).launch {
106108
delay(3000)
107109
isShowToast = false
108110
}
109-
}else {
111+
} else {
110112
isWindowShow = WindowState.CONVERT_TRANSLATE
111113
}
112114
}
@@ -118,9 +120,10 @@ fun App() {
118120
SelectCountries(countryListState) {
119121
countryListState = it
120122
isWindowShow = WindowState.NO_STATE
121-
if (!it.any { elements -> elements.isChecked }){
123+
if (!it.any { elements -> elements.isChecked }) {
122124
isShowToast = true
123-
toastMessage = "Error: Please select at least one target language before translating."
125+
toastMessage =
126+
"Error: Please select at least one target language before translating."
124127
CoroutineScope(Dispatchers.IO).launch {
125128
delay(3000)
126129
isShowToast = false

src/main/kotlin/models/Language.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
package models
22

3-
data class Language(val code: String, val name: String,var isChecked : Boolean = false)
3+
data class Language(
4+
val code: String,
5+
val name: String,
6+
var isChecked: Boolean = false
7+
)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package models
22

33
data class StringModel(
4-
val name : String,
5-
val isTranslatable : Boolean = true,
6-
val textContent : String,
4+
val name: String,
5+
val isTranslatable: Boolean = true,
6+
val textContent: String
77
)

src/main/kotlin/theme/Color.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ package theme
33
import androidx.compose.ui.graphics.Color
44

55
val PurpleBlue = Color(0xFF7F52FF)
6-
val Background = Color(0xFF1F1D2B)
76
val TextFieldBackground = Color(0xFF000000)

src/main/kotlin/translate/TranslationConnection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fun translateHttpURLConnection(
2323
query: String,
2424
sourceLang: String,
2525
targetLang: String,
26-
onSuccessCallback : (String) -> Unit,
26+
onSuccessCallback: (String) -> Unit,
2727
onErrorCallback: (String) -> Unit,
2828
isFirstTime: Boolean = true,
2929
) {

src/main/kotlin/utils/Contant.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ enum class WindowState {
99
SELECT_COUNTRY,
1010
CONVERT_TRANSLATE
1111
}
12+
1213
val languageList = mutableListOf(
1314
Language("af", "Afrikaans"),
1415
Language("agq", "Aghem"),

0 commit comments

Comments
 (0)