Added support for dynamic colors in all screens

This commit is contained in:
Juha Heinanen
2025-10-15 15:41:34 +03:00
parent 4b00b09683
commit fc9dbca08f
11 changed files with 47 additions and 44 deletions
@@ -144,16 +144,20 @@ private fun AccountScreen(
title = { title = {
Text( Text(
text = acc.text(), text = acc.text(),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
),
navigationIcon = { navigationIcon = {
IconButton(onClick = onBack) { IconButton(onClick = onBack) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null, contentDescription = null,
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -162,14 +166,10 @@ private fun AccountScreen(
IconButton(onClick = checkOnClick) { IconButton(onClick = checkOnClick) {
Icon( Icon(
imageVector = Icons.Filled.Check, imageVector = Icons.Filled.Check,
tint = LocalCustomColors.current.light,
contentDescription = "Check" contentDescription = "Check"
) )
} }
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary
)
) )
} }
} }
@@ -82,22 +82,22 @@ fun AccountsScreen(navController: NavController) {
title = { title = {
Text( Text(
text = stringResource(R.string.accounts), text = stringResource(R.string.accounts),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
),
navigationIcon = { navigationIcon = {
IconButton(onClick = { navController.popBackStack() }) { IconButton(onClick = { navController.popBackStack() }) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null, contentDescription = null,
tint = LocalCustomColors.current.light
) )
} }
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary
),
windowInsets = WindowInsets(0, 0, 0, 0) windowInsets = WindowInsets(0, 0, 0, 0)
) )
} }
@@ -103,12 +103,13 @@ private fun TopAppBar(title: String, navController: NavController) {
title = { title = {
Text( Text(
text = title, text = title,
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
), ),
windowInsets = WindowInsets(0, 0, 0, 0), windowInsets = WindowInsets(0, 0, 0, 0),
navigationIcon = { navigationIcon = {
@@ -116,7 +117,6 @@ private fun TopAppBar(title: String, navController: NavController) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
} }
@@ -231,12 +231,14 @@ private fun TopAppBar(title: String, onBack: () -> Unit, onCheck: () -> Unit) {
title = { title = {
Text( Text(
text = title, text = title,
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
), ),
windowInsets = WindowInsets(0, 0, 0, 0), windowInsets = WindowInsets(0, 0, 0, 0),
navigationIcon = { navigationIcon = {
@@ -244,7 +246,6 @@ private fun TopAppBar(title: String, onBack: () -> Unit, onCheck: () -> Unit) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -252,7 +253,6 @@ private fun TopAppBar(title: String, onBack: () -> Unit, onCheck: () -> Unit) {
IconButton(onClick = onCheck) { IconButton(onClick = onCheck) {
Icon( Icon(
imageVector = Icons.Filled.Check, imageVector = Icons.Filled.Check,
tint = LocalCustomColors.current.light,
contentDescription = "Check" contentDescription = "Check"
) )
} }
@@ -82,12 +82,13 @@ private fun CallDetailsScreen(navController: NavController, callRow: CallRow) {
title = { title = {
Text( Text(
text = stringResource(R.string.call_details), text = stringResource(R.string.call_details),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
), ),
windowInsets = WindowInsets(0, 0, 0, 0), windowInsets = WindowInsets(0, 0, 0, 0),
navigationIcon = { navigationIcon = {
@@ -95,7 +96,6 @@ private fun CallDetailsScreen(navController: NavController, callRow: CallRow) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -148,12 +148,14 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
title = { title = {
Text( Text(
text = stringResource(R.string.call_history), text = stringResource(R.string.call_history),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
), ),
windowInsets = WindowInsets(0, 0, 0, 0), windowInsets = WindowInsets(0, 0, 0, 0),
navigationIcon = { navigationIcon = {
@@ -166,7 +168,6 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -177,7 +178,6 @@ private fun TopAppBar(navController: NavController, account: Account, callHistor
Icon( Icon(
imageVector = Icons.Filled.Menu, imageVector = Icons.Filled.Menu,
contentDescription = "Menu", contentDescription = "Menu",
tint = LocalCustomColors.current.light
) )
} }
CustomElements.DropdownMenu( CustomElements.DropdownMenu(
@@ -222,20 +222,21 @@ private fun TopAppBar(
title = { title = {
Text( Text(
text = format(ctx.getString(R.string.chat_with), Utils.friendlyUri(ctx, peerUri, account)), text = format(ctx.getString(R.string.chat_with), Utils.friendlyUri(ctx, peerUri, account)),
color = LocalCustomColors.current.light,
fontSize = 22.sp, fontSize = 22.sp,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
), ),
navigationIcon = { navigationIcon = {
IconButton(onClick = { backAction(navController, account, peerUri) }) { IconButton(onClick = { backAction(navController, account, peerUri) }) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -261,7 +262,6 @@ private fun TopAppBar(
Icon( Icon(
imageVector = ImageVector.vectorResource(R.drawable.call_small), imageVector = ImageVector.vectorResource(R.drawable.call_small),
contentDescription = "Call", contentDescription = "Call",
tint = LocalCustomColors.current.light
) )
} }
} }
@@ -177,16 +177,20 @@ private fun TopAppBar(
title = { title = {
Text( Text(
text = stringResource(R.string.chats), text = stringResource(R.string.chats),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
),
navigationIcon = { navigationIcon = {
IconButton(onClick = { navController.popBackStack() }) { IconButton(onClick = { navController.popBackStack() }) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null, contentDescription = null,
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -198,7 +202,6 @@ private fun TopAppBar(
Icon( Icon(
imageVector = Icons.Filled.Menu, imageVector = Icons.Filled.Menu,
contentDescription = "Menu", contentDescription = "Menu",
tint = LocalCustomColors.current.light
) )
} }
DropdownMenu ( DropdownMenu (
@@ -221,9 +224,6 @@ private fun TopAppBar(
} }
) )
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary
)
) )
} }
@@ -92,19 +92,19 @@ private fun ContactsScreen(navController: NavController, viewModel: ViewModel) {
title = { title = {
Text( Text(
text = stringResource(R.string.contacts), text = stringResource(R.string.contacts),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary
), ),
navigationIcon = { navigationIcon = {
IconButton(onClick = { navController.popBackStack() }) { IconButton(onClick = { navController.popBackStack() }) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back", contentDescription = "Back",
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -163,16 +163,20 @@ private fun SettingsScreen(
title = { title = {
Text( Text(
text = stringResource(R.string.configuration), text = stringResource(R.string.configuration),
color = LocalCustomColors.current.light,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary,
navigationIconContentColor = LocalCustomColors.current.onPrimary,
titleContentColor = LocalCustomColors.current.onPrimary,
actionIconContentColor = LocalCustomColors.current.onPrimary
),
navigationIcon = { navigationIcon = {
IconButton(onClick = onBack) { IconButton(onClick = onBack) {
Icon( Icon(
imageVector = Icons.AutoMirrored.Filled.ArrowBack, imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = null, contentDescription = null,
tint = LocalCustomColors.current.light
) )
} }
}, },
@@ -181,14 +185,10 @@ private fun SettingsScreen(
IconButton(onClick = checkOnClick) { IconButton(onClick = checkOnClick) {
Icon( Icon(
imageVector = Icons.Filled.Check, imageVector = Icons.Filled.Check,
tint = LocalCustomColors.current.light,
contentDescription = "Check" contentDescription = "Check"
) )
} }
}, },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = LocalCustomColors.current.primary
)
) )
} }
} }
+3
View File
@@ -427,6 +427,9 @@
<string name="tone_country_help">Soitto-, odotus- ja varattuäänien maa</string> <string name="tone_country_help">Soitto-, odotus- ja varattuäänien maa</string>
<string name="dark_theme">Tumma teema</string> <string name="dark_theme">Tumma teema</string>
<string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string> <string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string>
<string name="dynamic_colors">Dynaamiset värit</string>
<string name="dynamic_colors_help">Käytä dynaamisia värejä, jos ne on otettu käyttöön
Android-asetuksissa</string>
<string name="colorblind">Värisokea</string> <string name="colorblind">Värisokea</string>
<string name="colorblind_help">Käytä värisokealle ystävällisiä rekisteröintitilaikoineita</string> <string name="colorblind_help">Käytä värisokealle ystävällisiä rekisteröintitilaikoineita</string>
<string name="proximity_sensing">Läheisyyden tunnistus</string> <string name="proximity_sensing">Läheisyyden tunnistus</string>