How can I use it in Kotlin?
verehu opened this issue · comments
huwei commented
In Kotlin, annotations is not support. When I use @subscribe, it show errors.
huwei commented
I had subscribe it like this,
@Subscribe(
thread = EventThread.MAIN_THREAD,
tags = arrayOf(Tag(BusTag.VideoPlay.PROGRESS_CHANGED))
)
fun onVideoProgressChanged(progress: Int) {
}
I post event in sub thread,
RxBus.get().post(BusTag.VideoPlay.PROGRESS_CHANGED,
(100 * 87L / 100L).toInt())
I debug the code,find the Int in Kotlin is not same as the Integer in java, so
Set<SubscriberEvent> wrappers = getSubscribersForEventType(new EventType(tag, clazz));
wrappers can't be found.It dispatch a DeadEvent.
Abdulmomen Bsruki commented
i got the same problem here
Carlos Hwang commented
Yes, the type here is not compatible.
huwei commented
@Blizzard-liu 自己修改源码解决了,不可能所有int类型的都改成String,这个还是很影响效率的。
Carlos Hwang commented
如果有兴趣,可以提交一个 pull request 过来。
Carlos Hwang commented
kssilvoza commented
Hello, when will the version with the Kotlin fix be released?
Carlos Hwang commented
@kssilvoza Already released for 2.0.1 version.
Carlos Hwang commented
@mozhou5555 already release 2.0.2 & 3.0.0