diff --git a/app/src/main/java/io/github/leafmoes/RemoveAudioTransition.kt b/app/src/main/java/io/github/leafmoes/RemoveAudioTransition.kt index 89b20fe64f..dfafcf32ec 100644 --- a/app/src/main/java/io/github/leafmoes/RemoveAudioTransition.kt +++ b/app/src/main/java/io/github/leafmoes/RemoveAudioTransition.kt @@ -22,32 +22,27 @@ package io.github.leafmoes -import android.content.Context -import com.github.kyuubiran.ezxhelper.utils.findMethod import com.github.kyuubiran.ezxhelper.utils.hookReplace import io.github.qauxv.base.annotation.FunctionHookEntry import io.github.qauxv.base.annotation.UiItemAgentEntry import io.github.qauxv.dsl.FunctionEntryRouter import io.github.qauxv.hook.CommonSwitchFunctionHook -import io.github.qauxv.util.Initiator +import io.github.qauxv.util.dexkit.DexKit +import io.github.qauxv.util.dexkit.RemoveAudioTransitionMethod import xyz.nextalone.util.throwOrTrue @FunctionHookEntry @UiItemAgentEntry -object RemoveAudioTransition : CommonSwitchFunctionHook("removeAudioTransition") { +object RemoveAudioTransition : CommonSwitchFunctionHook( + "removeAudioTransition", + targets = arrayOf(RemoveAudioTransitionMethod) +) { override val name: String get() = "移除语音面板多余过渡动画" override val description: String get() = "QQ语音面板左右滑动的时候因为这个动画导致UI重影\n故写此功能移除这个莫名其妙的动画" override val uiItemLocation: Array get() = FunctionEntryRouter.Locations.Simplify.CHAT_OTHER - override fun initOnce()= throwOrTrue { - Initiator.loadClass("com.tencent.mobileqq.activity.aio.audiopanel.AudioTransitionAnimManager") - .findMethod { - val paramsTypes = parameterTypes - parameterCount == 4 - && paramsTypes[0] == Int::class.javaPrimitiveType - && paramsTypes[1] == String::class.java - && paramsTypes[2] == Context::class.java - }.hookReplace { } + override fun initOnce() = throwOrTrue { + DexKit.requireMethodFromCache(RemoveAudioTransitionMethod).hookReplace { } } } \ No newline at end of file diff --git a/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt b/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt index a0814b71f3..5f6f062f92 100644 --- a/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt +++ b/app/src/main/java/io/github/qauxv/util/dexkit/DexKitTarget.kt @@ -789,7 +789,7 @@ data object Multiforward_Avatar_setListener_NT : DexKitTarget.UsingDexkit() { } data object AIOTextElementCtor : DexKitTarget.UsingStr() { - override val findMethod: Boolean = true; + override val findMethod: Boolean = true override val declaringClass = "com.tencent.mobileqq.aio.msg.AIOMsgElement.AIOTextElementCtor" override val traitString = arrayOf("textElement") override val filter = DexKitFilter.strInClsName("com/tencent/mobileqq/aio/msg") @@ -1023,3 +1023,10 @@ data object OriginalPhotoNT_onInitView : DexKitTarget.UsingDexkit() { override val declaringClass = "" override val filter: dexkitFilter = DexKitFilter.allowAll } + +data object RemoveAudioTransitionMethod : DexKitTarget.UsingStr() { + override val findMethod = true + override val traitString = arrayOf("getDrawable onCompositionLoaded lottieComposition is null or mIsDestroyed") + override val declaringClass = "Lcom/tencent/mobileqq/activity/aio/audiopanel/AudioTransitionAnimManager;" + override val filter = DexKitFilter.allowAll +} \ No newline at end of file