mirror of
https://github.com/meowarex/rl-mobile.git
synced 2026-08-26 14:07:45 +10:00
feat(mini player gestures): enable drag option
This commit is contained in:
@@ -197,6 +197,14 @@ enum class KnownPatch(
|
||||
"radiant/MiniPlayerGestures\$ApplyPending.smali",
|
||||
),
|
||||
),
|
||||
PatchOption.Toggle(
|
||||
key = "swipe_up_drag",
|
||||
titleRes = R.string.patch_mini_player_drag_title,
|
||||
descRes = R.string.patch_mini_player_drag_desc,
|
||||
default = true,
|
||||
requiresOption = "gestures",
|
||||
token = "RL_MINI_PLAYER_SWIPE_UP_DRAG",
|
||||
),
|
||||
// Swipe left/right to skip
|
||||
PatchOption.Toggle(
|
||||
key = "next_prev",
|
||||
|
||||
@@ -32,6 +32,8 @@ sealed interface PatchOption {
|
||||
val hidesVariants: List<Int> = emptyList(),
|
||||
/** Variant title overrides (index -> @StringRes) applied while this toggle is on. */
|
||||
val relabelVariants: Map<Int, Int> = emptyMap(),
|
||||
/** Placeholder name (without the surrounding `__`) baked into the `.patch` files. */
|
||||
val token: String? = null,
|
||||
) : PatchOption
|
||||
|
||||
/** A continuous (or stepped) numeric value within [valueRange]. */
|
||||
|
||||
+12
-4
@@ -111,10 +111,18 @@ data class PatchOptions(
|
||||
for (spec in specs) {
|
||||
if (!isEnabled(spec)) continue
|
||||
for (option in spec.advancedOptions) {
|
||||
if (option !is OptionSpec.Slider) continue
|
||||
val token = option.token ?: continue
|
||||
val encode = option.encode ?: continue
|
||||
put("__${token}__", encode.encode(sliderValue(spec, option)))
|
||||
when (option) {
|
||||
is OptionSpec.Toggle -> {
|
||||
val token = option.token ?: continue
|
||||
put("__${token}__", if (isToggleActive(spec, option)) "0x1" else "0x0")
|
||||
}
|
||||
is OptionSpec.Slider -> {
|
||||
val token = option.token ?: continue
|
||||
val encode = option.encode ?: continue
|
||||
put("__${token}__", encode.encode(sliderValue(spec, option)))
|
||||
}
|
||||
is OptionSpec.Choice -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ sealed interface OptionSpec {
|
||||
val hidesVariants: List<Int> = emptyList(),
|
||||
/** Variant title overrides (index -> title) applied while this toggle is on. */
|
||||
val relabelVariants: Map<Int, String> = emptyMap(),
|
||||
/** Placeholder name (without the surrounding `__`) baked into the `.patch` files. */
|
||||
val token: String? = null,
|
||||
) : OptionSpec
|
||||
|
||||
@Immutable
|
||||
@@ -162,6 +164,7 @@ private fun PatchOption.toSpec(resolve: (Int) -> String): OptionSpec = when (thi
|
||||
requiresOption = requiresOption,
|
||||
hidesVariants = hidesVariants,
|
||||
relabelVariants = relabelVariants.mapValues { resolve(it.value) },
|
||||
token = token,
|
||||
)
|
||||
|
||||
is PatchOption.Slider -> OptionSpec.Slider(
|
||||
|
||||
@@ -295,6 +295,8 @@
|
||||
<string name="patch_mini_player_redesign_desc">Integrates the Seekbar into the control panel at the bottom of the screen.</string>
|
||||
<string name="patch_mini_player_gestures_title">Mini-Player Gestures</string>
|
||||
<string name="patch_mini_player_gestures_desc">Swipe up on the mini-player to open the full player.</string>
|
||||
<string name="patch_mini_player_drag_title">Enable Drag</string>
|
||||
<string name="patch_mini_player_drag_desc">Makes player follow your finger when swiping up. Disable if Android gesture navigation conflicts.</string>
|
||||
<string name="patch_mini_player_left_right_gestures_title">Next/Previous Gestures</string>
|
||||
<string name="patch_mini_player_left_right_gestures_desc">Swipe left or right on the mini-player to skip tracks.</string>
|
||||
<string name="patch_mini_player_dynamic_bg_title">Mini-Player Dynamic Background</string>
|
||||
|
||||
Reference in New Issue
Block a user