mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
fix(settings): Gate Adaptive Audio Noise slider on Adaptive noise mode
This commit is contained in:
@@ -477,6 +477,7 @@ fun DeviceSettingsScreen(
|
||||
level = adaptiveNoise.level,
|
||||
onLevelChange = onAdaptiveAudioNoiseChange,
|
||||
enabled = enabled,
|
||||
isAdaptiveMode = ancMode.current == AapSetting.AncMode.Value.ADAPTIVE,
|
||||
)
|
||||
}
|
||||
if (features.hasNcOneAirpod && ncOneAirpod != null) {
|
||||
@@ -722,18 +723,24 @@ private fun AdaptiveNoiseSlider(
|
||||
level: Int,
|
||||
onLevelChange: (Int) -> Unit,
|
||||
enabled: Boolean,
|
||||
isAdaptiveMode: Boolean,
|
||||
) {
|
||||
var sliderValue by remember(level) { mutableIntStateOf(level) }
|
||||
val subtitleRes = if (isAdaptiveMode) {
|
||||
R.string.device_settings_adaptive_noise_description
|
||||
} else {
|
||||
R.string.device_settings_adaptive_noise_requires_adaptive
|
||||
}
|
||||
SettingsSliderItem(
|
||||
icon = Icons.TwoTone.GraphicEq,
|
||||
title = stringResource(R.string.device_settings_adaptive_noise_label),
|
||||
subtitle = stringResource(R.string.device_settings_adaptive_noise_description),
|
||||
subtitle = stringResource(subtitleRes),
|
||||
value = sliderValue.toFloat(),
|
||||
onValueChange = { sliderValue = it.toInt() },
|
||||
onValueChangeFinished = { onLevelChange(sliderValue) },
|
||||
valueRange = 0f..100f,
|
||||
steps = 99,
|
||||
enabled = enabled,
|
||||
enabled = enabled && isAdaptiveMode,
|
||||
valueLabel = { "${it.toInt()}%" },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -93,6 +93,9 @@ sealed class AapSetting {
|
||||
val enabled: Boolean,
|
||||
) : AapSetting()
|
||||
|
||||
// Wire format matches librepods spec (tested on AirPods Pro 2). On AirPods Pro 3 the device
|
||||
// accepts and echoes the value but no audible effect has been observed — may need additional
|
||||
// enable packet or different handling. Requires more investigation.
|
||||
data class AdaptiveAudioNoise(
|
||||
val level: Int,
|
||||
) : AapSetting()
|
||||
|
||||
@@ -453,6 +453,7 @@
|
||||
<string name="device_settings_tone_volume_description">Volume of confirmation sounds and ringtones</string>
|
||||
<string name="device_settings_adaptive_noise_label">Adaptive Audio Noise</string>
|
||||
<string name="device_settings_adaptive_noise_description">How much environmental noise is allowed through</string>
|
||||
<string name="device_settings_adaptive_noise_requires_adaptive">Requires Adaptive noise control</string>
|
||||
<string name="device_settings_press_speed_label">Press Speed</string>
|
||||
<string name="device_settings_press_speed_description">How quickly you need to press for multi-press gestures</string>
|
||||
<string name="device_settings_press_speed_default">Default</string>
|
||||
|
||||
Reference in New Issue
Block a user