From 2a50a192d5561d02b63c5275eb2561a0ca318a48 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 20 Oct 2025 17:48:40 +0300 Subject: [PATCH] More work on Material3 colors migration --- .../com/tutpro/baresip/AccountScreen.kt | 241 +++++++---------- .../com/tutpro/baresip/AccountsScreen.kt | 10 +- .../tutpro/baresip/AndroidContactScreen.kt | 1 - .../kotlin/com/tutpro/baresip/AudioScreen.kt | 74 ++---- .../tutpro/baresip/BaresipContactScreen.kt | 13 +- .../com/tutpro/baresip/CallDetailsScreen.kt | 18 +- .../kotlin/com/tutpro/baresip/CallHistory.kt | 2 +- .../kotlin/com/tutpro/baresip/CallsScreen.kt | 12 +- .../kotlin/com/tutpro/baresip/ChatScreen.kt | 13 +- .../kotlin/com/tutpro/baresip/ChatsScreen.kt | 46 ++-- .../kotlin/com/tutpro/baresip/CodecsScreen.kt | 22 +- .../com/tutpro/baresip/ContactsScreen.kt | 8 +- .../kotlin/com/tutpro/baresip/CustomColors.kt | 11 +- .../com/tutpro/baresip/CustomElements.kt | 27 +- .../kotlin/com/tutpro/baresip/MainScreen.kt | 92 +++---- .../com/tutpro/baresip/SettingsScreen.kt | 246 ++++++------------ app/src/main/res/values-night/colors.xml | 7 - app/src/main/res/values/colors.xml | 7 - 18 files changed, 300 insertions(+), 550 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt index ad377301..77a1a05c 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.Switch @@ -65,7 +66,6 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.tutpro.baresip.CustomElements.AlertDialog -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.verticalScrollbar import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -141,12 +141,12 @@ private fun AccountScreen( Scaffold( modifier = Modifier.fillMaxSize().imePadding(), - containerColor = LocalCustomColors.current.background, + containerColor = MaterialTheme.colorScheme.background, topBar = { Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding( top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding() ) @@ -159,10 +159,10 @@ private fun AccountScreen( ) }, colors = TopAppBarDefaults.topAppBarColors( - containerColor = LocalCustomColors.current.primary, - navigationIconContentColor = LocalCustomColors.current.onPrimary, - titleContentColor = LocalCustomColors.current.onPrimary, - actionIconContentColor = LocalCustomColors.current.onPrimary + containerColor = MaterialTheme.colorScheme.primary, + navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, + titleContentColor = MaterialTheme.colorScheme.onPrimary, + actionIconContentColor = MaterialTheme.colorScheme.onPrimary ), navigationIcon = { IconButton(onClick = onBack) { @@ -234,13 +234,9 @@ private fun AccountContent( enabled = false, onValueChange = {}, modifier = Modifier.fillMaxWidth(), - textStyle = TextStyle( - fontSize = 18.sp, - color = LocalCustomColors.current.itemText - ), + textStyle = TextStyle(fontSize = 18.sp), label = { - LabelText(text = stringResource(R.string.sip_uri), - fontWeight = FontWeight.Bold) + Text(text = stringResource(R.string.sip_uri), fontWeight = FontWeight.Bold) } ) } @@ -266,9 +262,8 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.nickname)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.nickname)) }, keyboardOptions = KeyboardOptions( capitalization = KeyboardCapitalization.Words, keyboardType = KeyboardType.Text), @@ -297,12 +292,12 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.display_name)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.display_name)) }, keyboardOptions = KeyboardOptions( capitalization = KeyboardCapitalization.Sentences, - keyboardType = KeyboardType.Text), + keyboardType = KeyboardType.Text + ), ) } } @@ -327,9 +322,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.authentication_username_help) showAlert.value = true }, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.authentication_username)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.authentication_username)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -364,7 +358,7 @@ private fun AccountContent( else ImageVector.vectorResource(R.drawable.visibility_off), contentDescription = "Visibility", - tint = LocalCustomColors.current.itemText + tint = MaterialTheme.colorScheme.onSurfaceVariant ) } }, @@ -375,9 +369,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.authentication_password_help) showAlert.value = true }, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.authentication_password)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.authentication_password)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -411,7 +404,6 @@ private fun AccountContent( fun Outbound() { val ctx = LocalContext.current Text(text = stringResource(R.string.outbound_proxies), - color = LocalCustomColors.current.itemText, fontSize = 18.sp, modifier = Modifier .padding(top = 8.dp) @@ -433,9 +425,8 @@ private fun AccountContent( onValueChange = { viewModel.outbound1.value = it }, modifier = Modifier.fillMaxWidth(), singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.sip_uri_of_proxy_server)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.sip_uri_of_proxy_server)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -451,9 +442,8 @@ private fun AccountContent( onValueChange = { viewModel.outbound2.value = it }, modifier = Modifier.fillMaxWidth(), singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.sip_uri_of_another_proxy_server)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.sip_uri_of_another_proxy_server)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -476,7 +466,7 @@ private fun AccountContent( showAlert.value = true }, fontSize = 18.sp, - color = LocalCustomColors.current.itemText) + ) val register by viewModel.register.collectAsState() Switch( checked = register, @@ -506,10 +496,8 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, - color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.reg_int)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.reg_int)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number) ) } @@ -532,7 +520,6 @@ private fun AccountContent( val route = "codecs/$aor/audio" navController.navigate(route) }, - color = LocalCustomColors.current.itemText, fontSize = 18.sp, fontWeight = FontWeight.Bold ) @@ -555,8 +542,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.media_encryption_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } val mediaEnc by viewModel.mediaEnc.collectAsState() Box { @@ -567,10 +554,8 @@ private fun AccountContent( isDropDownExpanded.value = true } ) { - Text(text = mediaEncMap[mediaEnc]!!, - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = mediaEncMap[mediaEnc]!!) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -579,19 +564,14 @@ private fun AccountContent( }) { var index = 0 mediaEncMap.forEach { - DropdownMenuItem(text = { - Text(text = it.value, - color = LocalCustomColors.current.itemText) - }, + DropdownMenuItem(text = { Text(text = it.value) }, onClick = { isDropDownExpanded.value = false viewModel.mediaEnc.value = it.key - }) + } + ) if (index < 4) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) index++ } } @@ -615,8 +595,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.media_nat_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } val mediaNat by viewModel.mediaNat.collectAsState() Box { @@ -627,30 +607,25 @@ private fun AccountContent( isDropDownExpanded.value = true } ) { - Text(text = mediaNatMap[mediaNat]!!, - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = mediaNatMap[mediaNat]!!) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, onDismissRequest = { isDropDownExpanded.value = false - }) { + } + ) { var index = 0 mediaNatMap.forEach { - DropdownMenuItem(text = { - Text(text = it.value) - }, + DropdownMenuItem(text = { Text(text = it.value) }, onClick = { isDropDownExpanded.value = false viewModel.mediaNat.value = it.key - }) + } + ) if (index < 3) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) index++ } } @@ -677,9 +652,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.stun_server_help) showAlert.value = true }, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.stun_server)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.stun_server)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -704,9 +678,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.stun_username_help) showAlert.value = true }, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.stun_username)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.stun_username)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -738,7 +711,7 @@ private fun AccountContent( else ImageVector.vectorResource(R.drawable.visibility_off), contentDescription = "Visibility", - tint = LocalCustomColors.current.itemText + tint = MaterialTheme.colorScheme.onSurfaceVariant ) } }, @@ -749,9 +722,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.stun_password_help) showAlert.value = true }, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.stun_password)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.stun_password)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -773,8 +745,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.rtcp_mux_help) showAlert.value = true }, - fontSize = 18.sp, - color = LocalCustomColors.current.itemText) + fontSize = 18.sp + ) Switch( checked = rtcpMux, onCheckedChange = { viewModel.rtcpMux.value = it } @@ -798,8 +770,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.rel_100_help) showAlert.value = true }, - fontSize = 18.sp, - color = LocalCustomColors.current.itemText) + fontSize = 18.sp + ) Switch( checked = rel100, onCheckedChange = { viewModel.rel100.value = it } @@ -826,8 +798,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.dtmf_mode_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } Box { Row( @@ -837,10 +809,8 @@ private fun AccountContent( isDropDownExpanded.value = true } ) { - Text(text = dtmfModeMap[dtmfMode]!!, - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = dtmfModeMap[dtmfMode]!!) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -849,18 +819,14 @@ private fun AccountContent( }) { var index = 0 dtmfModeMap.forEach { - DropdownMenuItem(text = { - Text(text = it.value) - }, + DropdownMenuItem(text = { Text(text = it.value) }, onClick = { isDropDownExpanded.value = false viewModel.dtmfMode.value = it.key - }) + } + ) if (index < 2) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) index++ } } @@ -886,27 +852,22 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.answer_mode_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } Box { Row( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.clickable { - isDropDownExpanded.value = true - } + modifier = Modifier.clickable { isDropDownExpanded.value = true } ) { - Text(text = answerModeMap[answerMode]!!, - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = answerModeMap[answerMode]!!) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, - onDismissRequest = { - isDropDownExpanded.value = false - }) { + onDismissRequest = { isDropDownExpanded.value = false } + ) { var index = 0 answerModeMap.forEach { DropdownMenuItem(text = { Text(text = it.value) }, @@ -915,10 +876,7 @@ private fun AccountContent( viewModel.answerMode.value = it.key }) if (index < 1) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) index++ } } @@ -944,41 +902,33 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.redirect_mode_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } Box { Row( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.clickable { - isDropDownExpanded.value = true - } + modifier = Modifier.clickable { isDropDownExpanded.value = true } ) { - Text(text = redirectModeMap[autoRedirect]!!, - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = redirectModeMap[autoRedirect]!!) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, - onDismissRequest = { - isDropDownExpanded.value = false - }) { + onDismissRequest = { isDropDownExpanded.value = false } + ) { var index = 0 redirectModeMap.forEach { - DropdownMenuItem(text = { - Text(text = it.value) - }, + DropdownMenuItem( + text = { Text(text = it.value) }, onClick = { isDropDownExpanded.value = false viewModel.autoRedirect.value = it.key - }) + } + ) if (index < 1) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) index++ } } @@ -1006,9 +956,8 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.voicemail_uri)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.voicemail_uri)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -1034,9 +983,8 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.country_code)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.country_code)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -1062,9 +1010,8 @@ private fun AccountContent( showAlert.value = true }, singleLine = true, - textStyle = TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.telephony_provider)) }, + textStyle = TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.telephony_provider)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -1086,8 +1033,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.numeric_keypad_help) showAlert.value = true }, - fontSize = 18.sp, - color = LocalCustomColors.current.itemText) + fontSize = 18.sp + ) Switch( checked = numericKeypad, onCheckedChange = { viewModel.numericKeypad.value = it } @@ -1111,8 +1058,8 @@ private fun AccountContent( alertMessage.value = ctx.getString(R.string.default_account_help) showAlert.value = true }, - fontSize = 18.sp, - color = LocalCustomColors.current.itemText) + fontSize = 18.sp + ) Switch( checked = defaultAccount, onCheckedChange = { viewModel.defaultAccount.value = it } diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt index bcb2bd72..b36c0310 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountsScreen.kt @@ -57,7 +57,6 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import com.tutpro.baresip.CustomElements.AlertDialog -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.verticalScrollbar fun NavGraphBuilder.accountsScreenRoute(navController: NavController) { @@ -283,11 +282,12 @@ fun NewAccount(navController: NavController) { Icon( Icons.Outlined.Clear, contentDescription = "Clear", - modifier = Modifier.clickable { newAor = "" } + modifier = Modifier.clickable { newAor = "" }, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) } }, - label = { LabelText(stringResource(R.string.new_account)) }, + label = { Text(stringResource(R.string.new_account)) }, textStyle = TextStyle(fontSize = 18.sp), keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Text, @@ -303,8 +303,8 @@ fun NewAccount(navController: NavController) { focusManager.clearFocus() } }, - containerColor = MaterialTheme.colorScheme.secondaryContainer, - contentColor = MaterialTheme.colorScheme.onSecondaryContainer + containerColor = MaterialTheme.colorScheme.secondary, + contentColor = MaterialTheme.colorScheme.onSecondary ) { Icon( imageVector = Icons.Filled.Add, diff --git a/app/src/main/kotlin/com/tutpro/baresip/AndroidContactScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AndroidContactScreen.kt index a59a57ca..dc8d61f7 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AndroidContactScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AndroidContactScreen.kt @@ -54,7 +54,6 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import coil.compose.AsyncImage -import com.tutpro.baresip.CustomElements.verticalScrollbar fun NavGraphBuilder.androidContactScreenRoute(navController: NavController, viewModel: ViewModel) { composable( diff --git a/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt index 993c7300..6c201aa5 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AudioScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.Switch @@ -52,7 +53,6 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import com.tutpro.baresip.CustomElements.AlertDialog -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.verticalScrollbar fun NavGraphBuilder.audioScreenRoute( @@ -83,12 +83,12 @@ private fun AudioScreen( ) { Scaffold( modifier = Modifier.fillMaxSize().imePadding(), - containerColor = LocalCustomColors.current.background, + containerColor = MaterialTheme.colorScheme.background, topBar = { Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding( top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding() ) @@ -101,10 +101,10 @@ private fun AudioScreen( ) }, colors = TopAppBarDefaults.topAppBarColors( - containerColor = LocalCustomColors.current.primary, - navigationIconContentColor = LocalCustomColors.current.onPrimary, - titleContentColor = LocalCustomColors.current.onPrimary, - actionIconContentColor = LocalCustomColors.current.onPrimary + containerColor = MaterialTheme.colorScheme.primary, + navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, + titleContentColor = MaterialTheme.colorScheme.onPrimary, + actionIconContentColor = MaterialTheme.colorScheme.onPrimary ), navigationIcon = { IconButton(onClick = onBack) { @@ -200,14 +200,12 @@ private fun CallVolume() { ) { val ctx = LocalContext.current Text(text = stringResource(R.string.default_call_volume), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.default_call_volume) alertMessage.value = ctx.getString(R.string.default_call_volume_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, fontSize = 18.sp) val isDropDownExpanded = remember { mutableStateOf(false) @@ -225,10 +223,8 @@ private fun CallVolume() { isDropDownExpanded.value = true } ) { - Text(text = volNames[itemPosition.intValue], - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = volNames[itemPosition.intValue]) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -245,10 +241,7 @@ private fun CallVolume() { newCallVolume = volValues[index] }) if (index < 10) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) } } } @@ -280,10 +273,8 @@ private fun MicGain() { alertMessage.value = ctx.getString(R.string.microphone_gain_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText - ), - label = { LabelText(stringResource(R.string.microphone_gain)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.microphone_gain)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -298,14 +289,12 @@ private fun SpeakerPhone() { ) { val ctx = LocalContext.current Text(text = stringResource(R.string.speaker_phone), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.speaker_phone) alertMessage.value = ctx.getString(R.string.speaker_phone_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, fontSize = 18.sp) var speakerPhone by remember { mutableStateOf(BaresipService.speakerPhone) } Switch( @@ -326,7 +315,6 @@ private fun AudioModules() { ) { val ctx = LocalContext.current Text(text = stringResource(R.string.audio_modules_title), - color = LocalCustomColors.current.itemText, fontSize = 18.sp, modifier = Modifier.clickable { alertTitle.value = ctx.getString(R.string.audio_modules_title) @@ -338,9 +326,7 @@ private fun AudioModules() { verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 18.dp, end = 10.dp) ) { - Text(text = String.format(ctx.getString(R.string.bullet_item), module), - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + Text(text = String.format(ctx.getString(R.string.bullet_item), module), fontSize = 18.sp) Spacer(modifier = Modifier.weight(1f)) var checked by remember { mutableStateOf(oldAudioModules.contains("${module}.so")) } Switch( @@ -379,9 +365,8 @@ private fun OpusBitRate() { alertMessage.value = ctx.getString(R.string.opus_bit_rate_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.opus_bit_rate)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.opus_bit_rate)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -411,9 +396,8 @@ private fun OpusPacketLoss() { alertMessage.value = ctx.getString(R.string.opus_packet_loss_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.opus_packet_loss)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.opus_packet_loss)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -443,9 +427,8 @@ private fun AudioDelay() { alertMessage.value = ctx.getString(R.string.audio_delay_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.audio_delay)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.audio_delay)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -460,14 +443,12 @@ private fun ToneCountry() { ) { val ctx = LocalContext.current Text(text = stringResource(R.string.tone_country), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.tone_country) alertMessage.value = ctx.getString(R.string.tone_country_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, fontSize = 18.sp) val isDropDownExpanded = remember { mutableStateOf(false) @@ -485,10 +466,8 @@ private fun ToneCountry() { isDropDownExpanded.value = true } ) { - Text(text = countryNames[itemPosition.intValue], - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = countryNames[itemPosition.intValue]) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -505,10 +484,7 @@ private fun ToneCountry() { newToneCountry = countryValues[index] }) if (index < 10) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) } } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt index f0ee3cee..c0bcd3d0 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipContactScreen.kt @@ -447,9 +447,7 @@ private fun ContactName(name: String, new: Boolean, onNameChange: (String) -> Un modifier = Modifier .fillMaxWidth() .focusRequester(focusRequester), - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = MaterialTheme.colorScheme.onBackground - ), + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), label = { Text(stringResource(R.string.contact_name)) }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Text, @@ -469,9 +467,7 @@ private fun ContactUri(uri: String, onUriChange: (String) -> Unit) { placeholder = { Text(stringResource(R.string.user_domain_or_number)) }, onValueChange = onUriChange, modifier = Modifier.fillMaxWidth(), - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = MaterialTheme.colorScheme.onBackground - ), + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), label = { Text(stringResource(R.string.sip_or_tel_uri)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) @@ -486,8 +482,7 @@ private fun Favorite(ctx: Context, favorite: Boolean, onFavoriteChange: (Boolean ) { Text( text = stringResource(R.string.favorite), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.favorite) alertMessage.value = ctx.getString(R.string.favorite_help) @@ -512,7 +507,7 @@ private fun Android(android: Boolean, onAndroidChange: (Boolean) -> Unit) { Text( text = stringResource(R.string.android), modifier = Modifier.weight(1f), - color = MaterialTheme.colorScheme.onBackground + //color = MaterialTheme.colorScheme.onBackground ) Switch( checked = android, diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallDetailsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/CallDetailsScreen.kt index 23f72a3d..a59953f6 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallDetailsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallDetailsScreen.kt @@ -71,12 +71,12 @@ private fun CallDetailsScreen(navController: NavController, callRow: CallRow) { Scaffold( modifier = Modifier.fillMaxSize().imePadding(), - containerColor = LocalCustomColors.current.background, + containerColor = MaterialTheme.colorScheme.background, topBar = { Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding(top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding()) ) { TopAppBar( @@ -132,7 +132,6 @@ private fun Peer(ctx: Context, callRow: CallRow) { modifier = Modifier.fillMaxWidth(), fontSize = 18.sp, fontWeight = FontWeight.SemiBold, - color = LocalCustomColors.current.itemText, textAlign = TextAlign.Center ) } @@ -141,21 +140,18 @@ private fun Peer(ctx: Context, callRow: CallRow) { private fun Details(ctx: Context, details: ArrayList
) { Row(verticalAlignment = Alignment.CenterVertically) { Text(text = stringResource(R.string.direction), - color = LocalCustomColors.current.itemText, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.width(96.dp) ) Spacer(modifier = Modifier.width(6.dp)) Text(text = stringResource(R.string.time), - color = LocalCustomColors.current.itemText, fontSize = 16.sp, fontWeight = FontWeight.SemiBold ) Spacer(modifier = Modifier.weight(1f)) Text(text = stringResource(R.string.calls_duration), modifier = Modifier.padding(end = 12.dp), - color = LocalCustomColors.current.itemText, fontSize = 16.sp, fontWeight = FontWeight.SemiBold ) @@ -167,7 +163,7 @@ private fun Details(ctx: Context, details: ArrayList
) { state = lazyListState, width = 4.dp ) - .background(LocalCustomColors.current.background), + .background(MaterialTheme.colorScheme.background), state = lazyListState, verticalArrangement = Arrangement.spacedBy(12.dp), ) { @@ -235,7 +231,7 @@ private fun startTime(detail: Details): String { durationText = DateUtils.formatElapsedTime(duration) } } - Text(text = startTimeText, color = LocalCustomColors.current.itemText) + Text(text = startTimeText) return durationText } @@ -256,7 +252,7 @@ private fun Duration(ctx: Context, detail: Details, durationText: String) { if (recording[0] != "") { Text( text = durationText, - color = LocalCustomColors.current.accent, + color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(end = 12.dp) .clickable(onClick = { if (!decPlayer.isPlaying && !encPlayer.isPlaying) { @@ -334,9 +330,7 @@ private fun Duration(ctx: Context, detail: Details, durationText: String) { }) ) } else { - Text(text = durationText, - modifier = Modifier.padding(end = 12.dp), - color = LocalCustomColors.current.itemText) + Text(text = durationText, modifier = Modifier.padding(end = 12.dp)) } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt b/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt index 206aa31b..8ec6e67e 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallHistory.kt @@ -19,7 +19,7 @@ class CallHistoryNew(val aor: String, val peerUri: String, val direction: String fun add() { BaresipService.callHistory.add(this) - var aorSpecificHistory = BaresipService.callHistory.filter { it.aor == this.aor } + val aorSpecificHistory = BaresipService.callHistory.filter { it.aor == this.aor } if (aorSpecificHistory.size > CALL_HISTORY_SIZE) { val oldestToRemove = aorSpecificHistory.first() if (oldestToRemove.recording[0].isNotEmpty()) diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt index 2851bff5..3c4d9079 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt @@ -98,12 +98,12 @@ private fun CallsScreen(navController: NavController, viewModel: ViewModel, aor: Scaffold( modifier = Modifier.fillMaxSize().imePadding(), - containerColor = LocalCustomColors.current.background, + containerColor = MaterialTheme.colorScheme.background, topBar = { Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding(top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding()) ) { TopAppBar(navController, account, callHistory) @@ -237,7 +237,6 @@ private fun Account(account: Account) { .padding(top = 8.dp), fontSize = 18.sp, fontWeight = FontWeight.SemiBold, - color = LocalCustomColors.current.itemText, textAlign = TextAlign.Center ) } @@ -399,13 +398,12 @@ private fun Calls( count++ } if (count > 3) - Text("...", color = MaterialTheme.colorScheme.onPrimaryContainer) + Text("...", color = MaterialTheme.colorScheme.onBackground) Text(text = Utils.friendlyUri(ctx, peerUri, account), modifier = Modifier.padding(start = 8.dp), fontSize = 18.sp, maxLines = 1, - overflow = TextOverflow.Ellipsis, - color = MaterialTheme.colorScheme.onPrimaryContainer + overflow = TextOverflow.Ellipsis ) } } @@ -418,7 +416,7 @@ private fun Calls( color = if (recordings) MaterialTheme.colorScheme.error else - MaterialTheme.colorScheme.onPrimaryContainer, + MaterialTheme.colorScheme.onBackground, modifier = Modifier .padding(end = 16.dp) .clickable(onClick = { diff --git a/app/src/main/kotlin/com/tutpro/baresip/ChatScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/ChatScreen.kt index 743c5f8c..a476f2d4 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/ChatScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/ChatScreen.kt @@ -85,7 +85,6 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.tutpro.baresip.CustomElements.AlertDialog -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.verticalScrollbar import kotlinx.coroutines.launch import java.lang.String.format @@ -521,10 +520,12 @@ private fun NewMessage( modifier = Modifier.clickable { newMessage.value = TextFieldValue("") viewModel.updateAorPeerMessage(aor, peerUri, "") - } + }, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) - } }, - label = { LabelText(stringResource(R.string.new_message)) }, + } + }, + label = { Text(stringResource(R.string.new_message)) }, textStyle = TextStyle(fontSize = 18.sp), keyboardOptions = KeyboardOptions( capitalization = KeyboardCapitalization.Sentences, @@ -589,8 +590,8 @@ private fun NewMessage( } } }, - containerColor = MaterialTheme.colorScheme.secondaryContainer, - contentColor = MaterialTheme.colorScheme.onSecondaryContainer + containerColor = MaterialTheme.colorScheme.secondary, + contentColor = MaterialTheme.colorScheme.onSecondary ) { Icon( imageVector = Icons.AutoMirrored.Filled.Send, diff --git a/app/src/main/kotlin/com/tutpro/baresip/ChatsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/ChatsScreen.kt index 1ba8f4ff..59108062 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/ChatsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/ChatsScreen.kt @@ -85,7 +85,6 @@ import coil.compose.AsyncImage import com.tutpro.baresip.BaresipService.Companion.contactNames import com.tutpro.baresip.CustomElements.AlertDialog import com.tutpro.baresip.CustomElements.DropdownMenu -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.SelectableAlertDialog import com.tutpro.baresip.CustomElements.verticalScrollbar import java.text.DateFormat @@ -252,10 +251,7 @@ private fun ChatsContent( private fun Account(account: Account) { Text( text = stringResource(R.string.account) + " " + account.text(), - modifier = Modifier - .fillMaxWidth() - .padding(top = 8.dp, bottom = 8.dp), - color = LocalCustomColors.current.itemText, + modifier = Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp), fontSize = 18.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center @@ -345,7 +341,7 @@ private fun Chats( RoundedCornerShape(20.dp, 10.dp, 50.dp, 20.dp) } val borderStroke = if (account.unreadMessages && Message.unreadMessagesFromPeer(aor, message.peerUri)) { - BorderStroke(width = 2.dp, color = LocalCustomColors.current.alert) + BorderStroke(width = 2.dp, color = MaterialTheme.colorScheme.error) } else { null } @@ -506,21 +502,20 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc modifier = Modifier .shadow(8.dp, RoundedCornerShape(8.dp)) .background( - LocalCustomColors.current.grayLight, + color = MaterialTheme.colorScheme.surfaceContainer, shape = RoundedCornerShape(8.dp) ) .animateContentSize() ) { - Box(modifier = Modifier - .fillMaxWidth() - .heightIn(max = 150.dp) + Box(modifier = Modifier.fillMaxWidth().heightIn(max = 150.dp) ) { LazyColumn( modifier = Modifier .fillMaxWidth() .heightIn(max = 180.dp) .verticalScrollbar( - state = lazyListState + state = lazyListState, + color = MaterialTheme.colorScheme.outlineVariant ), horizontalAlignment = Alignment.Start, state = lazyListState @@ -541,7 +536,7 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc Text( text = suggestion, modifier = Modifier.fillMaxWidth(), - color = LocalCustomColors.current.grayDark, + color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp ) } @@ -577,22 +572,17 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc Icon( Icons.Outlined.Clear, contentDescription = null, - modifier = Modifier - .clickable { - if (showSuggestions) - showSuggestions = false - else - newPeer = "" - } + modifier = Modifier.clickable { + if (showSuggestions) + showSuggestions = false + else + newPeer = "" + }, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) }, - label = { - LabelText(stringResource(R.string.new_chat_peer)) - }, - textStyle = TextStyle( - fontSize = 18.sp, - color = LocalCustomColors.current.itemText - ), + label = { Text(stringResource(R.string.new_chat_peer)) }, + textStyle = TextStyle(fontSize = 18.sp), keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Text, imeAction = ImeAction.Done @@ -622,8 +612,8 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc newPeer = "" focusManager.clearFocus() }, - containerColor = MaterialTheme.colorScheme.secondaryContainer, - contentColor = MaterialTheme.colorScheme.onSecondaryContainer + containerColor = MaterialTheme.colorScheme.secondary, + contentColor = MaterialTheme.colorScheme.onSecondary ) { Icon( imageVector = Icons.Filled.Add, diff --git a/app/src/main/kotlin/com/tutpro/baresip/CodecsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/CodecsScreen.kt index 24b95930..3937ebd8 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CodecsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CodecsScreen.kt @@ -22,6 +22,7 @@ import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem import androidx.compose.material3.ListItemDefaults +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar @@ -36,6 +37,7 @@ import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshots.SnapshotStateList import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource @@ -101,12 +103,12 @@ private fun CodecsScreen( Scaffold( modifier = Modifier.fillMaxSize().imePadding(), - containerColor = LocalCustomColors.current.background, + containerColor = MaterialTheme.colorScheme.background, topBar = { Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding( top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding() ) @@ -122,10 +124,10 @@ private fun CodecsScreen( ) }, colors = TopAppBarDefaults.topAppBarColors( - containerColor = LocalCustomColors.current.primary, - navigationIconContentColor = LocalCustomColors.current.onPrimary, - titleContentColor = LocalCustomColors.current.onPrimary, - actionIconContentColor = LocalCustomColors.current.onPrimary + containerColor = MaterialTheme.colorScheme.primary, + navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, + titleContentColor = MaterialTheme.colorScheme.onPrimary, + actionIconContentColor = MaterialTheme.colorScheme.onPrimary ), windowInsets = WindowInsets(0, 0, 0, 0), navigationIcon = { @@ -207,7 +209,7 @@ private fun CodecsContent( Column( modifier = Modifier .fillMaxWidth() - .background(LocalCustomColors.current.background) + .background(MaterialTheme.colorScheme.background) .padding(contentPadding) .padding(bottom = 16.dp), ) { @@ -248,9 +250,9 @@ private fun Codecs(codecs: SnapshotStateList, onUpdateCodecs: (List, onUpdateCodecs: (List 0) HorizontalDivider( - color = LocalCustomColors.current.gray, + color = MaterialTheme.colorScheme.outlineVariant, modifier = Modifier.padding(horizontal = 12.dp), thickness = 1.dp ) diff --git a/app/src/main/kotlin/com/tutpro/baresip/ContactsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/ContactsScreen.kt index 5e6b483d..9958dff6 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/ContactsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/ContactsScreen.kt @@ -118,8 +118,8 @@ private fun ContactsScreen(navController: NavController, viewModel: ViewModel) { SmallFloatingActionButton( modifier = Modifier.offset(x = 2.dp), onClick = { navController.navigate("baresip_contact//new") }, - containerColor = MaterialTheme.colorScheme.secondaryContainer, - contentColor = MaterialTheme.colorScheme.onSecondaryContainer + containerColor = MaterialTheme.colorScheme.secondary, + contentColor = MaterialTheme.colorScheme.onSecondary ) { Icon(imageVector = Icons.Filled.Add, modifier = Modifier.size(36.dp), @@ -148,8 +148,6 @@ private fun ContactsContent( val neutralText = remember { mutableStateOf("") } val neutralAction = remember { mutableStateOf({}) } - Log.d("THEME_TEST", "ContactsScreen Primary: ${MaterialTheme.colorScheme.primary}") - if (showDialog.value) AlertDialog( showDialog = showDialog, @@ -225,7 +223,6 @@ private fun ContactsContent( Text(text = name, fontSize = 20.sp, fontStyle = if (contact.favorite()) FontStyle.Italic else FontStyle.Normal, - color = LocalCustomColors.current.itemText, modifier = Modifier .weight(1f) .padding(start = 10.dp) @@ -309,7 +306,6 @@ private fun ContactsContent( Text(text = name, fontSize = 20.sp, fontStyle = if (contact.favorite()) FontStyle.Italic else FontStyle.Normal, - color = LocalCustomColors.current.itemText, modifier = Modifier .weight(1f) .padding(start = 10.dp, top = 4.dp, bottom = 4.dp) diff --git a/app/src/main/kotlin/com/tutpro/baresip/CustomColors.kt b/app/src/main/kotlin/com/tutpro/baresip/CustomColors.kt index fe9c177a..a580e69f 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CustomColors.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CustomColors.kt @@ -35,7 +35,6 @@ data class CustomColors( val primaryLight: Color = Color.Unspecified, val secondaryDark: Color = Color.Unspecified, val secondaryLight: Color = Color.Unspecified, - val gray: Color = Color.Unspecified, val grayDark: Color = Color.Unspecified, val grayLight: Color = Color.Unspecified, val accent: Color = Color.Unspecified, @@ -47,7 +46,6 @@ data class CustomColors( val dark: Color = Color.Unspecified, val spinnerText: Color = Color.Unspecified, val spinnerDropdown: Color = Color.Unspecified, - val spinnerDivider: Color = Color.Unspecified, val itemText: Color = Color.Unspecified, val alertText: Color = Color.Unspecified, val codec: Color = Color.Unspecified, @@ -69,7 +67,7 @@ val light_tertiary = Color(0xFF9885B5) val light_on_tertiary = Color(0xffe0e0e0) val light_tertiary_container = Color(0xFFDAD2E6) val light_on_tertiary_container = Color(0xFF2B2533) -val light_error = Color(0xFFF77445) +val light_error = Color(0xFFB3261E) // Color(0xFFF77445) val light_on_error = Color(0xffe0e0e0) val light_error_container = Color(0xFFE6BFB1) val light_on_error_container = Color(0xFF33180E) @@ -84,13 +82,11 @@ val light_primary_dark = Color(0xff0073c9) val light_primary_light = Color(0xff6ad2ff) val light_secondary_dark = Color(0xFF008873) val light_secondary_light = Color(0xff5cecd2) -val light_gray = Color(0xff9e9e9e) val light_gray_dark = Color(0xFF424242) val light_gray_light = Color(0xffe0e0e0) val light_accent = Color(0xFFF77445) val light_light = Color(0xfffcfcfc) val light_dark = Color(0xFF383838) -val light_spinner_divider = light_gray val light_item_text = light_dark val light_textfield_background = light_gray_light val light_card_background = light_gray_light @@ -130,7 +126,6 @@ val dark_gray_light = Color(0xffe0e0e0) val dark_accent = Color(0xFFF77445) val dark_light = dark_gray_light val dark_dark = Color(0xFF121212) -val dark_spinner_divider = dark_gray_dark val dark_item_text = dark_gray_light val dark_textfield_background = dark_gray val dark_card_background = dark_gray_dark @@ -166,13 +161,11 @@ val LightCustomColors = CustomColors( primaryLight = light_primary_light, secondaryDark = light_secondary_dark, secondaryLight = light_secondary_light, - gray = light_gray, grayDark = light_gray_dark, grayLight = light_gray_light, accent = light_accent, light = light_light, dark = light_dark, - spinnerDivider = light_spinner_divider, itemText = light_item_text, cardBackground = light_card_background, textFieldBackground = light_textfield_background, @@ -209,13 +202,11 @@ val DarkCustomColors = CustomColors( primaryLight = dark_primary_light, secondaryDark = dark_secondary_dark, secondaryLight = dark_secondary_light, - gray = dark_gray, grayDark = dark_gray_dark, grayLight = dark_gray_light, accent = dark_accent, light = dark_light, dark = dark_dark, - spinnerDivider = dark_spinner_divider, itemText = dark_item_text, cardBackground = dark_card_background, textFieldBackground = dark_textfield_background, diff --git a/app/src/main/kotlin/com/tutpro/baresip/CustomElements.kt b/app/src/main/kotlin/com/tutpro/baresip/CustomElements.kt index 96a26f11..dbe7e2ff 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CustomElements.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CustomElements.kt @@ -72,40 +72,17 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.window.DialogProperties object CustomElements { - @Composable - fun LabelText( - text: String, - modifier: Modifier = Modifier, - color: Color = LocalCustomColors.current.itemText, - fontSize: TextUnit = 16.sp, - fontWeight: FontWeight = FontWeight.Normal, - textAlign: TextAlign? = null, - maxLines: Int = 1, - ) { - Text( - text = text, - modifier = modifier, - color = color, - fontSize = fontSize, - fontWeight = fontWeight, - textAlign = textAlign, - maxLines = maxLines - ) - } - @Composable fun Button( onClick: () -> Unit, @@ -214,7 +191,7 @@ object CustomElements { state: ScrollState, scrollbarWidth: Dp = 4.dp, alwaysShow: Boolean = true, - color: Color = LocalCustomColors.current.gray + color: Color = MaterialTheme.colorScheme.outlineVariant ): Modifier { val alpha by animateFloatAsState( targetValue = if(state.isScrollInProgress || alwaysShow) 1f else 0f, @@ -242,7 +219,7 @@ object CustomElements { state: LazyListState, width: Dp = 8.dp, alwaysShow: Boolean = true, - color: Color = LocalCustomColors.current.gray + color: Color = MaterialTheme.colorScheme.outlineVariant ): Modifier { val targetAlpha = if (state.isScrollInProgress || alwaysShow) 1f else 0f val duration = if (state.isScrollInProgress) 150 else 500 diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt index 4cd068e4..32e4477d 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt @@ -71,7 +71,6 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Scaffold import androidx.compose.material3.Switch import androidx.compose.material3.Text @@ -129,7 +128,6 @@ import com.tutpro.baresip.BaresipService.Companion.uas import com.tutpro.baresip.BaresipService.Companion.uasStatus import com.tutpro.baresip.CustomElements.AlertDialog import com.tutpro.baresip.CustomElements.DropdownMenu -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.PasswordDialog import com.tutpro.baresip.CustomElements.SelectableAlertDialog import com.tutpro.baresip.CustomElements.verticalScrollbar @@ -988,10 +986,10 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na .height(50.dp) .fillMaxWidth(), colors = ButtonColors( - containerColor = LocalCustomColors.current.grayLight, - contentColor = LocalCustomColors.current.dark, - disabledContainerColor = LocalCustomColors.current.grayLight, - disabledContentColor = LocalCustomColors.current.dark + containerColor = MaterialTheme.colorScheme.surfaceVariant, + contentColor = MaterialTheme.colorScheme.onSurfaceVariant, + disabledContainerColor = MaterialTheme.colorScheme.surfaceVariant, + disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant ), shape = RoundedCornerShape(12.dp), contentPadding = PaddingValues(horizontal = 10.dp) @@ -1037,8 +1035,8 @@ private fun AccountSpinner(ctx: Context, viewModel: ViewModel, navController: Na colors = ButtonColors( containerColor = MaterialTheme.colorScheme.surfaceVariant, contentColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledContainerColor = LocalCustomColors.current.grayLight, - disabledContentColor = LocalCustomColors.current.dark + disabledContainerColor = MaterialTheme.colorScheme.surfaceVariant, + disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant ), shape = RoundedCornerShape(12.dp), contentPadding = PaddingValues(horizontal = 10.dp) @@ -1149,8 +1147,10 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { value = callUri.value, enabled = callUriEnabled.value, singleLine = true, - colors = OutlinedTextFieldDefaults.colors( - disabledBorderColor = OutlinedTextFieldDefaults.colors().unfocusedIndicatorColor), + //colors = OutlinedTextFieldDefaults.colors( + // focusedBorderColor = MaterialTheme.colorScheme.primary, + // unfocusedBorderColor = MaterialTheme.colorScheme.outline, + //), onValueChange = { if (it != callUri.value) { callUri.value = it @@ -1164,13 +1164,13 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { if (callUriEnabled.value && callUri.value.isNotEmpty()) Icon(Icons.Outlined.Clear, contentDescription = null, - modifier = Modifier - .clickable { - if (showSuggestions.value) - showSuggestions.value = false - else - callUri.value = "" - } + modifier = Modifier.clickable { + if (showSuggestions.value) + showSuggestions.value = false + else + callUri.value = "" + }, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) }, modifier = Modifier @@ -1183,16 +1183,8 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { if (account.numericKeypad) viewModel.updateDialpadIcon(R.drawable.dialpad_on) }, - label = { - LabelText( - text = callUriLabel.value, - fontSize = 18.sp, - ) - }, - textStyle = TextStyle( - fontSize = 18.sp, - color = LocalCustomColors.current.itemText - ), + label = { Text(text = callUriLabel.value, fontSize = 18.sp) }, + textStyle = TextStyle(fontSize = 18.sp), keyboardOptions = if (dialpadIcon == R.drawable.dialpad_on) KeyboardOptions(keyboardType = KeyboardType.Phone) else @@ -1204,7 +1196,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { .fillMaxWidth() .shadow(8.dp, RoundedCornerShape(8.dp)) .background( - LocalCustomColors.current.grayLight, + color = MaterialTheme.colorScheme.surfaceContainer, shape = RoundedCornerShape(8.dp) ) .animateContentSize() @@ -1217,7 +1209,8 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { modifier = Modifier .fillMaxWidth() .verticalScrollbar( - state = lazyListState + state = lazyListState, + color = MaterialTheme.colorScheme.outlineVariant ), horizontalAlignment = Alignment.Start, state = lazyListState @@ -1238,7 +1231,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { Text( text = suggestion, modifier = Modifier.fillMaxWidth(), - color = LocalCustomColors.current.grayDark, + color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp ) } @@ -1249,7 +1242,7 @@ private fun CallUriRow(ctx: Context, viewModel: ViewModel) { } } if (showCallTimer.value) { - val textColor = LocalCustomColors.current.itemText.toArgb() + val textColor = MaterialTheme.colorScheme.onBackground.toArgb() var chronometerInstance: Chronometer? = null AndroidView( factory = { context -> @@ -1499,7 +1492,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { .padding(top = 16.dp, start = 16.dp, end = 16.dp, bottom = 0.dp), shape = RoundedCornerShape(16.dp), colors = CardDefaults.cardColors( - containerColor = LocalCustomColors.current.cardBackground + containerColor = MaterialTheme.colorScheme.surfaceContainer ) ) { Column(modifier = Modifier.padding(16.dp)) { @@ -1540,23 +1533,16 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { showSuggestions.value = false else transferUri = "" - } + }, + tint = MaterialTheme.colorScheme.onSurfaceVariant ) }, modifier = Modifier .fillMaxWidth() - .padding( - start = 4.dp, - end = 4.dp, - top = 12.dp, - bottom = 2.dp - ) + .padding(start = 4.dp, end = 4.dp, top = 12.dp, bottom = 2.dp) .focusRequester(focusRequester), - label = { LabelText(stringResource(R.string.transfer_destination)) }, - textStyle = TextStyle( - fontSize = 18.sp, - color = LocalCustomColors.current.itemText - ), + label = { Text(stringResource(R.string.transfer_destination)) }, + textStyle = TextStyle(fontSize = 18.sp), keyboardOptions = if (dialpadIcon == R.drawable.dialpad_on) KeyboardOptions(keyboardType = KeyboardType.Phone) else @@ -1568,7 +1554,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { .fillMaxWidth() .shadow(8.dp, RoundedCornerShape(8.dp)) .background( - LocalCustomColors.current.grayLight, + color = MaterialTheme.colorScheme.surfaceContainer, shape = RoundedCornerShape(8.dp) ) .animateContentSize() @@ -1581,7 +1567,8 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { modifier = Modifier .fillMaxWidth() .verticalScrollbar( - state = lazyListState + state = lazyListState, + color = MaterialTheme.colorScheme.outlineVariant ), horizontalAlignment = Alignment.Start, state = lazyListState, @@ -1602,7 +1589,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { Text( text = suggestion, modifier = Modifier.fillMaxWidth(), - color = LocalCustomColors.current.grayDark, + color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp ) } @@ -1619,7 +1606,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { Row(verticalAlignment = Alignment.CenterVertically) { Text( text = stringResource(R.string.blind), - color = LocalCustomColors.current.alert, + color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(8.dp), ) Switch( @@ -1633,7 +1620,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { Row(verticalAlignment = Alignment.CenterVertically) { Text( text = stringResource(R.string.attended), - color = LocalCustomColors.current.alert, + color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(8.dp), ) Switch( @@ -1659,7 +1646,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { ) { Text( text = stringResource(R.string.cancel), - color = LocalCustomColors.current.gray + color = MaterialTheme.colorScheme.onSurfaceVariant ) } TextButton( @@ -1737,7 +1724,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { .focusRequester(focusRequester), enabled = dtmfEnabled.value, textStyle = TextStyle(fontSize = 16.sp), - label = { LabelText(stringResource(R.string.dtmf)) }, + label = { Text(stringResource(R.string.dtmf)) }, singleLine = true ) LaunchedEffect(shouldRequestFocus) { @@ -1836,8 +1823,7 @@ private fun OnHoldNotice() { ) { Text( text = stringResource(R.string.call_is_on_hold), - fontSize = 18.sp, - color = LocalCustomColors.current.itemText, + fontSize = 18.sp ) } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt index e1a48854..c8b2eed2 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt @@ -37,9 +37,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.Check @@ -81,7 +79,6 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import com.tutpro.baresip.CustomElements.AlertDialog -import com.tutpro.baresip.CustomElements.LabelText import com.tutpro.baresip.CustomElements.verticalScrollbar import com.tutpro.baresip.Utils.copyInputStreamToFile import java.io.File @@ -151,14 +148,11 @@ private fun SettingsScreen( } Scaffold( - modifier = Modifier - .fillMaxSize() - .imePadding(), + modifier = Modifier.fillMaxSize().imePadding(), containerColor = MaterialTheme.colorScheme.background, topBar = { Column( - modifier = Modifier - .fillMaxWidth() + modifier = Modifier.fillMaxWidth() .background(MaterialTheme.colorScheme.background) .padding( top = WindowInsets.statusBars.asPaddingValues().calculateTopPadding() @@ -264,9 +258,7 @@ private fun SettingsContent( @Composable fun StartAutomatically() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -279,8 +271,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.start_automatically_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val startAutomatically by viewModel.autoStart.collectAsState() Switch( checked = startAutomatically, @@ -314,9 +306,7 @@ private fun SettingsContent( @Composable fun ListenAddress() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start, ) { @@ -336,9 +326,8 @@ private fun SettingsContent( showAlert.value = true }, singleLine = true, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.listen_address)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.listen_address)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -347,10 +336,7 @@ private fun SettingsContent( @Composable fun AddressFamily() { Row( - Modifier - .fillMaxWidth() - .padding(top = 12.dp) - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(top = 12.dp).padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -364,8 +350,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.address_family_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } @@ -380,10 +366,8 @@ private fun SettingsContent( isDropDownExpanded.value = true } ) { - Text(text = familyNames[itemPosition.intValue], - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = familyNames[itemPosition.intValue]) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -399,10 +383,7 @@ private fun SettingsContent( viewModel.addressFamily.value = familyValues[index] }) if (index < 2) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) } } } @@ -412,9 +393,7 @@ private fun SettingsContent( @Composable fun DnsServers() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -432,10 +411,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.dns_servers_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText - ), - label = { LabelText(stringResource(R.string.dns_servers)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.dns_servers)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -482,9 +459,7 @@ private fun SettingsContent( val showAlertDialog = remember { mutableStateOf(false) } Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -497,8 +472,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.tls_certificate_file_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val tlsCertificateFile by viewModel.tlsCertificateFile.collectAsState() Switch( checked = tlsCertificateFile, @@ -560,29 +535,24 @@ private fun SettingsContent( @Composable fun VerifyServer() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { val ctx = LocalContext.current Text(text = stringResource(R.string.verify_server), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.verify_server) alertMessage.value = ctx.getString(R.string.verify_server_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val verifyServer by viewModel.verifyServer.collectAsState() Switch( checked = verifyServer, - onCheckedChange = { - viewModel.verifyServer.value = it - } + onCheckedChange = { viewModel.verifyServer.value = it } ) } } @@ -620,23 +590,20 @@ private fun SettingsContent( } Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { val ctx = LocalContext.current Text(text = stringResource(R.string.tls_ca_file), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.tls_ca_file) alertMessage.value = ctx.getString(R.string.tls_ca_file_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val caFile by viewModel.caFile.collectAsState() Switch( checked = caFile, @@ -690,9 +657,7 @@ private fun SettingsContent( @Composable fun UserAgent() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -701,9 +666,7 @@ private fun SettingsContent( OutlinedTextField( value = userAgent, placeholder = { Text(stringResource(R.string.user_agent)) }, - onValueChange = { - viewModel.userAgent.value = it - }, + onValueChange = { viewModel.userAgent.value = it }, modifier = Modifier .fillMaxWidth() .clickable { @@ -711,9 +674,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.user_agent_help) showAlert.value = true }, - textStyle = androidx.compose.ui.text.TextStyle( - fontSize = 18.sp, color = LocalCustomColors.current.itemText), - label = { LabelText(stringResource(R.string.user_agent)) }, + textStyle = androidx.compose.ui.text.TextStyle(fontSize = 18.sp), + label = { Text(stringResource(R.string.user_agent)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -722,20 +684,14 @@ private fun SettingsContent( @Composable fun AudioSettings(navController: NavController) { Row( - Modifier - .fillMaxWidth() - .padding(top = 12.dp), + Modifier.fillMaxWidth().padding(top = 12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { Text( text = stringResource(R.string.audio_settings), - modifier = Modifier - .weight(1f) - .clickable { - navController.navigate("audio") - }, - color = LocalCustomColors.current.itemText, + modifier = Modifier.weight(1f) + .clickable { navController.navigate("audio") }, fontSize = 18.sp, fontWeight = FontWeight. Bold ) @@ -746,10 +702,7 @@ private fun SettingsContent( fun Contacts(activity: Activity) { val showAlertDialog = remember { mutableStateOf(false) } Row( - Modifier - .fillMaxWidth() - .padding(top = 12.dp) - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(top = 12.dp).padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -762,8 +715,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.contacts_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val isDropDownExpanded = remember { mutableStateOf(false) } @@ -790,10 +743,8 @@ private fun SettingsContent( isDropDownExpanded.value = true } ) { - Text(text = contactNames[itemPosition.intValue], - color = LocalCustomColors.current.itemText) - CustomElements.DrawDrawable(R.drawable.arrow_drop_down, - tint = LocalCustomColors.current.itemText) + Text(text = contactNames[itemPosition.intValue]) + CustomElements.DrawDrawable(R.drawable.arrow_drop_down) } DropdownMenu( expanded = isDropDownExpanded.value, @@ -854,10 +805,7 @@ private fun SettingsContent( } }) if (index < 2) - HorizontalDivider( - thickness = 1.dp, - color = LocalCustomColors.current.itemText - ) + HorizontalDivider(thickness = 1.dp) } } } @@ -895,9 +843,7 @@ private fun SettingsContent( } } Row( - Modifier - .fillMaxWidth() - .padding(top = 12.dp), + Modifier.fillMaxWidth().padding(top = 12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -923,7 +869,6 @@ private fun SettingsContent( intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true) launcher.launch(intent) }, - color = LocalCustomColors.current.itemText, fontSize = 18.sp, fontWeight = FontWeight.Bold ) @@ -933,9 +878,7 @@ private fun SettingsContent( @Composable fun BatteryOptimizations() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -955,8 +898,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.battery_optimizations_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val battery by viewModel.batteryOptimizations.collectAsState() Switch( checked = battery, @@ -972,9 +915,7 @@ private fun SettingsContent( @Composable fun DarkTheme() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -987,14 +928,12 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.dark_theme_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val darkTheme by viewModel.darkTheme.collectAsState() Switch( checked = darkTheme, - onCheckedChange = { - viewModel.darkTheme.value = it - } + onCheckedChange = { viewModel.darkTheme.value = it } ) } } @@ -1002,29 +941,24 @@ private fun SettingsContent( @Composable fun DynamicColors() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { val ctx = LocalContext.current Text(text = stringResource(R.string.dynamic_colors), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.dynamic_colors) alertMessage.value = ctx.getString(R.string.dynamic_colors_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val dynamicColors by viewModel.dynamicColors.collectAsState() Switch( checked = dynamicColors, - onCheckedChange = { - viewModel.dynamicColors.value = it - } + onCheckedChange = { viewModel.dynamicColors.value = it } ) } } @@ -1032,9 +966,7 @@ private fun SettingsContent( @Composable fun ColorBlind() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -1047,23 +979,19 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.colorblind_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val colorblind by viewModel.colorblind.collectAsState() Switch( checked = colorblind, - onCheckedChange = { - viewModel.colorblind.value = it - } + onCheckedChange = { viewModel.colorblind.value = it } ) } } @Composable fun ProximitySensing() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -1076,14 +1004,12 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.proximity_sensing_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val proximitySensing by viewModel.proximitySensing.collectAsState() Switch( checked = proximitySensing, - onCheckedChange = { - viewModel.proximitySensing.value = it - } + onCheckedChange = { viewModel.proximitySensing.value = it } ) } } @@ -1092,9 +1018,7 @@ private fun SettingsContent( @Composable fun DefaultDialer() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -1107,8 +1031,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.default_phone_app_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val defaultDialer by viewModel.defaultDialer.collectAsState() val roleManager = ctx.getSystemService(ROLE_SERVICE) as RoleManager val dialerRoleRequest = rememberLauncherForActivityResult( @@ -1145,29 +1069,24 @@ private fun SettingsContent( @Composable fun Debug() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { val ctx = LocalContext.current Text(text = stringResource(R.string.debug), - modifier = Modifier - .weight(1f) + modifier = Modifier.weight(1f) .clickable { alertTitle.value = ctx.getString(R.string.debug) alertMessage.value = ctx.getString(R.string.debug_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val debug by viewModel.debug.collectAsState() Switch( checked = debug, - onCheckedChange = { - viewModel.debug.value = it - } + onCheckedChange = { viewModel.debug.value = it } ) } } @@ -1175,9 +1094,7 @@ private fun SettingsContent( @Composable fun SipTrace() { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -1190,14 +1107,12 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.sip_trace_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) val sipTrace by viewModel.sipTrace.collectAsState() Switch( checked = sipTrace, - onCheckedChange = { - viewModel.sipTrace.value = it - } + onCheckedChange = { viewModel.sipTrace.value = it } ) } } @@ -1205,9 +1120,7 @@ private fun SettingsContent( @Composable fun Reset(onRestartApp: () -> Unit) { Row( - Modifier - .fillMaxWidth() - .padding(end = 10.dp), + Modifier.fillMaxWidth().padding(end = 10.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -1220,8 +1133,8 @@ private fun SettingsContent( alertMessage.value = ctx.getString(R.string.reset_config_help) showAlert.value = true }, - color = LocalCustomColors.current.itemText, - fontSize = 18.sp) + fontSize = 18.sp + ) var reset by remember { mutableStateOf(false) } Switch( checked = reset, @@ -1256,8 +1169,7 @@ private fun SettingsContent( LazyColumn( state = lazyListState, - modifier = Modifier - .fillMaxWidth() + modifier = Modifier.fillMaxWidth() .padding(contentPadding) .padding(start = 16.dp, end = 4.dp, top = 16.dp, bottom = 8.dp) .verticalScrollbar( diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index c2968299..00524b67 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -1,6 +1,5 @@ - #121212 #0073c9 #00008b #0ca1fd @@ -25,10 +24,4 @@ @color/colorDark @color/colorGray @color/colorGrayDark - @color/colorGrayLight - @color/colorGrayLight - @color/colorSecondaryDark - @color/colorGrayDark - @color/colorSecondaryDark - @color/colorPrimaryLight diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6e1f4bd7..44d0dac9 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,5 @@ - #fcfcfc #0ca1fd #0073c9 #6ad2ff @@ -25,10 +24,4 @@ @color/colorDark @color/colorGrayLight @color/colorGray - @color/colorBlack - @color/colorBlack - @color/colorBlack - @color/colorGrayLight - @color/colorSecondaryDark - @color/colorPrimary