mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-30 06:34:28 +02:00
fix(YouTube - Seekbar): Correctly hide the feed seekbar with target 20.07
This commit is contained in:
parent
9f0efab3a1
commit
ddc6e4c34f
@ -226,6 +226,7 @@ public final class SeekbarColorPatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String loadRawResourceAsString(int resourceId) {
|
private static String loadRawResourceAsString(int resourceId) {
|
||||||
|
//noinspection CharsetObjectCanBeUsed
|
||||||
try (InputStream inputStream = Utils.getContext().getResources().openRawResource(resourceId);
|
try (InputStream inputStream = Utils.getContext().getResources().openRawResource(resourceId);
|
||||||
Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8.name()).useDelimiter("\\A")) {
|
Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8.name()).useDelimiter("\\A")) {
|
||||||
return scanner.next();
|
return scanner.next();
|
||||||
@ -281,6 +282,20 @@ public final class SeekbarColorPatch {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
|
* 19.49+
|
||||||
|
*/
|
||||||
|
public static int[] getPlayerLinearGradient(int[] original, int x0, int y1) {
|
||||||
|
// This hook is used for both the player and the feed.
|
||||||
|
// Feed usage always has x0 and y1 value of zero, and the player is always non zero.
|
||||||
|
if (HIDE_SEEKBAR_THUMBNAIL_ENABLED && x0 == 0 && y1 == 0) {
|
||||||
|
return HIDDEN_SEEKBAR_GRADIENT_COLORS;
|
||||||
|
}
|
||||||
|
return getPlayerLinearGradient(original);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injection point.
|
||||||
|
* Pre 19.49
|
||||||
*/
|
*/
|
||||||
public static int[] getPlayerLinearGradient(int[] original) {
|
public static int[] getPlayerLinearGradient(int[] original) {
|
||||||
return SEEKBAR_CUSTOM_COLOR_ENABLED
|
return SEEKBAR_CUSTOM_COLOR_ENABLED
|
||||||
|
@ -84,31 +84,14 @@ internal val playerLinearGradientFingerprint = fingerprint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 19.46 - 19.47
|
* 19.25 - 19.47
|
||||||
*/
|
*/
|
||||||
internal val playerLinearGradientLegacy1946Fingerprint = fingerprint {
|
internal val playerLinearGradientLegacyFingerprint = fingerprint {
|
||||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
|
||||||
parameters("I", "I", "I", "I")
|
|
||||||
returns("V")
|
returns("V")
|
||||||
opcodes(
|
opcodes(
|
||||||
Opcode.FILLED_NEW_ARRAY,
|
Opcode.FILLED_NEW_ARRAY,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
)
|
)
|
||||||
custom { method, _ ->
|
|
||||||
method.name == "setBounds" && method.containsLiteralInstruction(ytYoutubeMagentaColorId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 19.25 - 19.45
|
|
||||||
*/
|
|
||||||
internal val playerLinearGradientLegacy1925Fingerprint = fingerprint {
|
|
||||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
|
|
||||||
parameters("Landroid/content/Context;")
|
|
||||||
opcodes(
|
|
||||||
Opcode.FILLED_NEW_ARRAY,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
|
||||||
)
|
|
||||||
literal { ytYoutubeMagentaColorId }
|
literal { ytYoutubeMagentaColorId }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.layout.seekbar
|
package app.revanced.patches.youtube.layout.seekbar
|
||||||
|
|
||||||
|
import app.revanced.patcher.Fingerprint
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
@ -310,14 +311,15 @@ val seekbarColorPatch = bytecodePatch(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
val playerFingerprint =
|
val playerFingerprint: Fingerprint
|
||||||
if (is_19_49_or_greater) {
|
val checkGradientCoordinates: Boolean
|
||||||
playerLinearGradientFingerprint
|
if (is_19_49_or_greater) {
|
||||||
} else if (is_19_46_or_greater) {
|
playerFingerprint = playerLinearGradientFingerprint
|
||||||
playerLinearGradientLegacy1946Fingerprint
|
checkGradientCoordinates = true
|
||||||
} else {
|
} else {
|
||||||
playerLinearGradientLegacy1925Fingerprint
|
playerFingerprint = playerLinearGradientLegacyFingerprint
|
||||||
}
|
checkGradientCoordinates = false
|
||||||
|
}
|
||||||
|
|
||||||
playerFingerprint.let {
|
playerFingerprint.let {
|
||||||
it.method.apply {
|
it.method.apply {
|
||||||
@ -326,10 +328,17 @@ val seekbarColorPatch = bytecodePatch(
|
|||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index + 1,
|
index + 1,
|
||||||
"""
|
if (checkGradientCoordinates) {
|
||||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([I)[I
|
"""
|
||||||
move-result-object v$register
|
invoke-static { v$register, p0, p1 }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([III)[I
|
||||||
"""
|
move-result-object v$register
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
|
"""
|
||||||
|
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerLinearGradient([I)[I
|
||||||
|
move-result-object v$register
|
||||||
|
"""
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user