mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
cleanup
This commit is contained in:
@ -1,49 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch.CustomSeekbarColorBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
|
||||
@Patch
|
||||
@Name("custom-seekbar-color")
|
||||
@Description("Change seekbar color in dark mode.")
|
||||
@DependsOn(
|
||||
[
|
||||
CustomSeekbarColorBytecodePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomSeekbarColorPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings2(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: CUSTOM_SEEKBAR_COLOR"
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"custom-seekbar-color"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,26 +1,37 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.customseekbarcolor.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbarcolor.patch
|
||||
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.extensions.toResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
|
||||
|
||||
@DependsOn([ResourceMappingPatch::class])
|
||||
@Name("custom-seekbar-color-bytecode-patch")
|
||||
@Patch
|
||||
@Name("custom-seekbar-color")
|
||||
@Description("Change seekbar color in dark mode.")
|
||||
@DependsOn(
|
||||
[
|
||||
ResourceMappingPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomSeekbarColorBytecodePatch : BytecodePatch() {
|
||||
class SeekbarColorPatch : BytecodePatch() {
|
||||
|
||||
// list of resource names to get the id of
|
||||
private val resourceIds = arrayOf(
|
||||
@ -62,6 +73,25 @@ class CustomSeekbarColorBytecodePatch : BytecodePatch() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return toResult(patchSuccessArray.indexOf(false))
|
||||
|
||||
val errorIndex: Int = patchSuccessArray.indexOf(false)
|
||||
|
||||
if (errorIndex == -1) {
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: CUSTOM_SEEKBAR_COLOR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("custom-seekbar-color")
|
||||
|
||||
return PatchResultSuccess()
|
||||
} else
|
||||
return PatchResultError("Instruction not found: $errorIndex")
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -11,9 +11,9 @@ object SeekbarTappingParentFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.implementation?.instructions?.any { instruction ->
|
||||
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.accessibilityProgressTimeLabelId
|
||||
methodDef.implementation?.instructions?.any {
|
||||
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.accessibilityProgressTimeLabelId
|
||||
} == true
|
||||
}
|
||||
)
|
@ -1,6 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
@ -10,21 +11,31 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints.SeekbarTappingFingerprint
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbartapping.fingerprints.SeekbarTappingParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.Method
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
@Name("enable-seekbar-tapping-bytecode-patch")
|
||||
@DependsOn([SharedResourcdIdPatch::class])
|
||||
@Patch
|
||||
@Name("enable-seekbar-tapping")
|
||||
@Description("Enables tap-to-seek on the seekbar of the video player.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
SharedResourcdIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekbarTappingBytecodePatch : BytecodePatch(
|
||||
class SeekbarTappingPatch : BytecodePatch(
|
||||
listOf(
|
||||
SeekbarTappingParentFingerprint,
|
||||
SeekbarTappingFingerprint
|
||||
@ -76,6 +87,19 @@ class SeekbarTappingBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return SeekbarTappingFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: ENABLE_SEEKBAR_TAPPING"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-seekbar-tapping")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.seekbartapping.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbartapping.bytecode.patch.SeekbarTappingBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
|
||||
@Patch
|
||||
@Name("enable-seekbar-tapping")
|
||||
@Description("Enables tap-to-seek on the seekbar of the video player.")
|
||||
@DependsOn(
|
||||
[
|
||||
SeekbarTappingBytecodePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekbarTappingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings2(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: ENABLE_SEEKBAR_TAPPING"
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"enable-seekbar-tapping"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,6 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
@ -11,19 +12,29 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints.TimeCounterFingerprint
|
||||
import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.fingerprints.TimeCounterParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints.TimeCounterFingerprint
|
||||
import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.fingerprints.TimeCounterParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch
|
||||
import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT
|
||||
|
||||
@DependsOn([HookTimebarPatch::class, SharedResourcdIdPatch::class])
|
||||
@Name("hide-time-and-seekbar-bytecode-patch")
|
||||
@Patch
|
||||
@Name("hide-time-and-seekbar")
|
||||
@Description("Hides progress bar and time counter on videos.")
|
||||
@DependsOn(
|
||||
[
|
||||
HookTimebarPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourcdIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideTimeAndSeekbarBytecodePatch : BytecodePatch(
|
||||
class HideTimeAndSeekbarPatch : BytecodePatch(
|
||||
listOf(
|
||||
TimeCounterParentFingerprint
|
||||
)
|
||||
@ -49,6 +60,19 @@ class HideTimeAndSeekbarBytecodePatch : BytecodePatch(
|
||||
} ?: return TimeCounterFingerprint.toErrorResult()
|
||||
} ?: return TimeCounterParentFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: HIDE_TIME_AND_SEEKBAR"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-time-and-seekbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.timeandseekbar.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.layout.seekbar.timeandseekbar.bytecode.patch.HideTimeAndSeekbarBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper
|
||||
|
||||
@Patch
|
||||
@Name("hide-time-and-seekbar")
|
||||
@Description("Hides progress bar and time counter on videos.")
|
||||
@DependsOn(
|
||||
[
|
||||
HideTimeAndSeekbarBytecodePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideTimeAndSeekbarPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings2(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: SEEKBAR",
|
||||
"SETTINGS: HIDE_TIME_AND_SEEKBAR"
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"hide-time-and-seekbar"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user