forked from omni/OmniCards
feat: added russian translations
This commit is contained in:
@@ -34,6 +34,8 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.github.skydoves.colorpicker.compose.ColorEnvelope
|
||||
@@ -79,6 +81,8 @@ fun CardEditable(
|
||||
color: String?,
|
||||
onColorChange: (String?) -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
var isCodeTypeDropdownExpanded by rememberSaveable { mutableStateOf(false) }
|
||||
var isColorPickerExpanded by rememberSaveable { mutableStateOf(false) }
|
||||
var isColorEnabled by rememberSaveable { mutableStateOf(color != null) }
|
||||
@@ -105,7 +109,7 @@ fun CardEditable(
|
||||
value = cardName,
|
||||
onValueChange = onCardNameChange,
|
||||
modifier = fieldModifier,
|
||||
label = { Text("Name") }
|
||||
label = { Text(stringResource(R.string.card_name)) }
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
@@ -114,21 +118,21 @@ fun CardEditable(
|
||||
value = codeValue,
|
||||
onValueChange = onCodeValueChange,
|
||||
modifier = Modifier.weight(1f),
|
||||
label = { Text("Value") }
|
||||
label = { Text(stringResource(R.string.card_value)) }
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
onClick = {
|
||||
scanLauncher.launch(
|
||||
ScanOptions().apply {
|
||||
setPrompt("Scan your card")
|
||||
setPrompt(context.getString(R.string.scan_your_card))
|
||||
setBeepEnabled(true)
|
||||
setOrientationLocked(false)
|
||||
}
|
||||
)
|
||||
}
|
||||
) {
|
||||
Text("Scan")
|
||||
Text(stringResource(R.string.do_scan_card))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +143,7 @@ fun CardEditable(
|
||||
value = codeType.name,
|
||||
onValueChange = {},
|
||||
modifier = fieldModifier,
|
||||
label = { Text("Code type") },
|
||||
label = { Text(stringResource(R.string.card_code_type)) },
|
||||
readOnly = true,
|
||||
)
|
||||
Box(
|
||||
@@ -176,7 +180,7 @@ fun CardEditable(
|
||||
isColorPickerExpanded = !isColorPickerExpanded
|
||||
}
|
||||
) {
|
||||
Text("Choose color")
|
||||
Text(stringResource(R.string.do_choose_color))
|
||||
}
|
||||
Switch(
|
||||
checked = isColorEnabled,
|
||||
@@ -215,7 +219,7 @@ fun AddCard(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
||||
val context = LocalActivity.current
|
||||
|
||||
Page(
|
||||
"New card",
|
||||
stringResource(R.string.new_card_title),
|
||||
innerPadding
|
||||
) {
|
||||
Column(
|
||||
@@ -244,11 +248,11 @@ fun AddCard(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
||||
getDbFun().addCard(cardName, codeValue, codeType, color)
|
||||
context!!.finish()
|
||||
} else {
|
||||
Toast.makeText(context, err, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, context!!.getString(err), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text("Save")
|
||||
Text(stringResource(R.string.do_save))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +268,7 @@ fun EditCard(cardInfo: CardInfo, innerPadding: PaddingValues, getDbFun: () -> Db
|
||||
val context = LocalActivity.current
|
||||
|
||||
Page(
|
||||
"Editing card id${cardInfo.id}",
|
||||
stringResource(R.string.editing_card_title, cardInfo.id),
|
||||
innerPadding
|
||||
) {
|
||||
Column(
|
||||
@@ -293,11 +297,11 @@ fun EditCard(cardInfo: CardInfo, innerPadding: PaddingValues, getDbFun: () -> Db
|
||||
getDbFun().editCard(cardInfo.id, cardName, codeValue, codeType, color)
|
||||
context!!.finish()
|
||||
} else {
|
||||
Toast.makeText(context, err, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, context!!.getString(err), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text("Save")
|
||||
Text(stringResource(R.string.do_save))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user