Get strings outside of composables
This commit is contained in:
@@ -200,12 +200,13 @@ private fun CallVolume() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val defaultCallVolumeTitle = stringResource(R.string.default_call_volume)
|
||||||
Text(text = stringResource(R.string.default_call_volume),
|
val defaultCallVolumeHelp = stringResource(R.string.default_call_volume_help)
|
||||||
|
Text(text = defaultCallVolumeTitle,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.default_call_volume)
|
alertTitle.value = defaultCallVolumeTitle
|
||||||
alertMessage.value = ctx.getString(R.string.default_call_volume_help)
|
alertMessage.value = defaultCallVolumeHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -262,12 +263,13 @@ private fun MicGain() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val microphoneGainTitle = stringResource(R.string.microphone_gain)
|
||||||
|
val microphoneGainHelp = stringResource(R.string.microphone_gain_help)
|
||||||
var micGain by remember { mutableStateOf(oldMicGain) }
|
var micGain by remember { mutableStateOf(oldMicGain) }
|
||||||
newMicGain = micGain
|
newMicGain = micGain
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = micGain,
|
value = micGain,
|
||||||
placeholder = { Text(stringResource(R.string.microphone_gain)) },
|
placeholder = { Text(microphoneGainTitle) },
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
micGain = it
|
micGain = it
|
||||||
newMicGain = micGain
|
newMicGain = micGain
|
||||||
@@ -275,12 +277,12 @@ private fun MicGain() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.microphone_gain)
|
alertTitle.value = microphoneGainTitle
|
||||||
alertMessage.value = ctx.getString(R.string.microphone_gain_help)
|
alertMessage.value = microphoneGainHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
||||||
label = { Text(stringResource(R.string.microphone_gain)) },
|
label = { Text(microphoneGainTitle) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -293,12 +295,13 @@ private fun SpeakerPhone() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val speakerPhoneTitle = stringResource(R.string.speaker_phone)
|
||||||
Text(text = stringResource(R.string.speaker_phone),
|
val speakerPhoneHelp = stringResource(R.string.speaker_phone_help)
|
||||||
|
Text(text = speakerPhoneTitle,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.speaker_phone)
|
alertTitle.value = speakerPhoneTitle
|
||||||
alertMessage.value = ctx.getString(R.string.speaker_phone_help)
|
alertMessage.value = speakerPhoneHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
@@ -319,12 +322,13 @@ private fun AudioModules() {
|
|||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.Start,
|
horizontalAlignment = Alignment.Start,
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val audioModulesTitle = stringResource(R.string.audio_modules_title)
|
||||||
Text(text = stringResource(R.string.audio_modules_title),
|
val audioModulesHelp = stringResource(R.string.audio_modules_help)
|
||||||
|
Text(text = audioModulesTitle,
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.audio_modules_title)
|
alertTitle.value = audioModulesTitle
|
||||||
alertMessage.value = ctx.getString(R.string.audio_modules_help)
|
alertMessage.value = audioModulesHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
})
|
})
|
||||||
for (module in Config.audioModules) {
|
for (module in Config.audioModules) {
|
||||||
@@ -332,7 +336,7 @@ private fun AudioModules() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(start = 18.dp, end = 10.dp)
|
modifier = Modifier.padding(start = 18.dp, end = 10.dp)
|
||||||
) {
|
) {
|
||||||
Text(text = String.format(ctx.getString(R.string.bullet_item), module), fontSize = 18.sp)
|
Text(text = String.format(stringResource(R.string.bullet_item), module), fontSize = 18.sp)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
var checked by remember { mutableStateOf(oldAudioModules.contains("${module}.so")) }
|
var checked by remember { mutableStateOf(oldAudioModules.contains("${module}.so")) }
|
||||||
Switch(
|
Switch(
|
||||||
@@ -354,12 +358,13 @@ private fun OpusBitRate() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val opusBitRateTitle = stringResource(R.string.opus_bit_rate)
|
||||||
|
val opusBitRateHelp = stringResource(R.string.opus_bit_rate_help)
|
||||||
var opusBitrate by remember { mutableStateOf(oldOpusBitrate) }
|
var opusBitrate by remember { mutableStateOf(oldOpusBitrate) }
|
||||||
newOpusBitrate = opusBitrate
|
newOpusBitrate = opusBitrate
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = opusBitrate,
|
value = opusBitrate,
|
||||||
placeholder = { Text(stringResource(R.string.opus_bit_rate)) },
|
placeholder = { Text(opusBitRateTitle) },
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
opusBitrate = it
|
opusBitrate = it
|
||||||
newOpusBitrate = opusBitrate
|
newOpusBitrate = opusBitrate
|
||||||
@@ -367,12 +372,12 @@ private fun OpusBitRate() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.opus_bit_rate)
|
alertTitle.value = opusBitRateTitle
|
||||||
alertMessage.value = ctx.getString(R.string.opus_bit_rate_help)
|
alertMessage.value = opusBitRateHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
||||||
label = { Text(stringResource(R.string.opus_bit_rate)) },
|
label = { Text(opusBitRateTitle) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -385,12 +390,13 @@ private fun OpusPacketLoss() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val opusPacketLossTitle = stringResource(R.string.opus_packet_loss)
|
||||||
|
val opusPacketLossHelp = stringResource(R.string.opus_packet_loss_help)
|
||||||
var opusPacketLoss by remember { mutableStateOf(oldOpusPacketLoss) }
|
var opusPacketLoss by remember { mutableStateOf(oldOpusPacketLoss) }
|
||||||
newOpusPacketLoss = opusPacketLoss
|
newOpusPacketLoss = opusPacketLoss
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = opusPacketLoss,
|
value = opusPacketLoss,
|
||||||
placeholder = { Text(stringResource(R.string.opus_packet_loss)) },
|
placeholder = { Text(opusPacketLossTitle) },
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
opusPacketLoss = it
|
opusPacketLoss = it
|
||||||
newOpusPacketLoss = opusPacketLoss
|
newOpusPacketLoss = opusPacketLoss
|
||||||
@@ -398,12 +404,12 @@ private fun OpusPacketLoss() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.opus_packet_loss)
|
alertTitle.value = opusPacketLossTitle
|
||||||
alertMessage.value = ctx.getString(R.string.opus_packet_loss_help)
|
alertMessage.value = opusPacketLossHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
||||||
label = { Text(stringResource(R.string.opus_packet_loss)) },
|
label = { Text(opusPacketLossTitle) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -416,12 +422,13 @@ private fun AudioDelay() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val audioDelayTitle = stringResource(R.string.audio_delay)
|
||||||
|
val audioDelayHelp = stringResource(R.string.audio_delay_help)
|
||||||
var audioDelay by remember { mutableStateOf(BaresipService.audioDelay.toString()) }
|
var audioDelay by remember { mutableStateOf(BaresipService.audioDelay.toString()) }
|
||||||
newAudioDelay = audioDelay
|
newAudioDelay = audioDelay
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = audioDelay,
|
value = audioDelay,
|
||||||
placeholder = { Text(stringResource(R.string.audio_delay)) },
|
placeholder = { Text(audioDelayTitle) },
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
audioDelay = it
|
audioDelay = it
|
||||||
newAudioDelay = audioDelay
|
newAudioDelay = audioDelay
|
||||||
@@ -429,12 +436,12 @@ private fun AudioDelay() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.audio_delay)
|
alertTitle.value = audioDelayTitle
|
||||||
alertMessage.value = ctx.getString(R.string.audio_delay_help)
|
alertMessage.value = audioDelayHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp),
|
||||||
label = { Text(stringResource(R.string.audio_delay)) },
|
label = { Text(audioDelayTitle) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -447,12 +454,13 @@ private fun ToneCountry() {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
val ctx = LocalContext.current
|
val toneCountryTitle = stringResource(R.string.tone_country)
|
||||||
Text(text = stringResource(R.string.tone_country),
|
val toneCountryHelp = stringResource(R.string.tone_country_help)
|
||||||
|
Text(text = toneCountryTitle,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = ctx.getString(R.string.tone_country)
|
alertTitle.value = toneCountryTitle
|
||||||
alertMessage.value = ctx.getString(R.string.tone_country_help)
|
alertMessage.value = toneCountryHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
|
|||||||
Reference in New Issue
Block a user