mirror of
https://github.com/meowarex/rl-mobile.git
synced 2026-10-14 23:43:12 +11:00
feat(swipe to queue): custom swipe bg color
This commit is contained in:
1 parent
4504b8d1ab
commit
47fe539e76
8 files changed
+42
-19
No files matched your search
@@ -489,6 +489,13 @@
|
|||||||
],
|
],
|
||||||
"defaultIndex": 0,
|
"defaultIndex": 0,
|
||||||
"token": "RL_SWIPE_TO_QUEUE_DIRECTION"
|
"token": "RL_SWIPE_TO_QUEUE_DIRECTION"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"key": "background_color",
|
||||||
|
"title": "Background Color",
|
||||||
|
"default": -14749031,
|
||||||
|
"token": "RL_SWIPE_TO_QUEUE_COLOR"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
+11
-3
@@ -212,6 +212,7 @@ fun PatchAdvancedOptionsSheet(
|
|||||||
is OptionSpec.Color -> ColorOptionRow(
|
is OptionSpec.Color -> ColorOptionRow(
|
||||||
title = option.title,
|
title = option.title,
|
||||||
color = state.color(patch, option),
|
color = state.color(patch, option),
|
||||||
|
defaultColor = option.default,
|
||||||
onColorChange = { state.setColor(patch, option, it) },
|
onColorChange = { state.setColor(patch, option, it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -455,17 +456,24 @@ private fun ChoiceOptionRow(
|
|||||||
private fun ColorOptionRow(
|
private fun ColorOptionRow(
|
||||||
title: String,
|
title: String,
|
||||||
color: Int,
|
color: Int,
|
||||||
|
defaultColor: Int,
|
||||||
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 materialYouColor = MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha()
|
||||||
|
val opaqueDefault = defaultColor.withOpaqueAlpha()
|
||||||
|
val defaultLabel = if (opaqueDefault == TIDAL_GREEN) {
|
||||||
|
stringResource(R.string.patch_color_green)
|
||||||
|
} else {
|
||||||
|
stringResource(R.string.patch_waze_color_waze_default)
|
||||||
|
}
|
||||||
val presets = listOf(
|
val presets = listOf(
|
||||||
stringResource(R.string.patch_waze_color_waze_default),
|
defaultLabel,
|
||||||
stringResource(R.string.patch_waze_color_tidal_cyan),
|
stringResource(R.string.patch_waze_color_tidal_cyan),
|
||||||
stringResource(R.string.patch_waze_color_material_you),
|
stringResource(R.string.patch_waze_color_material_you),
|
||||||
)
|
)
|
||||||
val presetColors = listOf(WAZE_DEFAULT, TIDAL_CYAN, materialYouColor)
|
val presetColors = listOf(opaqueDefault, TIDAL_CYAN, materialYouColor)
|
||||||
val selectedPreset = presetColors.indexOf(selectedColor)
|
val selectedPreset = presetColors.indexOf(selectedColor)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
@@ -628,7 +636,7 @@ private fun formatSliderValue(option: OptionSpec.Slider, value: Float): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const val OPAQUE_ALPHA = -0x1000000
|
private const val OPAQUE_ALPHA = -0x1000000
|
||||||
private const val WAZE_DEFAULT = -16747037 // #ff0075e3
|
private const val TIDAL_GREEN = -14749031 // #ff1ef299
|
||||||
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
|
||||||
|
|||||||
+11
-3
@@ -218,6 +218,7 @@ fun PatchAdvancedOptionsSheet(
|
|||||||
is OptionSpec.Color -> ColorOptionRow(
|
is OptionSpec.Color -> ColorOptionRow(
|
||||||
title = option.title,
|
title = option.title,
|
||||||
color = state.color(patch, option),
|
color = state.color(patch, option),
|
||||||
|
defaultColor = option.default,
|
||||||
onColorChange = { state.setColor(patch, option, it) },
|
onColorChange = { state.setColor(patch, option, it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -437,17 +438,24 @@ private fun ChoiceOptionRow(
|
|||||||
private fun ColorOptionRow(
|
private fun ColorOptionRow(
|
||||||
title: String,
|
title: String,
|
||||||
color: Int,
|
color: Int,
|
||||||
|
defaultColor: Int,
|
||||||
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 materialYouColor = MaterialTheme.colorScheme.primary.toArgb().withOpaqueAlpha()
|
||||||
|
val opaqueDefault = defaultColor.withOpaqueAlpha()
|
||||||
|
val defaultLabel = if (opaqueDefault == TIDAL_GREEN) {
|
||||||
|
stringResource(R.string.patch_color_green)
|
||||||
|
} else {
|
||||||
|
stringResource(R.string.patch_waze_color_waze_default)
|
||||||
|
}
|
||||||
val presets = listOf(
|
val presets = listOf(
|
||||||
stringResource(R.string.patch_waze_color_waze_default),
|
defaultLabel,
|
||||||
stringResource(R.string.patch_waze_color_tidal_cyan),
|
stringResource(R.string.patch_waze_color_tidal_cyan),
|
||||||
stringResource(R.string.patch_waze_color_material_you),
|
stringResource(R.string.patch_waze_color_material_you),
|
||||||
)
|
)
|
||||||
val presetColors = listOf(WAZE_DEFAULT, TIDAL_CYAN, materialYouColor)
|
val presetColors = listOf(opaqueDefault, TIDAL_CYAN, materialYouColor)
|
||||||
val selectedPreset = presetColors.indexOf(selectedColor)
|
val selectedPreset = presetColors.indexOf(selectedColor)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
@@ -588,7 +596,7 @@ private fun formatSliderValue(option: OptionSpec.Slider, value: Float): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const val OPAQUE_ALPHA = -0x1000000
|
private const val OPAQUE_ALPHA = -0x1000000
|
||||||
private const val WAZE_DEFAULT = -16747037 // #ff0075e3
|
private const val TIDAL_GREEN = -14749031 // #ff1ef299
|
||||||
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
|
||||||
|
|||||||
@@ -305,6 +305,7 @@
|
|||||||
<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_green">Green</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>
|
||||||
|
|||||||
@@ -49,11 +49,7 @@
|
|||||||
|
|
||||||
new-instance v1, Landroid/graphics/drawable/ColorDrawable;
|
new-instance v1, Landroid/graphics/drawable/ColorDrawable;
|
||||||
|
|
||||||
sget v2, Lcom/aspiro/wamp/R$color;->green:I
|
const v2, __RL_SWIPE_TO_QUEUE_COLOR__
|
||||||
|
|
||||||
invoke-virtual {v0, v2}, Landroid/content/Context;->getColor(I)I
|
|
||||||
|
|
||||||
move-result v2
|
|
||||||
|
|
||||||
invoke-direct {v1, v2}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V
|
invoke-direct {v1, v2}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
:exposure_ready
|
:exposure_ready
|
||||||
invoke-virtual {v7, v9, v1, v10, v4}, Landroid/graphics/Canvas;->clipRect(FFFF)Z
|
invoke-virtual {v7, v9, v1, v10, v4}, Landroid/graphics/Canvas;->clipRect(FFFF)Z
|
||||||
|
|
||||||
iget v11, v5, Lradiant/swipe/ComposeSwipeState;->green:I
|
iget v11, v5, Lradiant/swipe/ComposeSwipeState;->backgroundColor:I
|
||||||
|
|
||||||
invoke-virtual {v7, v11}, Landroid/graphics/Canvas;->drawColor(I)V
|
invoke-virtual {v7, v11}, Landroid/graphics/Canvas;->drawColor(I)V
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
.field icon:Landroid/graphics/drawable/Drawable;
|
.field icon:Landroid/graphics/drawable/Drawable;
|
||||||
|
|
||||||
.field green:I
|
.field backgroundColor:I
|
||||||
|
|
||||||
|
|
||||||
# direct methods
|
# direct methods
|
||||||
@@ -606,13 +606,9 @@
|
|||||||
:load_resources
|
:load_resources
|
||||||
iput-object v0, p0, Lradiant/swipe/ComposeSwipeState;->context:Landroid/content/Context;
|
iput-object v0, p0, Lradiant/swipe/ComposeSwipeState;->context:Landroid/content/Context;
|
||||||
|
|
||||||
sget v1, Lcom/aspiro/wamp/R$color;->green:I
|
const v1, __RL_SWIPE_TO_QUEUE_COLOR__
|
||||||
|
|
||||||
invoke-virtual {v0, v1}, Landroid/content/Context;->getColor(I)I
|
iput v1, p0, Lradiant/swipe/ComposeSwipeState;->backgroundColor:I
|
||||||
|
|
||||||
move-result v1
|
|
||||||
|
|
||||||
iput v1, p0, Lradiant/swipe/ComposeSwipeState;->green:I
|
|
||||||
|
|
||||||
sget v1, Lcom/aspiro/wamp/R$drawable;->ic_add_to_queue_last:I
|
sget v1, Lcom/aspiro/wamp/R$drawable;->ic_add_to_queue_last:I
|
||||||
|
|
||||||
|
|||||||
@@ -489,6 +489,13 @@
|
|||||||
],
|
],
|
||||||
"defaultIndex": 0,
|
"defaultIndex": 0,
|
||||||
"token": "RL_SWIPE_TO_QUEUE_DIRECTION"
|
"token": "RL_SWIPE_TO_QUEUE_DIRECTION"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"key": "background_color",
|
||||||
|
"title": "Background Color",
|
||||||
|
"default": -14749031,
|
||||||
|
"token": "RL_SWIPE_TO_QUEUE_COLOR"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user