mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-12 05:07:46 +02:00
feat(message_logger): deleted indicator
This commit is contained in:
@ -5,6 +5,7 @@ import org.jf.dexlib2.iface.ClassDef
|
||||
|
||||
fun ClassDef.isEnum(): Boolean = accessFlags and AccessFlags.ENUM.value != 0
|
||||
fun ClassDef.isAbstract(): Boolean = accessFlags and AccessFlags.ABSTRACT.value != 0
|
||||
fun ClassDef.isInterface(): Boolean = accessFlags and AccessFlags.INTERFACE.value != 0
|
||||
fun ClassDef.isFinal(): Boolean = accessFlags and AccessFlags.FINAL.value != 0
|
||||
|
||||
fun ClassDef.hasStaticConstructorString(string: String): Boolean = methods.any {
|
||||
|
@ -0,0 +1,37 @@
|
||||
package me.rhunk.snapmapper.impl
|
||||
|
||||
import me.rhunk.snapmapper.AbstractClassMapper
|
||||
import me.rhunk.snapmapper.MapperContext
|
||||
import me.rhunk.snapmapper.ext.getClassName
|
||||
import me.rhunk.snapmapper.ext.isAbstract
|
||||
import me.rhunk.snapmapper.ext.isInterface
|
||||
import java.lang.reflect.Modifier
|
||||
|
||||
class ViewBinderMapper : AbstractClassMapper() {
|
||||
override fun run(context: MapperContext) {
|
||||
for (clazz in context.classes) {
|
||||
if (!clazz.isAbstract() || clazz.isInterface()) continue
|
||||
|
||||
val getViewMethod = clazz.methods.firstOrNull { it.returnType == "Landroid/view/View;" && it.parameterTypes.size == 0 } ?: continue
|
||||
|
||||
// update view
|
||||
clazz.methods.filter {
|
||||
Modifier.isAbstract(it.accessFlags) && it.parameterTypes.size == 1 && it.parameterTypes[0] == "Landroid/view/View;" && it.returnType == "V"
|
||||
}.also {
|
||||
if (it.size != 1) return@also
|
||||
}.firstOrNull() ?: continue
|
||||
|
||||
val bindMethod = clazz.methods.filter {
|
||||
Modifier.isAbstract(it.accessFlags) && it.parameterTypes.size == 2 && it.parameterTypes[0] == it.parameterTypes[1] && it.returnType == "V"
|
||||
}.also {
|
||||
if (it.size != 1) return@also
|
||||
}.firstOrNull() ?: continue
|
||||
|
||||
context.addMapping("ViewBinder",
|
||||
"class" to clazz.getClassName(),
|
||||
"bindMethod" to bindMethod.name,
|
||||
"getViewMethod" to getViewMethod.name
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ class TestMappings {
|
||||
CompositeConfigurationProviderMapper::class,
|
||||
ScoreUpdateMapper::class,
|
||||
FriendRelationshipChangerMapper::class,
|
||||
ViewBinderMapper::class
|
||||
)
|
||||
|
||||
val gson = GsonBuilder().setPrettyPrinting().create()
|
||||
|
Reference in New Issue
Block a user