mirror of
https://github.com/meowarex/rl-mobile.git
synced 2026-10-14 23:43:12 +11:00
feat(swipe to queue): neutral default colors
This commit is contained in:
1 parent
973580e230
commit
2cb51576df
7 files changed
+80
-37
No files matched your search
@@ -534,16 +534,14 @@
|
|||||||
"type": "color",
|
"type": "color",
|
||||||
"key": "background_color",
|
"key": "background_color",
|
||||||
"title": "Add to Queue Color",
|
"title": "Add to Queue Color",
|
||||||
"default": -14748953,
|
"default": -14408663,
|
||||||
"defaultLabel": "Cyan",
|
|
||||||
"token": "RL_SWIPE_TO_QUEUE_ADD_COLOR"
|
"token": "RL_SWIPE_TO_QUEUE_ADD_COLOR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "color",
|
"type": "color",
|
||||||
"key": "play_next_color",
|
"key": "play_next_color",
|
||||||
"title": "Play Next Color",
|
"title": "Play Next Color",
|
||||||
"default": -14749031,
|
"default": -14408663,
|
||||||
"defaultLabel": "Green",
|
|
||||||
"token": "RL_SWIPE_TO_QUEUE_PLAY_NEXT_COLOR"
|
"token": "RL_SWIPE_TO_QUEUE_PLAY_NEXT_COLOR"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+32
-14
@@ -223,7 +223,6 @@ fun PatchAdvancedOptionsSheet(
|
|||||||
title = option.title,
|
title = option.title,
|
||||||
color = state.color(patch, option),
|
color = state.color(patch, option),
|
||||||
defaultColor = option.default,
|
defaultColor = option.default,
|
||||||
manifestDefaultLabel = option.defaultLabel,
|
|
||||||
onColorChange = { state.setColor(patch, option, it) },
|
onColorChange = { state.setColor(patch, option, it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -472,22 +471,33 @@ private fun ColorOptionRow(
|
|||||||
title: String,
|
title: String,
|
||||||
color: Int,
|
color: Int,
|
||||||
defaultColor: Int,
|
defaultColor: Int,
|
||||||
manifestDefaultLabel: String?,
|
|
||||||
onColorChange: (Int) -> Unit,
|
onColorChange: (Int) -> Unit,
|
||||||
) {
|
) {
|
||||||
var showPicker by rememberSaveable { mutableStateOf(false) }
|
var showPicker by rememberSaveable { mutableStateOf(false) }
|
||||||
val selectedColor = color.withOpaqueAlpha()
|
val selectedColor = color.withOpaqueAlpha()
|
||||||
val materialYouColor = MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha()
|
val isNeutralPalette = defaultColor.withOpaqueAlpha() == NEUTRAL
|
||||||
val opaqueDefault = defaultColor.withOpaqueAlpha()
|
val presets = if (isNeutralPalette) {
|
||||||
val defaultLabel = manifestDefaultLabel ?: if (opaqueDefault == TIDAL_GREEN) {
|
listOf(
|
||||||
stringResource(R.string.patch_color_green)
|
stringResource(R.string.patch_color_neutral),
|
||||||
} else stringResource(R.string.patch_waze_color_waze_default)
|
stringResource(R.string.patch_color_green),
|
||||||
val presets = listOf(
|
stringResource(R.string.patch_color_cyan),
|
||||||
defaultLabel,
|
)
|
||||||
stringResource(R.string.patch_waze_color_tidal_cyan),
|
} else {
|
||||||
stringResource(R.string.patch_waze_color_material_you),
|
listOf(
|
||||||
)
|
stringResource(R.string.patch_waze_color_waze_default),
|
||||||
val presetColors = listOf(opaqueDefault, TIDAL_CYAN, materialYouColor)
|
stringResource(R.string.patch_waze_color_tidal_cyan),
|
||||||
|
stringResource(R.string.patch_waze_color_material_you),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val presetColors = if (isNeutralPalette) {
|
||||||
|
listOf(NEUTRAL, GREEN, CYAN)
|
||||||
|
} else {
|
||||||
|
listOf(
|
||||||
|
defaultColor.withOpaqueAlpha(),
|
||||||
|
TIDAL_CYAN,
|
||||||
|
MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha(),
|
||||||
|
)
|
||||||
|
}
|
||||||
val selectedPreset = presetColors.indexOf(selectedColor)
|
val selectedPreset = presetColors.indexOf(selectedColor)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
@@ -515,6 +525,12 @@ private fun ColorOptionRow(
|
|||||||
style = MaterialTheme.typography.labelLarge,
|
style = MaterialTheme.typography.labelLarge,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_edit),
|
||||||
|
contentDescription = stringResource(R.string.patch_color_edit),
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.size(18.dp),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
|
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
|
||||||
presets.forEachIndexed { index, label ->
|
presets.forEachIndexed { index, label ->
|
||||||
@@ -650,7 +666,9 @@ private fun formatSliderValue(option: OptionSpec.Slider, value: Float): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const val OPAQUE_ALPHA = -0x1000000
|
private const val OPAQUE_ALPHA = -0x1000000
|
||||||
private const val TIDAL_GREEN = -14749031 // #ff1ef299
|
private const val NEUTRAL = -14408663 // #ff242429
|
||||||
|
private const val GREEN = -14749031 // #ff1ef299
|
||||||
|
private const val CYAN = -14748953 // #ff1ef2e7
|
||||||
private const val TIDAL_CYAN = -14549268 // #ff21feec
|
private const val TIDAL_CYAN = -14549268 // #ff21feec
|
||||||
|
|
||||||
private fun Int.withOpaqueAlpha(): Int = (this and 0x00FFFFFF) or OPAQUE_ALPHA
|
private fun Int.withOpaqueAlpha(): Int = (this and 0x00FFFFFF) or OPAQUE_ALPHA
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ sealed interface OptionSpec {
|
|||||||
override val title: String = "",
|
override val title: String = "",
|
||||||
override val description: String = "",
|
override val description: String = "",
|
||||||
val default: Int = 0,
|
val default: Int = 0,
|
||||||
val defaultLabel: String? = null,
|
|
||||||
/** Placeholder name (without the surrounding `__`) baked into the `.patch`/extension files. */
|
/** Placeholder name (without the surrounding `__`) baked into the `.patch`/extension files. */
|
||||||
val token: String? = null,
|
val token: String? = null,
|
||||||
) : OptionSpec
|
) : OptionSpec
|
||||||
|
|||||||
+32
-14
@@ -230,7 +230,6 @@ fun PatchAdvancedOptionsSheet(
|
|||||||
title = option.title,
|
title = option.title,
|
||||||
color = state.color(patch, option),
|
color = state.color(patch, option),
|
||||||
defaultColor = option.default,
|
defaultColor = option.default,
|
||||||
manifestDefaultLabel = option.defaultLabel,
|
|
||||||
onColorChange = { state.setColor(patch, option, it) },
|
onColorChange = { state.setColor(patch, option, it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -455,22 +454,33 @@ private fun ColorOptionRow(
|
|||||||
title: String,
|
title: String,
|
||||||
color: Int,
|
color: Int,
|
||||||
defaultColor: Int,
|
defaultColor: Int,
|
||||||
manifestDefaultLabel: String?,
|
|
||||||
onColorChange: (Int) -> Unit,
|
onColorChange: (Int) -> Unit,
|
||||||
) {
|
) {
|
||||||
var showPicker by rememberSaveable { mutableStateOf(false) }
|
var showPicker by rememberSaveable { mutableStateOf(false) }
|
||||||
val selectedColor = color.withOpaqueAlpha()
|
val selectedColor = color.withOpaqueAlpha()
|
||||||
val materialYouColor = MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha()
|
val isNeutralPalette = defaultColor.withOpaqueAlpha() == NEUTRAL
|
||||||
val opaqueDefault = defaultColor.withOpaqueAlpha()
|
val presets = if (isNeutralPalette) {
|
||||||
val defaultLabel = manifestDefaultLabel ?: if (opaqueDefault == TIDAL_GREEN) {
|
listOf(
|
||||||
stringResource(R.string.patch_color_green)
|
stringResource(R.string.patch_color_neutral),
|
||||||
} else stringResource(R.string.patch_waze_color_waze_default)
|
stringResource(R.string.patch_color_green),
|
||||||
val presets = listOf(
|
stringResource(R.string.patch_color_cyan),
|
||||||
defaultLabel,
|
)
|
||||||
stringResource(R.string.patch_waze_color_tidal_cyan),
|
} else {
|
||||||
stringResource(R.string.patch_waze_color_material_you),
|
listOf(
|
||||||
)
|
stringResource(R.string.patch_waze_color_waze_default),
|
||||||
val presetColors = listOf(opaqueDefault, TIDAL_CYAN, materialYouColor)
|
stringResource(R.string.patch_waze_color_tidal_cyan),
|
||||||
|
stringResource(R.string.patch_waze_color_material_you),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val presetColors = if (isNeutralPalette) {
|
||||||
|
listOf(NEUTRAL, GREEN, CYAN)
|
||||||
|
} else {
|
||||||
|
listOf(
|
||||||
|
defaultColor.withOpaqueAlpha(),
|
||||||
|
TIDAL_CYAN,
|
||||||
|
MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha(),
|
||||||
|
)
|
||||||
|
}
|
||||||
val selectedPreset = presetColors.indexOf(selectedColor)
|
val selectedPreset = presetColors.indexOf(selectedColor)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
@@ -498,6 +508,12 @@ private fun ColorOptionRow(
|
|||||||
style = MaterialTheme.typography.labelLarge,
|
style = MaterialTheme.typography.labelLarge,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_edit),
|
||||||
|
contentDescription = stringResource(R.string.patch_color_edit),
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.size(18.dp),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
RadiantSegmented(
|
RadiantSegmented(
|
||||||
options = presets,
|
options = presets,
|
||||||
@@ -611,7 +627,9 @@ private fun formatSliderValue(option: OptionSpec.Slider, value: Float): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const val OPAQUE_ALPHA = -0x1000000
|
private const val OPAQUE_ALPHA = -0x1000000
|
||||||
private const val TIDAL_GREEN = -14749031 // #ff1ef299
|
private const val NEUTRAL = -14408663 // #ff242429
|
||||||
|
private const val GREEN = -14749031 // #ff1ef299
|
||||||
|
private const val CYAN = -14748953 // #ff1ef2e7
|
||||||
private const val TIDAL_CYAN = -14549268 // #ff21feec
|
private const val TIDAL_CYAN = -14549268 // #ff21feec
|
||||||
|
|
||||||
private fun Int.withOpaqueAlpha(): Int = (this and 0x00FFFFFF) or OPAQUE_ALPHA
|
private fun Int.withOpaqueAlpha(): Int = (this and 0x00FFFFFF) or OPAQUE_ALPHA
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:fillColor="#e8eaed"
|
||||||
|
android:pathData="M200,760h57l391,-391l-57,-57l-391,391v57zM160,840q-17,0 -28.5,-11.5T120,800v-97q0,-16 6,-30.5t17,-25.5l505,-504q12,-11 26.5,-17t30.5,-6q16,0 31,6t26,18l55,56q12,11 17.5,26t5.5,30q0,16 -5.5,30.5T817,313L313,817q-11,11 -25.5,17t-30.5,6h-97zM760,256l-56,-56l56,56zM619,341l-28,-29l57,57l-29,-28z" />
|
||||||
|
</vector>
|
||||||
@@ -305,13 +305,16 @@
|
|||||||
<string name="patch_waze_browse_root_title">Media Menu</string>
|
<string name="patch_waze_browse_root_title">Media Menu</string>
|
||||||
<string name="patch_waze_accent_color_title">Accent Color</string>
|
<string name="patch_waze_accent_color_title">Accent Color</string>
|
||||||
<string name="patch_waze_color_waze_default">Waze Default</string>
|
<string name="patch_waze_color_waze_default">Waze Default</string>
|
||||||
|
<string name="patch_color_neutral">Neutral</string>
|
||||||
<string name="patch_color_green">Green</string>
|
<string name="patch_color_green">Green</string>
|
||||||
|
<string name="patch_color_cyan">Cyan</string>
|
||||||
<string name="patch_waze_color_tidal_cyan">TIDAL Cyan</string>
|
<string name="patch_waze_color_tidal_cyan">TIDAL Cyan</string>
|
||||||
<string name="patch_waze_color_material_you">Material You</string>
|
<string name="patch_waze_color_material_you">Material You</string>
|
||||||
<string name="patch_waze_root_auto">Auto Menu</string>
|
<string name="patch_waze_root_auto">Auto Menu</string>
|
||||||
<string name="patch_waze_root_home">Home</string>
|
<string name="patch_waze_root_home">Home</string>
|
||||||
<string name="patch_waze_root_recents">Recents</string>
|
<string name="patch_waze_root_recents">Recents</string>
|
||||||
<string name="patch_color_picker_title">Custom color</string>
|
<string name="patch_color_picker_title">Custom color</string>
|
||||||
|
<string name="patch_color_edit">Choose custom color</string>
|
||||||
<string name="patch_color_picker_hex">Hex color</string>
|
<string name="patch_color_picker_hex">Hex color</string>
|
||||||
<string name="patch_color_picker_hex_error">Use #RRGGBB or #AARRGGBB.</string>
|
<string name="patch_color_picker_hex_error">Use #RRGGBB or #AARRGGBB.</string>
|
||||||
<string name="patch_enable_legacy_ui_title">Enable Legacy UI</string>
|
<string name="patch_enable_legacy_ui_title">Enable Legacy UI</string>
|
||||||
|
|||||||
@@ -534,16 +534,14 @@
|
|||||||
"type": "color",
|
"type": "color",
|
||||||
"key": "background_color",
|
"key": "background_color",
|
||||||
"title": "Add to Queue Color",
|
"title": "Add to Queue Color",
|
||||||
"default": -14748953,
|
"default": -14408663,
|
||||||
"defaultLabel": "Cyan",
|
|
||||||
"token": "RL_SWIPE_TO_QUEUE_ADD_COLOR"
|
"token": "RL_SWIPE_TO_QUEUE_ADD_COLOR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "color",
|
"type": "color",
|
||||||
"key": "play_next_color",
|
"key": "play_next_color",
|
||||||
"title": "Play Next Color",
|
"title": "Play Next Color",
|
||||||
"default": -14749031,
|
"default": -14408663,
|
||||||
"defaultLabel": "Green",
|
|
||||||
"token": "RL_SWIPE_TO_QUEUE_PLAY_NEXT_COLOR"
|
"token": "RL_SWIPE_TO_QUEUE_PLAY_NEXT_COLOR"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user