feat(Youtube - Theme): add a switch to enable/disable custom seekbar color (#2663)

This commit is contained in:
LisoUseInAIKyrios 2023-07-20 21:27:44 +04:00 committed by GitHub
parent f0f8c3630e
commit 5c39985888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.InputType import app.revanced.patches.shared.settings.preference.impl.InputType
import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.preference.impl.TextPreference import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor
@ -20,10 +21,16 @@ import org.w3c.dom.Element
class ThemeResourcePatch : ResourcePatch { class ThemeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SeekbarPreferencesPatch.addPreferences( SeekbarPreferencesPatch.addPreferences(
SwitchPreference(
"revanced_seekbar_custom_color",
StringResource("revanced_seekbar_custom_color_title", "Enable custom seekbar color"),
StringResource("revanced_seekbar_custom_color_summary_on", "Custom seekbar color is shown"),
StringResource("revanced_seekbar_custom_color_summary_off", "Original seekbar color is shown")
),
TextPreference( TextPreference(
"revanced_seekbar_color", "revanced_seekbar_custom_color_value",
StringResource("revanced_seekbar_color_title", "Seekbar color"), StringResource("revanced_seekbar_custom_color_value_title", "Custom seekbar color"),
StringResource("revanced_seekbar_color_summary", "The color of the seekbar"), StringResource("revanced_seekbar_custom_color_value_summary", "The color of the seekbar"),
InputType.TEXT_CAP_CHARACTERS InputType.TEXT_CAP_CHARACTERS
) )
) )