fix(youtube/theme): apply custom seekbar color to video thumbnails (#2085)

This commit is contained in:
LisoUseInAIKyrios
2023-05-11 10:22:37 +04:00
committed by GitHub
parent 1b76da8559
commit d4970273ad
13 changed files with 233 additions and 133 deletions

View File

@ -0,0 +1,16 @@
package app.revanced.util.patch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
/**
* @return the first constant instruction with the resource id, or -1 if not found.
*/
fun Method.indexOfFirstConstantInstruction(constantValue: Long): Int {
return implementation?.let {
it.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
}
} ?: -1
}