From 730ea112359ceb4fc9c2873d6f940092c65f4602 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 16 Oct 2026 07:00:59 +0000 Subject: [PATCH] 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. --- .../subtracks/ui/settings/SettingsScreen.kt | 42 ++++++++++--------- app/src/main/res/values/strings.xml | 6 +-- .../com/subtracks/ui/AppScreenshotTest.kt | 21 +++++++++- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/settings/SettingsScreen.kt b/app/src/main/kotlin/com/subtracks/ui/settings/SettingsScreen.kt index b82ab683..7f8f975e 100644 --- a/app/src/main/kotlin/com/subtracks/ui/settings/SettingsScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/settings/SettingsScreen.kt @@ -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)) } + } }, ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 439d8c73..be037408 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -79,12 +79,12 @@ Track gain Lower preamp Raise preamp - Adjust level on top of the replay gain + Adjust level on top of the ReplayGain Reset Preamp %1$s dB - Normalise loudness using the gain from the server - Replay gain + Normalise loudness with the server\'s ReplayGain + ReplayGain Network Stream quality: Mobile Stream quality: Wi-Fi diff --git a/app/src/test/kotlin/com/subtracks/ui/AppScreenshotTest.kt b/app/src/test/kotlin/com/subtracks/ui/AppScreenshotTest.kt index c6635480..a6c6961e 100644 --- a/app/src/test/kotlin/com/subtracks/ui/AppScreenshotTest.kt +++ b/app/src/test/kotlin/com/subtracks/ui/AppScreenshotTest.kt @@ -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