add the "will not be translated" message to allColors

This commit is contained in:
Helium314 2025-02-24 18:30:12 +01:00
parent f076d66f93
commit b7aadac07c

View file

@ -159,41 +159,50 @@ fun ColorsScreen(
}, },
), ),
onClickBack = onClickBack, onClickBack = onClickBack,
filteredItems = { search -> shownColors.filter { filteredItems = { search ->
it.displayName.split(" ", "_").any { it.startsWith(search, true) } val result = shownColors.filter { it.displayName.split(" ", "_").any { it.startsWith(search, true) } }
} }, if (moreColors == 2) result.toMutableList<ColorSetting?>().apply { add(0, null) }
else result
},
itemContent = { colorSetting -> itemContent = { colorSetting ->
Row( if (colorSetting == null)
verticalAlignment = Alignment.CenterVertically, Text( // not a colorSetting, but still best done as part of the list
modifier = Modifier stringResource(R.string.all_colors_warning),
.padding(horizontal = 16.dp, vertical = 8.dp) style = MaterialTheme.typography.titleSmall,
.clickable { chosenColor = colorSetting } color = MaterialTheme.colorScheme.onSurfaceVariant
) {
Spacer(
modifier = Modifier
.background(Color(colorSetting.displayColor()), shape = CircleShape)
.size(50.dp)
) )
Column(Modifier else
.weight(1f) Row(
.padding(horizontal = 16.dp)) { verticalAlignment = Alignment.CenterVertically,
Text(colorSetting.displayName) modifier = Modifier
if (colorSetting.auto == true) .padding(horizontal = 16.dp, vertical = 8.dp)
CompositionLocalProvider( .clickable { chosenColor = colorSetting }
LocalTextStyle provides MaterialTheme.typography.bodyMedium, ) {
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant Spacer(
) { modifier = Modifier
Text(stringResource(R.string.auto_user_color)) .background(Color(colorSetting.displayColor()), shape = CircleShape)
} .size(50.dp)
)
Column(Modifier
.weight(1f)
.padding(horizontal = 16.dp)) {
Text(colorSetting.displayName)
if (colorSetting.auto == true)
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyMedium,
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant
) {
Text(stringResource(R.string.auto_user_color))
}
}
if (colorSetting.auto != null)
Switch(colorSetting.auto, onCheckedChange = {
val oldUserColors = KeyboardTheme.readUserColors(prefs, themeName)
val newUserColors = (oldUserColors + ColorSetting(colorSetting.name, it, colorSetting.color))
.reversed().distinctBy { it.displayName }
KeyboardTheme.writeUserColors(prefs, themeName, newUserColors)
})
} }
if (colorSetting.auto != null)
Switch(colorSetting.auto, onCheckedChange = {
val oldUserColors = KeyboardTheme.readUserColors(prefs, themeName)
val newUserColors = (oldUserColors + ColorSetting(colorSetting.name, it, colorSetting.color))
.reversed().distinctBy { it.displayName }
KeyboardTheme.writeUserColors(prefs, themeName, newUserColors)
})
}
} }
) )
if (chosenColor != null) { if (chosenColor != null) {