AudioScreen code styling
This commit is contained in:
@@ -68,9 +68,7 @@ enum class Result {
|
|||||||
OK, ERROR, RESTART
|
OK, ERROR, RESTART
|
||||||
}
|
}
|
||||||
|
|
||||||
fun NavGraphBuilder.audioScreenRoute(
|
fun NavGraphBuilder.audioScreenRoute(navController: NavController) {
|
||||||
navController: NavController,
|
|
||||||
) {
|
|
||||||
composable("audio") {
|
composable("audio") {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
AudioScreen(
|
AudioScreen(
|
||||||
@@ -127,8 +125,8 @@ private fun AudioScreen(onBack: () -> Unit, checkOnClick: () -> Unit) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { contentPadding ->
|
) {
|
||||||
AudioContent(contentPadding)
|
contentPadding -> AudioContent(contentPadding)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,8 +161,7 @@ private fun AudioContent(contentPadding: PaddingValues) {
|
|||||||
newAudioModules[module] = oldAudioModules.contains("${module}.so")
|
newAudioModules[module] = oldAudioModules.contains("${module}.so")
|
||||||
oldOpusBitrate = Config.variable("opus_bitrate")
|
oldOpusBitrate = Config.variable("opus_bitrate")
|
||||||
oldOpusPacketLoss = Config.variable("opus_packet_loss")
|
oldOpusPacketLoss = Config.variable("opus_packet_loss")
|
||||||
if (!BaresipService.agcAvailable)
|
if (!BaresipService.agcAvailable) oldMicGain = Config.variable("augain")
|
||||||
oldMicGain = Config.variable("augain")
|
|
||||||
|
|
||||||
if (showAlert.value)
|
if (showAlert.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
@@ -203,10 +200,12 @@ private fun Ringtone() {
|
|||||||
val selectRingToneMessage = stringResource(R.string.select_ringtone)
|
val selectRingToneMessage = stringResource(R.string.select_ringtone)
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
var ringtoneUri by remember {
|
var ringtoneUri by remember {
|
||||||
mutableStateOf(if (Preferences(ctx).ringtoneUri == "")
|
mutableStateOf(
|
||||||
|
if (Preferences(ctx).ringtoneUri == "")
|
||||||
RingtoneManager.getActualDefaultRingtoneUri(ctx, RingtoneManager.TYPE_RINGTONE).toString()
|
RingtoneManager.getActualDefaultRingtoneUri(ctx, RingtoneManager.TYPE_RINGTONE).toString()
|
||||||
else
|
else
|
||||||
Preferences(ctx).ringtoneUri!!)
|
Preferences(ctx).ringtoneUri!!
|
||||||
|
)
|
||||||
}
|
}
|
||||||
newRingtoneUri = ringtoneUri
|
newRingtoneUri = ringtoneUri
|
||||||
val launcher = rememberLauncherForActivityResult(
|
val launcher = rememberLauncherForActivityResult(
|
||||||
@@ -265,7 +264,8 @@ private fun ToneCountry() {
|
|||||||
) {
|
) {
|
||||||
val toneCountryTitle = stringResource(R.string.tone_country)
|
val toneCountryTitle = stringResource(R.string.tone_country)
|
||||||
val toneCountryHelp = stringResource(R.string.tone_country_help)
|
val toneCountryHelp = stringResource(R.string.tone_country_help)
|
||||||
Text(text = toneCountryTitle,
|
Text(
|
||||||
|
text = toneCountryTitle,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
@@ -275,9 +275,7 @@ private fun ToneCountry() {
|
|||||||
},
|
},
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
)
|
)
|
||||||
val isDropDownExpanded = remember {
|
val isDropDownExpanded = remember { mutableStateOf(false) }
|
||||||
mutableStateOf(false)
|
|
||||||
}
|
|
||||||
val countryNames = arrayListOf("BG", "BR", "DE", "CZ", "ES", "FI", "FR", "GB", "JP", "NO", "NZ", "SE", "RU", "US")
|
val countryNames = arrayListOf("BG", "BR", "DE", "CZ", "ES", "FI", "FR", "GB", "JP", "NO", "NZ", "SE", "RU", "US")
|
||||||
val countryValues = arrayListOf("bg", "br", "de", "cz", "es", "fi", "fr", "uk", "jp", "no", "nz", "se", "ru", "us")
|
val countryValues = arrayListOf("bg", "br", "de", "cz", "es", "fi", "fr", "uk", "jp", "no", "nz", "se", "ru", "us")
|
||||||
val itemPosition = remember {
|
val itemPosition = remember {
|
||||||
@@ -288,9 +286,7 @@ private fun ToneCountry() {
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable { isDropDownExpanded.value = true }
|
||||||
isDropDownExpanded.value = true
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(text = countryNames[itemPosition.intValue])
|
Text(text = countryNames[itemPosition.intValue])
|
||||||
Icon(
|
Icon(
|
||||||
@@ -359,7 +355,8 @@ private fun CallVolume() {
|
|||||||
) {
|
) {
|
||||||
val defaultCallVolumeTitle = stringResource(R.string.default_call_volume)
|
val defaultCallVolumeTitle = stringResource(R.string.default_call_volume)
|
||||||
val defaultCallVolumeHelp = stringResource(R.string.default_call_volume_help)
|
val defaultCallVolumeHelp = stringResource(R.string.default_call_volume_help)
|
||||||
Text(text = defaultCallVolumeTitle,
|
Text(
|
||||||
|
text = defaultCallVolumeTitle,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = defaultCallVolumeTitle
|
alertTitle.value = defaultCallVolumeTitle
|
||||||
@@ -379,9 +376,7 @@ private fun CallVolume() {
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable { isDropDownExpanded.value = true }
|
||||||
isDropDownExpanded.value = true
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(text = volNames[itemPosition.intValue])
|
Text(text = volNames[itemPosition.intValue])
|
||||||
Icon(
|
Icon(
|
||||||
@@ -451,14 +446,15 @@ private fun AudioModules() {
|
|||||||
) {
|
) {
|
||||||
val audioModulesTitle = stringResource(R.string.audio_modules_title)
|
val audioModulesTitle = stringResource(R.string.audio_modules_title)
|
||||||
val audioModulesHelp = stringResource(R.string.audio_modules_help)
|
val audioModulesHelp = stringResource(R.string.audio_modules_help)
|
||||||
Text(text = audioModulesTitle,
|
Text(
|
||||||
|
text = audioModulesTitle,
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
alertTitle.value = audioModulesTitle
|
alertTitle.value = audioModulesTitle
|
||||||
alertMessage.value = audioModulesHelp
|
alertMessage.value = audioModulesHelp
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
})
|
})
|
||||||
for (module in Config.audioModules) {
|
for (module in Config.audioModules)
|
||||||
Row(horizontalArrangement = Arrangement.Start,
|
Row(horizontalArrangement = Arrangement.Start,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(start = 18.dp, end = 10.dp)
|
modifier = Modifier.padding(start = 18.dp, end = 10.dp)
|
||||||
@@ -476,7 +472,6 @@ private fun AudioModules() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun OpusBitRate() {
|
private fun OpusBitRate() {
|
||||||
@@ -584,7 +579,6 @@ private fun checkOnClick(ctx: Context): Result {
|
|||||||
BaresipService.rt = RingtoneManager.getRingtone(ctx, newRingtoneUri.toUri())
|
BaresipService.rt = RingtoneManager.getRingtone(ctx, newRingtoneUri.toUri())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (BaresipService.toneCountry != newToneCountry) {
|
if (BaresipService.toneCountry != newToneCountry) {
|
||||||
BaresipService.toneCountry = newToneCountry
|
BaresipService.toneCountry = newToneCountry
|
||||||
Config.replaceVariable("tone_country", newToneCountry)
|
Config.replaceVariable("tone_country", newToneCountry)
|
||||||
@@ -599,8 +593,7 @@ private fun checkOnClick(ctx: Context): Result {
|
|||||||
|
|
||||||
if (!BaresipService.agcAvailable) {
|
if (!BaresipService.agcAvailable) {
|
||||||
var gain = newMicGain.trim()
|
var gain = newMicGain.trim()
|
||||||
if (!gain.contains("."))
|
if (!gain.contains(".")) gain = "$gain.0"
|
||||||
gain = "$gain.0"
|
|
||||||
if (gain != oldMicGain) {
|
if (gain != oldMicGain) {
|
||||||
if (!checkMicGain(gain)) {
|
if (!checkMicGain(gain)) {
|
||||||
alertTitle.value = ctx.getString(R.string.notice)
|
alertTitle.value = ctx.getString(R.string.notice)
|
||||||
|
|||||||
Reference in New Issue
Block a user