mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
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:
@@ -62,6 +62,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.platform.LocalResources
|
import androidx.compose.ui.platform.LocalResources
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -780,6 +781,7 @@ private fun ReplayGainPreampDialog(
|
|||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { draft = stepReplayGainPreampDb(draft, -1) },
|
onClick = { draft = stepReplayGainPreampDb(draft, -1) },
|
||||||
@@ -807,29 +809,31 @@ private fun ReplayGainPreampDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row(
|
Text(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
replayGainPreampLabel(resources, draft),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
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 = {
|
confirmButton = {
|
||||||
TextButton(
|
Row(
|
||||||
onClick = {
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
onSelect(draft)
|
modifier = Modifier.fillMaxWidth(),
|
||||||
onDismiss()
|
) {
|
||||||
},
|
TextButton(
|
||||||
) { Text(stringResource(R.string.action_done)) }
|
onClick = { draft = 0f },
|
||||||
},
|
enabled = draft != 0f,
|
||||||
dismissButton = {
|
) { Text(stringResource(R.string.settings_replay_gain_preamp_reset)) }
|
||||||
TextButton(onClick = onDismiss) { Text(stringResource(R.string.actions_cancel)) }
|
Spacer(Modifier.weight(1f))
|
||||||
|
TextButton(onClick = onDismiss) { Text(stringResource(R.string.actions_cancel)) }
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
onSelect(draft)
|
||||||
|
onDismiss()
|
||||||
|
},
|
||||||
|
) { Text(stringResource(R.string.action_done)) }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,12 +79,12 @@
|
|||||||
<string name="settings_replay_gain_mode_track">Track gain</string>
|
<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_decrease">Lower preamp</string>
|
||||||
<string name="settings_replay_gain_preamp_increase">Raise 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_reset">Reset</string>
|
||||||
<string name="settings_replay_gain_preamp_title">Preamp</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_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_prompt">Normalise loudness with the server\'s ReplayGain</string>
|
||||||
<string name="settings_replay_gain_title">Replay gain</string>
|
<string name="settings_replay_gain_title">ReplayGain</string>
|
||||||
<string name="settings_network_name">Network</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_mobile_title">Stream quality: Mobile</string>
|
||||||
<string name="settings_network_options_max_bitrate_wifi_title">Stream quality: Wi-Fi</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.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.test.assertCountEquals
|
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.junit4.v2.createAndroidComposeRule
|
||||||
import androidx.compose.ui.test.onAllNodesWithContentDescription
|
import androidx.compose.ui.test.onAllNodesWithContentDescription
|
||||||
import androidx.compose.ui.test.onAllNodesWithTag
|
import androidx.compose.ui.test.onAllNodesWithTag
|
||||||
import androidx.compose.ui.test.onAllNodesWithText
|
import androidx.compose.ui.test.onAllNodesWithText
|
||||||
import androidx.compose.ui.test.onRoot
|
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.performTouchInput
|
||||||
import androidx.compose.ui.test.swipeUp
|
import androidx.compose.ui.test.swipeUp
|
||||||
import androidx.paging.PagingData
|
import androidx.paging.PagingData
|
||||||
@@ -340,6 +344,21 @@ class AppScreenshotTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun settings() {
|
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 {
|
composeRule.setContent {
|
||||||
SubtracksTheme {
|
SubtracksTheme {
|
||||||
SettingsScreen(
|
SettingsScreen(
|
||||||
@@ -367,8 +386,6 @@ class AppScreenshotTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
awaitText("Navidrome")
|
|
||||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/settings.png")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user