Hide toggle effect descriptions when enabled in non-individual scheduling
When wallpaper effects are toggled on and individual scheduling is off, hide the description text for a cleaner UI: - Grayscale effect - Adaptive brightness - Shuffle Changes: - Make SettingSwitch description parameter nullable - Conditionally hide description when: - Effect is enabled (checked = true) - AND individual scheduling is OFF (separateSchedules = false) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
9820581723
commit
ca59cd8155
3 files changed
+13
-6
No files matched your search
@@ -6,7 +6,8 @@
|
||||
"Bash(git push:*)",
|
||||
"WebFetch(domain:github.com)",
|
||||
"WebFetch(domain:raw.githubusercontent.com)",
|
||||
"Bash(dir:*)"
|
||||
"Bash(dir:*)",
|
||||
"Bash(./gradlew assembleDebug:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
+7
-3
@@ -645,7 +645,11 @@ fun WallpaperScreen(
|
||||
// Grayscale
|
||||
SettingSwitch(
|
||||
title = R.string.gray_filter,
|
||||
description = R.string.make_the_colors_grayscale,
|
||||
description = if (when {
|
||||
homeEnabled && lockEnabled -> scheduleSettings.homeEffects.enableGrayscale && scheduleSettings.lockEffects.enableGrayscale
|
||||
homeEnabled -> scheduleSettings.homeEffects.enableGrayscale
|
||||
else -> scheduleSettings.lockEffects.enableGrayscale
|
||||
} && !scheduleSettings.separateSchedules) null else R.string.make_the_colors_grayscale,
|
||||
checked = when {
|
||||
homeEnabled && lockEnabled -> scheduleSettings.homeEffects.enableGrayscale && scheduleSettings.lockEffects.enableGrayscale
|
||||
homeEnabled -> scheduleSettings.homeEffects.enableGrayscale
|
||||
@@ -664,7 +668,7 @@ fun WallpaperScreen(
|
||||
// Adaptive Brightness
|
||||
SettingSwitch(
|
||||
title = R.string.adaptive_brightness,
|
||||
description = R.string.adjust_brightness_based_on_mode,
|
||||
description = if (scheduleSettings.adaptiveBrightness && !scheduleSettings.separateSchedules) null else R.string.adjust_brightness_based_on_mode,
|
||||
checked = scheduleSettings.adaptiveBrightness,
|
||||
onCheckedChange = { enabled ->
|
||||
onUpdateScheduleSettings(scheduleSettings.copy(adaptiveBrightness = enabled))
|
||||
@@ -674,7 +678,7 @@ fun WallpaperScreen(
|
||||
// Shuffle
|
||||
SettingSwitch(
|
||||
title = R.string.shuffle,
|
||||
description = R.string.randomly_shuffle_the_wallpapers,
|
||||
description = if (scheduleSettings.shuffleEnabled && !scheduleSettings.separateSchedules) null else R.string.randomly_shuffle_the_wallpapers,
|
||||
checked = scheduleSettings.shuffleEnabled,
|
||||
onCheckedChange = { enabled ->
|
||||
onUpdateScheduleSettings(scheduleSettings.copy(shuffleEnabled = enabled))
|
||||
|
||||
+4
-2
@@ -29,7 +29,7 @@ import com.anthonyla.paperize.presentation.theme.AppSpacing
|
||||
@Composable
|
||||
fun SettingSwitch(
|
||||
@StringRes title: Int,
|
||||
@StringRes description: Int,
|
||||
@StringRes description: Int?,
|
||||
checked: Boolean,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
@@ -61,15 +61,17 @@ fun SettingSwitch(
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
description?.let {
|
||||
Spacer(modifier = Modifier.height(AppSpacing.extraSmall))
|
||||
Text(
|
||||
text = stringResource(description),
|
||||
text = stringResource(it),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 3,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.width(AppSpacing.large))
|
||||
Switch(
|
||||
checked = checked,
|
||||
|
||||
Reference in new issue
Block a user