mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-26 12:11:02 +00:00
fix minimal miniplayer using incorrectly sized bold icons
This commit is contained in:
@@ -379,6 +379,19 @@ public final class MiniplayerPatch {
|
||||
return original;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static boolean allowBoldIcons(boolean original) {
|
||||
if (CURRENT_TYPE == MINIMAL) {
|
||||
// Minimal player does not have the correct pause/play icon (it's too large).
|
||||
// Use the non bold icons instead.
|
||||
return false;
|
||||
}
|
||||
|
||||
return original;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
|
||||
@@ -207,3 +207,13 @@ internal val playerOverlaysLayoutFingerprint by fingerprint {
|
||||
method.definingClass == YOUTUBE_PLAYER_OVERLAYS_LAYOUT_CLASS_NAME
|
||||
}
|
||||
}
|
||||
|
||||
internal val miniplayerSetIconsFingerprint by fingerprint {
|
||||
returns("V")
|
||||
parameters("I", "Ljava/lang/Runnable;")
|
||||
instructions(
|
||||
resourceLiteral(ResourceType.DRAWABLE, "yt_fill_pause_white_36"),
|
||||
resourceLiteral(ResourceType.DRAWABLE, "yt_fill_pause_black_36")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||
|
||||
@@ -321,7 +322,7 @@ val miniplayerPatch = bytecodePatch(
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getMiniplayerDefaultSize(I)I
|
||||
move-result v$register
|
||||
""",
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
@@ -386,6 +387,30 @@ val miniplayerPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region fix minimal miniplayer using the wrong pause/play bold icons.
|
||||
|
||||
if (is_20_31_or_greater) {
|
||||
miniplayerSetIconsFingerprint.method.apply {
|
||||
findInstructionIndicesReversedOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
opcode == Opcode.INVOKE_INTERFACE
|
||||
&& reference?.returnType == "Z" && reference.parameterTypes.isEmpty()
|
||||
}.forEach { index ->
|
||||
val register = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
|
||||
addInstructions(
|
||||
index + 2,
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->allowBoldIcons(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region Add hooks to hide modern miniplayer buttons.
|
||||
|
||||
listOf(
|
||||
|
||||
Reference in New Issue
Block a user