mirror of
https://github.com/revanced/revanced-patches
synced 2025-02-24 14:01:12 +01:00
feat: compact-header
patch
This commit is contained in:
parent
f0bb6544ed
commit
83753bacf8
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.music.layout.compactheader.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.apps.youtube.music", arrayOf("5.14.53")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class CompactHeaderCompatibility
|
@ -0,0 +1,33 @@
|
|||||||
|
package app.revanced.patches.music.layout.compactheader.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("compact-header-constructor-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Llcz;", "<init>"
|
||||||
|
)
|
||||||
|
@CompactHeaderCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object CompactHeaderConstructorFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L"), listOf(
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST
|
||||||
|
)
|
||||||
|
)
|
@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.music.layout.compactheader.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility
|
||||||
|
import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction11x
|
||||||
|
|
||||||
|
@Patch(false)
|
||||||
|
@Name("compact-header")
|
||||||
|
@Description("Hides the music category bar at the top of the homepage.")
|
||||||
|
@CompactHeaderCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class CompactHeaderPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
CompactHeaderConstructorFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val result = CompactHeaderConstructorFingerprint.result!!
|
||||||
|
val method = result.mutableMethod
|
||||||
|
|
||||||
|
val insertIndex = result.patternScanResult!!.endIndex
|
||||||
|
val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA
|
||||||
|
method.addInstructions(
|
||||||
|
insertIndex, """
|
||||||
|
const/16 v0, 0x8
|
||||||
|
invoke-virtual {v${register}, v0}, Landroid/view/View;->setVisibility(I)V
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user