feat: Move strings to resources for localization (#2440)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Aunali321 <aunvakil.aa@gmail.com> BREAKING CHANGE: Various APIs have been changed.
This commit is contained in:
committed by
GitHub
co-authored by
oSumAtrIX
semantic-release-bot
Aunali321
parent
15a83a6d28
commit
55fb1ebd9d
+23
-79
@@ -3,92 +3,36 @@ package app.revanced.patches.youtube.interaction.swipecontrols
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
||||
import app.revanced.patches.shared.misc.settings.preference.InputType
|
||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.TextPreference
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
|
||||
@Patch(
|
||||
dependencies = [SettingsPatch::class]
|
||||
dependencies = [SettingsPatch::class, AddResourcesPatch::class]
|
||||
)
|
||||
internal object SwipeControlsResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
AddResourcesPatch(this::class)
|
||||
|
||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_swipe_controls_preference_screen",
|
||||
StringResource("revanced_swipe_controls_preference_screen_title", "Swipe controls"),
|
||||
listOf(
|
||||
SwitchPreference(
|
||||
"revanced_swipe_brightness",
|
||||
StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
|
||||
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
|
||||
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_swipe_volume",
|
||||
StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
|
||||
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
|
||||
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_swipe_press_to_engage",
|
||||
StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
|
||||
StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
|
||||
StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_swipe_haptic_feedback",
|
||||
StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
|
||||
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
|
||||
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_swipe_save_and_restore_brightness",
|
||||
StringResource("revanced_swipe_save_and_restore_brightness_title", "Save and restore brightness"),
|
||||
StringResource(
|
||||
"revanced_swipe_save_and_restore_brightness_summary_on",
|
||||
"Save and restore brightness when exiting or entering fullscreen"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_swipe_save_and_restore_brightness_summary_off",
|
||||
"Do not save and restore brightness when exiting or entering fullscreen"
|
||||
)
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_overlay_timeout",
|
||||
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
|
||||
StringResource(
|
||||
"revanced_swipe_overlay_timeout_summary",
|
||||
"The amount of milliseconds the overlay is visible"
|
||||
),
|
||||
InputType.NUMBER
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_text_overlay_size",
|
||||
StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
|
||||
StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
|
||||
InputType.NUMBER
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_overlay_background_alpha",
|
||||
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
|
||||
StringResource(
|
||||
"revanced_swipe_overlay_background_alpha_summary",
|
||||
"The visibility of swipe overlay background"
|
||||
),
|
||||
InputType.NUMBER
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_swipe_threshold",
|
||||
StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
|
||||
StringResource(
|
||||
"revanced_swipe_threshold_summary",
|
||||
"The amount of threshold for swipe to occur"
|
||||
),
|
||||
InputType.NUMBER
|
||||
)
|
||||
key = "revanced_swipe_controls_preference_screen",
|
||||
preferences = setOf(
|
||||
SwitchPreference("revanced_swipe_brightness"),
|
||||
SwitchPreference("revanced_swipe_volume"),
|
||||
SwitchPreference("revanced_swipe_press_to_engage"),
|
||||
SwitchPreference("revanced_swipe_haptic_feedback"),
|
||||
SwitchPreference("revanced_swipe_save_and_restore_brightness"),
|
||||
TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER),
|
||||
TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER),
|
||||
TextPreference("revanced_swipe_overlay_background_alpha", inputType = InputType.NUMBER),
|
||||
TextPreference("revanced_swipe_threshold", inputType = InputType.NUMBER)
|
||||
),
|
||||
StringResource("revanced_swipe_controls_preference_screen_summary","Control volume and brightness")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -96,10 +40,10 @@ internal object SwipeControlsResourcePatch : ResourcePatch() {
|
||||
"swipecontrols",
|
||||
ResourceGroup(
|
||||
"drawable",
|
||||
"ic_sc_brightness_auto.xml",
|
||||
"ic_sc_brightness_manual.xml",
|
||||
"ic_sc_volume_mute.xml",
|
||||
"ic_sc_volume_normal.xml"
|
||||
"revanced_ic_sc_brightness_auto.xml",
|
||||
"revanced_ic_sc_brightness_manual.xml",
|
||||
"revanced_ic_sc_volume_mute.xml",
|
||||
"revanced_ic_sc_volume_normal.xml"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user