settings: name the setting ReplayGain and rework the preamp dialog

- Call it ReplayGain, which is the name of the standard, in the row, the
  prompt and the preamp prompt.
- Give the slider room under the prompt instead of sitting against it.
- Put Reset in the button row, where it lines up with Cancel and Done,
  rather than above them, and centre the decibel value that is left in
  the content.
- Add a screenshot test that scrolls to the section and opens the dialog,
  which also composes the new rows; the existing screenshot only captures
  the top of the list, so it never rendered them.
This commit is contained in:
austinried
2026-10-16 13:07:11 +00:00
parent 31859b66b6
commit 730ea11235
3 changed files with 45 additions and 24 deletions
@@ -62,6 +62,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -780,6 +781,7 @@ private fun ReplayGainPreampDialog(
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary,
)
Spacer(Modifier.height(16.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
IconButton(
onClick = { draft = stepReplayGainPreampDb(draft, -1) },
@@ -807,29 +809,31 @@ private fun ReplayGainPreampDialog(
)
}
}
Row(
verticalAlignment = Alignment.CenterVertically,
Text(
replayGainPreampLabel(resources, draft),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
) {
Text(replayGainPreampLabel(resources, draft))
Spacer(Modifier.weight(1f))
TextButton(
onClick = { draft = 0f },
enabled = draft != 0f,
) { Text(stringResource(R.string.settings_replay_gain_preamp_reset)) }
}
)
}
},
confirmButton = {
TextButton(
onClick = {
onSelect(draft)
onDismiss()
},
) { Text(stringResource(R.string.action_done)) }
},
dismissButton = {
TextButton(onClick = onDismiss) { Text(stringResource(R.string.actions_cancel)) }
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth(),
) {
TextButton(
onClick = { draft = 0f },
enabled = draft != 0f,
) { Text(stringResource(R.string.settings_replay_gain_preamp_reset)) }
Spacer(Modifier.weight(1f))
TextButton(onClick = onDismiss) { Text(stringResource(R.string.actions_cancel)) }
TextButton(
onClick = {
onSelect(draft)
onDismiss()
},
) { Text(stringResource(R.string.action_done)) }
}
},
)
}
+3 -3
View File
@@ -79,12 +79,12 @@
<string name="settings_replay_gain_mode_track">Track gain</string>
<string name="settings_replay_gain_preamp_decrease">Lower preamp</string>
<string name="settings_replay_gain_preamp_increase">Raise preamp</string>
<string name="settings_replay_gain_preamp_prompt">Adjust level on top of the replay gain</string>
<string name="settings_replay_gain_preamp_prompt">Adjust level on top of the ReplayGain</string>
<string name="settings_replay_gain_preamp_reset">Reset</string>
<string name="settings_replay_gain_preamp_title">Preamp</string>
<string name="settings_replay_gain_preamp_value">%1$s dB</string>
<string name="settings_replay_gain_prompt">Normalise loudness using the gain from the server</string>
<string name="settings_replay_gain_title">Replay gain</string>
<string name="settings_replay_gain_prompt">Normalise loudness with the server\'s ReplayGain</string>
<string name="settings_replay_gain_title">ReplayGain</string>
<string name="settings_network_name">Network</string>
<string name="settings_network_options_max_bitrate_mobile_title">Stream quality: Mobile</string>
<string name="settings_network_options_max_bitrate_wifi_title">Stream quality: Wi-Fi</string>
@@ -12,11 +12,15 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.hasScrollAction
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
import androidx.compose.ui.test.onAllNodesWithContentDescription
import androidx.compose.ui.test.onAllNodesWithTag
import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToNode
import androidx.compose.ui.test.performTouchInput
import androidx.compose.ui.test.swipeUp
import androidx.paging.PagingData
@@ -340,6 +344,21 @@ class AppScreenshotTest {
@Test
fun settings() {
setSettingsContent()
awaitText("Navidrome")
composeRule.onRoot().captureRoboImage("src/test/screenshots/settings.png")
}
@Test
fun replayGainPreampDialog() {
setSettingsContent()
composeRule.onNode(hasScrollAction()).performScrollToNode(hasText("Preamp"))
composeRule.onAllNodesWithText("Preamp")[0].performClick()
composeRule.waitForIdle()
composeRule.onRoot().captureRoboImage("src/test/screenshots/replay_gain_preamp.png")
}
private fun setSettingsContent() {
composeRule.setContent {
SubtracksTheme {
SettingsScreen(
@@ -367,8 +386,6 @@ class AppScreenshotTest {
)
}
}
awaitText("Navidrome")
composeRule.onRoot().captureRoboImage("src/test/screenshots/settings.png")
}
@Test