fix(YouTube - Hide seekbar): Do not hide player seekbar if hide feed seekbar is enabled (#4333)
This commit is contained in:

committed by
GitHub

parent
c84eb82ae1
commit
f5cf6f2a44
@ -34,6 +34,19 @@ internal val shortsSeekbarColorFingerprint = fingerprint {
|
||||
literal { reelTimeBarPlayedColorId }
|
||||
}
|
||||
|
||||
internal val playerSeekbarHandleColorFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
|
||||
parameters("Landroid/content/Context;")
|
||||
literal { ytStaticBrandRedId }
|
||||
}
|
||||
|
||||
internal val watchHistoryMenuUseProgressDrawableFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returns("V")
|
||||
parameters("L")
|
||||
literal { -1712394514 }
|
||||
}
|
||||
|
||||
internal val lithoLinearGradientFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.STATIC)
|
||||
returns("Landroid/graphics/LinearGradient;")
|
||||
|
@ -14,6 +14,7 @@ import app.revanced.patches.youtube.layout.theme.lithoColorHookPatch
|
||||
import app.revanced.patches.youtube.layout.theme.lithoColorOverrideHook
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_46_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_49_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
@ -42,6 +43,8 @@ internal var inlineTimeBarPlayedNotHighlightedColorId = -1L
|
||||
private set
|
||||
internal var ytYoutubeMagentaColorId = -1L
|
||||
private set
|
||||
internal var ytStaticBrandRedId = -1L
|
||||
private set
|
||||
|
||||
internal const val splashSeekbarColorAttributeName = "splash_custom_seekbar_color"
|
||||
|
||||
@ -69,6 +72,10 @@ private val seekbarColorResourcePatch = resourcePatch {
|
||||
"color",
|
||||
"yt_youtube_magenta",
|
||||
]
|
||||
ytStaticBrandRedId = resourceMappings[
|
||||
"attr",
|
||||
"ytStaticBrandRed",
|
||||
]
|
||||
|
||||
// Modify the resume playback drawable and replace the progress bar with a custom drawable.
|
||||
document("res/drawable/resume_playback_progressbar_drawable.xml").use { document ->
|
||||
@ -237,6 +244,42 @@ val seekbarColorPatch = bytecodePatch(
|
||||
|
||||
// 19.25+ changes
|
||||
|
||||
playerSeekbarHandleColorFingerprint.method.apply {
|
||||
val index = indexOfFirstLiteralInstructionOrThrow(ytStaticBrandRedId)
|
||||
val insertIndex = indexOfFirstInstructionOrThrow(index, Opcode.MOVE_RESULT)
|
||||
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex + 1,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getSeekbarScrubHandleColor(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
// If hiding feed seekbar thumbnails, then turn off the cairo gradient
|
||||
// of the watch history menu items as they use the same gradient as the
|
||||
// player and there is no easy way to distinguish which to use a transparent color.
|
||||
if (is_19_34_or_greater) {
|
||||
watchHistoryMenuUseProgressDrawableFingerprint.method.apply {
|
||||
val progressIndex = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == "Landroid/widget/ProgressBar;" && reference.name == "setMax"
|
||||
}
|
||||
val index = indexOfFirstInstructionOrThrow(progressIndex, Opcode.MOVE_RESULT)
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
addInstructions(
|
||||
index + 1,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->showWatchHistoryProgressDrawable(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
lithoLinearGradientFingerprint.method.addInstruction(
|
||||
0,
|
||||
"invoke-static/range { p4 .. p5 }, $EXTENSION_CLASS_DESCRIPTOR->setLinearGradient([I[F)V"
|
||||
@ -259,7 +302,7 @@ val seekbarColorPatch = bytecodePatch(
|
||||
addInstructions(
|
||||
index + 1,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getLinearGradient([I)[I
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getLinearGradient([I)[I
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
|
Reference in New Issue
Block a user