Appearance review fixes: Colours header, shared preview row, still wave keeps its wavelength (#118, #157)
This commit is contained in:
1 parent
d567dff38a
commit
ba05c442f0
5 files changed
+19
-46
No files matched your search
@@ -685,8 +685,9 @@ private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) {
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
trackColor = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.22f),
|
||||
wavelength = TodayWavelength,
|
||||
// A still wave when motion is reduced or the system removed animations (#157).
|
||||
waveSpeed = if (rememberLoopingMotion()) WavyProgressIndicatorDefaults.CircularWavelength else 0.dp,
|
||||
waveSpeed = if (rememberLoopingMotion()) TodayWavelength else 0.dp,
|
||||
)
|
||||
Text(stringResource(R.string.progress_fraction_compact, done, total), style = MaterialTheme.typography.titleMedium)
|
||||
}
|
||||
@@ -695,6 +696,8 @@ private fun TodayHero(done: Int, total: Int, onClick: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
private val TodayWavelength = WavyProgressIndicatorDefaults.CircularWavelength
|
||||
|
||||
/** Overdue + All as a 2-up row of the existing tonal tiles. */
|
||||
@Composable
|
||||
private fun SmartPairRow(counts: List<SmartCount>, onOpenFilter: (TaskFilter) -> Unit) {
|
||||
|
||||
@@ -2,13 +2,8 @@ package de.jeanlucmakiola.agendula.ui.settings
|
||||
|
||||
import android.os.Build
|
||||
import android.text.format.DateFormat
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.selection.selectableGroup
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Add
|
||||
import androidx.compose.material.icons.rounded.Badge
|
||||
@@ -49,7 +44,6 @@ import de.jeanlucmakiola.floret.components.CollapsingScaffold
|
||||
import de.jeanlucmakiola.floret.components.ConnectedChoiceRow
|
||||
import de.jeanlucmakiola.floret.components.FullScreenPicker
|
||||
import de.jeanlucmakiola.floret.components.GroupedHint
|
||||
import de.jeanlucmakiola.floret.components.GroupedListInset
|
||||
import de.jeanlucmakiola.floret.components.GroupedRow
|
||||
import de.jeanlucmakiola.floret.components.GroupedSectionHeader
|
||||
import de.jeanlucmakiola.floret.components.GroupedSwitchRow
|
||||
@@ -57,7 +51,7 @@ import de.jeanlucmakiola.floret.components.LauncherMark
|
||||
import de.jeanlucmakiola.floret.components.LauncherNameChooser
|
||||
import de.jeanlucmakiola.floret.components.OptionPicker
|
||||
import de.jeanlucmakiola.floret.components.Position
|
||||
import de.jeanlucmakiola.floret.components.PreviewOptionCard
|
||||
import de.jeanlucmakiola.floret.components.PreviewOptionRow
|
||||
import de.jeanlucmakiola.floret.locale.currentLocale
|
||||
import de.jeanlucmakiola.floret.prefs.ActionStyle
|
||||
import de.jeanlucmakiola.floret.prefs.LayoutDensity
|
||||
@@ -87,7 +81,7 @@ internal fun AppearanceScreen(
|
||||
predictiveBack = true,
|
||||
visible = visible,
|
||||
) {
|
||||
GroupedSectionHeader(stringResource(R.string.settings_theme))
|
||||
GroupedSectionHeader(stringResource(R.string.settings_group_colours))
|
||||
GroupedRow(
|
||||
title = stringResource(R.string.settings_theme),
|
||||
summary = stringResource(themeLabel(state.settings.themeMode)),
|
||||
@@ -133,20 +127,13 @@ internal fun AppearanceScreen(
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
GroupedSectionHeader(stringResource(R.string.settings_buttons))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = GroupedListInset).selectableGroup(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
ActionStyle.entries.forEach { style ->
|
||||
PreviewOptionCard(
|
||||
label = stringResource(actionStyleLabel(style)),
|
||||
selected = state.settings.actionStyle == style,
|
||||
onClick = { viewModel.setActionStyle(style) },
|
||||
preview = { ActionStylePreview(PreviewActions, shaped = style == ActionStyle.SHAPES) },
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
PreviewOptionRow(
|
||||
options = ActionStyle.entries,
|
||||
selected = state.settings.actionStyle,
|
||||
label = { stringResource(actionStyleLabel(it)) },
|
||||
onSelect = viewModel::setActionStyle,
|
||||
preview = { ActionStylePreview(PreviewActions, shaped = it == ActionStyle.SHAPES) },
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
GroupedSectionHeader(stringResource(R.string.settings_motion))
|
||||
@@ -300,12 +287,13 @@ private fun actionStyleLabel(style: ActionStyle): Int = when (style) {
|
||||
}
|
||||
|
||||
/** The home top bar's own actions, as the Buttons choice previews them. */
|
||||
private val PreviewActions: List<Pair<ImageVector, RoundedPolygon>>
|
||||
get() = listOf(
|
||||
private val PreviewActions: List<Pair<ImageVector, RoundedPolygon>> by lazy {
|
||||
listOf(
|
||||
Icons.Rounded.Search to ActionShapes.Search,
|
||||
Icons.Rounded.Settings to ActionShapes.Settings,
|
||||
Icons.Rounded.Add to ActionShapes.AddList,
|
||||
)
|
||||
}
|
||||
|
||||
private fun themeLabel(mode: ThemeMode): Int = when (mode) {
|
||||
ThemeMode.SYSTEM -> R.string.settings_theme_system
|
||||
|
||||
@@ -535,6 +535,7 @@
|
||||
<string name="settings_motion">Motion</string>
|
||||
<string name="settings_reduce_motion">Reduce motion</string>
|
||||
<string name="settings_reduce_motion_hint">Stops looping animations like the progress wave. The system “Remove animations” setting always wins.</string>
|
||||
<string name="settings_group_colours">Colours</string>
|
||||
<string name="settings_group_date_time">Date & time</string>
|
||||
<string name="settings_group_launcher">Launcher</string>
|
||||
<string name="settings_section_reminders">Notifications</string>
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/** Density, button style and reduce motion: their defaults, and that a choice sticks. */
|
||||
/** Density, button style and reduce motion as [Settings] carries them; the stored keys are floret-kit's to test. */
|
||||
class AppearanceSettingsTest {
|
||||
|
||||
private class MemoryDataStore(initial: Preferences = emptyPreferences()) : DataStore<Preferences> {
|
||||
@@ -66,23 +66,4 @@ class AppearanceSettingsTest {
|
||||
assertThat(Triple(settings.density, settings.actionStyle, settings.reduceMotion))
|
||||
.isEqualTo(Triple(LayoutDensity.COMPACT, ActionStyle.SHAPES, true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `the choices are stored under the keys floret-kit shares`() = runBlocking<Unit> {
|
||||
val dataStore = MemoryDataStore()
|
||||
val prefs = prefs(dataStore)
|
||||
|
||||
prefs.setDensity(LayoutDensity.COMPACT)
|
||||
prefs.setActionStyle(ActionStyle.SHAPES)
|
||||
prefs.setReduceMotion(true)
|
||||
|
||||
val stored = dataStore.data.value
|
||||
assertThat(
|
||||
listOf(
|
||||
stored[stringPreferencesKey("layout_density")],
|
||||
stored[stringPreferencesKey("action_style")],
|
||||
stored[booleanPreferencesKey("reduce_motion")],
|
||||
),
|
||||
).containsExactly("COMPACT", "SHAPES", true).inOrder()
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule floret-kit updated: 3e7d342737...4d9c014eff.
Reference in new issue
Block a user