We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我的使用场景是这样的 //---------------LaunchUIHook--------------- public class LaunchUIHook implements IActivityHook { @OverRide public void onMMActivityOptionsMenuCreated(@NotNull Activity activity, @NotNull Menu menu) { XposedBridge.log("LaunchUIHook: onMMActivityOptionsMenuCreated"); }
@Override public void onActivityCreating(@NotNull Activity activity, @Nullable Bundle savedInstanceState) { XposedBridge.log("LaunchUIHook: onActivityCreating"); } @Override public void onActivityStarting(@NotNull Activity activity) { XposedBridge.log("LaunchUIHook: onActivityStarting"); } @Override public void onActivityResuming(@NotNull Activity activity) { XposedBridge.log("LaunchUIHook: onActivityResuming"); }
}
//---------------LaunchUI--------------- public class LaunchUI extends LaunchUIHook {
@Override public void onMMActivityOptionsMenuCreated(@NotNull Activity activity, @NotNull Menu menu) { XposedBridge.log("LaunchUI: onMMActivityOptionsMenuCreated"); } @Override public void onActivityStarting(@NotNull Activity activity) { XposedBridge.log("LaunchUI: onActivityStarting"); }
如上面两个类,我想在父类LaunchUIHook实现一些默认方法,然后再子类LaunchUI上在重写部分方法实现某些具体业务,注册插件子类LaunchUI对象。然而发现父类的onActivityCreating、onActivityResuming方法都没有触发到,在spellbook源码打log发现EventCenter里 private fun Any.hasEvent(event: String) = this::class.java.declaredMethods.any { it.name == event } 推测在这里导致连钩子都没有挂上,从而父类LaunchUIHook的方法都没法触发。 我把declaredMethods改成methods确保连父类方法都读取,试验成功,log都能按照预想的方式打印出来了。
刚看此框架第二天,不知道这样魔改会不会引起问题,不知道是否出于某些考虑而采用declaredMethods?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我的使用场景是这样的
//---------------LaunchUIHook---------------
public class LaunchUIHook implements IActivityHook {
@OverRide
public void onMMActivityOptionsMenuCreated(@NotNull Activity activity, @NotNull Menu menu) {
XposedBridge.log("LaunchUIHook: onMMActivityOptionsMenuCreated");
}
}
//---------------LaunchUI---------------
public class LaunchUI extends LaunchUIHook {
}
如上面两个类,我想在父类LaunchUIHook实现一些默认方法,然后再子类LaunchUI上在重写部分方法实现某些具体业务,注册插件子类LaunchUI对象。然而发现父类的onActivityCreating、onActivityResuming方法都没有触发到,在spellbook源码打log发现EventCenter里
private fun Any.hasEvent(event: String) =
this::class.java.declaredMethods.any { it.name == event }
推测在这里导致连钩子都没有挂上,从而父类LaunchUIHook的方法都没法触发。
我把declaredMethods改成methods确保连父类方法都读取,试验成功,log都能按照预想的方式打印出来了。
刚看此框架第二天,不知道这样魔改会不会引起问题,不知道是否出于某些考虑而采用declaredMethods?
The text was updated successfully, but these errors were encountered: