mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-14 13:27:17 +02:00
add custom-seekbar-color
patch
This commit is contained in:
parent
a9cc2326f2
commit
c02b923404
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.seekbar.oldseekbarcolor.bytecode.patch
|
package app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@ -13,13 +13,14 @@ import app.revanced.shared.extensions.toResult
|
|||||||
import app.revanced.shared.patches.mapping.ResourceMappingPatch
|
import app.revanced.shared.patches.mapping.ResourceMappingPatch
|
||||||
import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT
|
import app.revanced.shared.util.integrations.Constants.SEEKBAR_LAYOUT
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||||
|
|
||||||
@DependsOn([ResourceMappingPatch::class])
|
@DependsOn([ResourceMappingPatch::class])
|
||||||
@Name("old-seekbar-color-bytecode-patch")
|
@Name("custom-seekbar-color-bytecode-patch")
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class OldSeekbarColorBytecodePatch : BytecodePatch() {
|
class CustomSeekbarColorBytecodePatch : BytecodePatch() {
|
||||||
|
|
||||||
// list of resource names to get the id of
|
// list of resource names to get the id of
|
||||||
private val resourceIds = arrayOf(
|
private val resourceIds = arrayOf(
|
||||||
@ -38,15 +39,15 @@ class OldSeekbarColorBytecodePatch : BytecodePatch() {
|
|||||||
Opcode.CONST -> {
|
Opcode.CONST -> {
|
||||||
when ((instruction as Instruction31i).wideLiteral) {
|
when ((instruction as Instruction31i).wideLiteral) {
|
||||||
resourceIds[0] -> { // seekbar color
|
resourceIds[0] -> { // seekbar color
|
||||||
val insertIndex = index + 1
|
val registerIndex = index + 2
|
||||||
|
|
||||||
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
|
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
|
||||||
|
|
||||||
val viewRegister = (instructions.elementAt(index) as Instruction31i).registerA
|
val viewRegister = (instructions.elementAt(registerIndex) as OneRegisterInstruction).registerA
|
||||||
|
|
||||||
mutableMethod.addInstructions(
|
mutableMethod.addInstructions(
|
||||||
insertIndex, """
|
registerIndex + 1, """
|
||||||
invoke-static {v$viewRegister}, $SEEKBAR_LAYOUT->enableOldSeekbarColor(I)I
|
invoke-static {v$viewRegister}, $SEEKBAR_LAYOUT->enableCustomSeekbarColor(I)I
|
||||||
move-result v$viewRegister
|
move-result v$viewRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.seekbar.oldseekbarcolor.resource.patch
|
package app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.resource.patch
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
@ -9,23 +9,23 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patches.youtube.layout.seekbar.oldseekbarcolor.bytecode.patch.OldSeekbarColorBytecodePatch
|
import app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch.CustomSeekbarColorBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.shared.util.resources.ResourceHelper
|
import app.revanced.shared.util.resources.ResourceHelper
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("enable-old-seekbar-color")
|
@Name("custom-seekbar-color")
|
||||||
@Description("Enable old seekbar color in dark mode.")
|
@Description("Change seekbar color in dark mode.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
OldSeekbarColorBytecodePatch::class,
|
CustomSeekbarColorBytecodePatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class OldSeekbarColorPatch : ResourcePatch {
|
class CustomSeekbarColorPatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -36,12 +36,12 @@ class OldSeekbarColorPatch : ResourcePatch {
|
|||||||
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||||
"PREFERENCE: LAYOUT_SETTINGS",
|
"PREFERENCE: LAYOUT_SETTINGS",
|
||||||
"PREFERENCE_HEADER: SEEKBAR",
|
"PREFERENCE_HEADER: SEEKBAR",
|
||||||
"SETTINGS: ENABLE_OLD_SEEKBAR_COLOR"
|
"SETTINGS: CUSTOM_SEEKBAR_COLOR"
|
||||||
)
|
)
|
||||||
|
|
||||||
ResourceHelper.patchSuccess(
|
ResourceHelper.patchSuccess(
|
||||||
context,
|
context,
|
||||||
"enable-old-seekbar-color"
|
"custom-seekbar-color"
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
@ -160,6 +160,8 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_adremover_web_search_panel_summary_off">Web search panels are shown</string>
|
<string name="revanced_adremover_web_search_panel_summary_off">Web search panels are shown</string>
|
||||||
<string name="revanced_adremover_web_search_panel_summary_on">Web search panels are hidden</string>
|
<string name="revanced_adremover_web_search_panel_summary_on">Web search panels are hidden</string>
|
||||||
<string name="revanced_adremover_web_search_panel_title">Hide web search panels</string>
|
<string name="revanced_adremover_web_search_panel_title">Hide web search panels</string>
|
||||||
|
<string name="revanced_custom_seekbar_color_value_summary">Type the color hex code of the seekbar to use in dark mode</string>
|
||||||
|
<string name="revanced_custom_seekbar_color_value_title">Custom seekbar color value</string>
|
||||||
<string name="revanced_custom_video_buffer_maximum_summary">The maximum duration of media that the player will attempt to buffer</string>
|
<string name="revanced_custom_video_buffer_maximum_summary">The maximum duration of media that the player will attempt to buffer</string>
|
||||||
<string name="revanced_custom_video_buffer_maximum_title">Maximum buffer size</string>
|
<string name="revanced_custom_video_buffer_maximum_title">Maximum buffer size</string>
|
||||||
<string name="revanced_custom_video_buffer_playback_start_summary">The duration of media that must be buffered for playback to start or resume following a user action such as seeking</string>
|
<string name="revanced_custom_video_buffer_playback_start_summary">The duration of media that must be buffered for playback to start or resume following a user action such as seeking</string>
|
||||||
@ -206,6 +208,9 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_enable_always_swipe_summary_off">Disable swipe gestures when player controls are visible</string>
|
<string name="revanced_enable_always_swipe_summary_off">Disable swipe gestures when player controls are visible</string>
|
||||||
<string name="revanced_enable_always_swipe_summary_on">Enable always swipe gestures regardless of player controls visible or not</string>
|
<string name="revanced_enable_always_swipe_summary_on">Enable always swipe gestures regardless of player controls visible or not</string>
|
||||||
<string name="revanced_enable_always_swipe_title">Enable always swipe gesture</string>
|
<string name="revanced_enable_always_swipe_title">Enable always swipe gesture</string>
|
||||||
|
<string name="revanced_enable_custom_seekbar_color_summary_off">Custom seekbar color is disabled</string>
|
||||||
|
<string name="revanced_enable_custom_seekbar_color_summary_on">Custom seekbar color is enabled</string>
|
||||||
|
<string name="revanced_enable_custom_seekbar_color_title">Enable custom seekbar color in dark mode</string>
|
||||||
<string name="revanced_enable_custom_video_speed_summary_off">Custom video speed is disabled</string>
|
<string name="revanced_enable_custom_video_speed_summary_off">Custom video speed is disabled</string>
|
||||||
<string name="revanced_enable_custom_video_speed_summary_on">Custom video speed is enabled</string>
|
<string name="revanced_enable_custom_video_speed_summary_on">Custom video speed is enabled</string>
|
||||||
<string name="revanced_enable_custom_video_speed_title">Enable custom video speed</string>
|
<string name="revanced_enable_custom_video_speed_title">Enable custom video speed</string>
|
||||||
@ -224,9 +229,6 @@ Is it ready to submit?"</string>
|
|||||||
<string name="revanced_enable_old_quality_layout_summary_off">New style quality settings are shown</string>
|
<string name="revanced_enable_old_quality_layout_summary_off">New style quality settings are shown</string>
|
||||||
<string name="revanced_enable_old_quality_layout_summary_on">Old style quality settings are shown</string>
|
<string name="revanced_enable_old_quality_layout_summary_on">Old style quality settings are shown</string>
|
||||||
<string name="revanced_enable_old_quality_layout_title">Enable old style quality layout</string>
|
<string name="revanced_enable_old_quality_layout_title">Enable old style quality layout</string>
|
||||||
<string name="revanced_enable_old_seekbar_color_summary_off">New seekbar color is used</string>
|
|
||||||
<string name="revanced_enable_old_seekbar_color_summary_on">Old seekbar color is used</string>
|
|
||||||
<string name="revanced_enable_old_seekbar_color_title">Enable old seekbar color</string>
|
|
||||||
<string name="revanced_enable_open_links_directly_summary_off">URL redirect (youtube.com/redirect) is used when opening links in video descriptions</string>
|
<string name="revanced_enable_open_links_directly_summary_off">URL redirect (youtube.com/redirect) is used when opening links in video descriptions</string>
|
||||||
<string name="revanced_enable_open_links_directly_summary_on">Bypass URL redirects (youtube.com/redirect) when opening links in video descriptions</string>
|
<string name="revanced_enable_open_links_directly_summary_on">Bypass URL redirects (youtube.com/redirect) when opening links in video descriptions</string>
|
||||||
<string name="revanced_enable_open_links_directly_title">Enable open links directly</string>
|
<string name="revanced_enable_open_links_directly_title">Enable open links directly</string>
|
||||||
|
@ -238,8 +238,9 @@
|
|||||||
<!-- PREFERENCE_HEADER: SEEKBAR
|
<!-- PREFERENCE_HEADER: SEEKBAR
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_settings_seekbar" />PREFERENCE_HEADER: SEEKBAR -->
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_settings_seekbar" />PREFERENCE_HEADER: SEEKBAR -->
|
||||||
|
|
||||||
<!-- SETTINGS: ENABLE_OLD_SEEKBAR_COLOR
|
<!-- SETTINGS: CUSTOM_SEEKBAR_COLOR
|
||||||
<SwitchPreference android:title="@string/revanced_enable_old_seekbar_color_title" android:key="revanced_enable_old_seekbar_color" android:defaultValue="true" android:summaryOn="@string/revanced_enable_old_seekbar_color_summary_on" android:summaryOff="@string/revanced_enable_old_seekbar_color_summary_off" />SETTINGS: ENABLE_OLD_SEEKBAR_COLOR -->
|
<SwitchPreference android:title="@string/revanced_enable_custom_seekbar_color_title" android:key="revanced_enable_custom_seekbar_color" android:defaultValue="true" android:summaryOn="@string/revanced_enable_custom_seekbar_color_summary_on" android:summaryOff="@string/revanced_enable_custom_seekbar_color_summary_off" />
|
||||||
|
<EditTextPreference android:title="@string/revanced_custom_seekbar_color_value_title" android:key="revanced_custom_seekbar_color_value" android:summary="@string/revanced_custom_seekbar_color_value_summary" android:defaultValue="#ff0000" android:hint="#ff0000" android:inputType="text" />SETTINGS: CUSTOM_SEEKBAR_COLOR -->
|
||||||
|
|
||||||
<!-- SETTINGS: ENABLE_SEEKBAR_TAPPING
|
<!-- SETTINGS: ENABLE_SEEKBAR_TAPPING
|
||||||
<SwitchPreference android:title="@string/revanced_enable_seekbar_tapping_title" android:key="revanced_enable_seekbar_tapping" android:defaultValue="true" android:summaryOn="@string/revanced_enable_seekbar_tapping_summary_on" android:summaryOff="@string/revanced_enable_seekbar_tapping_summary_off" />SETTINGS: ENABLE_SEEKBAR_TAPPING -->
|
<SwitchPreference android:title="@string/revanced_enable_seekbar_tapping_title" android:key="revanced_enable_seekbar_tapping" android:defaultValue="true" android:summaryOn="@string/revanced_enable_seekbar_tapping_summary_on" android:summaryOff="@string/revanced_enable_seekbar_tapping_summary_off" />SETTINGS: ENABLE_SEEKBAR_TAPPING -->
|
||||||
@ -391,7 +392,7 @@
|
|||||||
<Preference android:title="hide-comment-component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-comment-component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_settings_flyoutmenu" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_settings_flyoutmenu" />
|
||||||
<Preference android:title="enable-old-seekbar-color" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="custom-seekbar-color" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="enable-old-quality-layout" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="enable-old-quality-layout" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-flyout-panel" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-flyout-panel" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user