Skip to content

Commit 1efbd2e

Browse files
committed
Fix lambda return type for Kotlin in Java demo
1 parent 563dd66 commit 1efbd2e

File tree

1 file changed

+10
-8
lines changed
  • demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java

1 file changed

+10
-8
lines changed

demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java/HookEntry.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import com.highcapable.yukihookapi.hook.xposed.bridge.event.YukiXposedEvent;
3636
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit;
3737

38+
import kotlin.Unit;
39+
3840
// ========
3941
// This only demonstrates how to use it in the Java case (Java 1.8+ only)
4042
// The code here is for demonstration only, does not mean that it will work in the future, Demo will only sync the latest Kotlin usage
@@ -86,18 +88,18 @@ public void onHook() {
8688
i.afterHook(a -> {
8789
Activity instance = ((Activity) a.getInstance());
8890
instance.setTitle(instance.getTitle() + " [Active]");
89-
return null;
91+
return Unit.INSTANCE;
9092
});
91-
return null;
93+
return Unit.INSTANCE;
9294
});
93-
return null;
95+
return Unit.INSTANCE;
9496
});
95-
return null;
97+
return Unit.INSTANCE;
9698
});
9799
// The rest of the code has been omitted, you can continue to refer to the above method to complete
98100
// 余下部分代码已略 - 可继续参考上述方式完成
99101
// ...
100-
return null;
102+
return Unit.INSTANCE;
101103
});
102104
}
103105

@@ -111,17 +113,17 @@ public void onXposedEvent() {
111113
event.onInitZygote(startupParam -> {
112114
// Write the startupParam method here
113115
// 这里编写 startupParam 方法
114-
return null;
116+
return Unit.INSTANCE;
115117
});
116118
event.onHandleLoadPackage(loadPackageParam -> {
117119
// Write the loadPackageParam method here
118120
// 这里编写 loadPackageParam 方法
119-
return null;
121+
return Unit.INSTANCE;
120122
});
121123
event.onHandleInitPackageResources(resourcesParam -> {
122124
// Write the resourcesParam method here
123125
// 这里编写 resourcesParam 方法
124-
return null;
126+
return Unit.INSTANCE;
125127
});
126128
}
127129
}

0 commit comments

Comments
 (0)