RxBus — an Event Bus Based on RxJava and Optimized for Android

Image for post
Image for post

What it’s all about

Usage tips

Bus bus = BusProvider.getInstance();
@Subscribe
public void onEvent(SomeEvent event) {
// TODO: Do something
}
CustomSubscriber<SomeEvent> customSubscriber = bus.obtainSubscriber(SomeEvent.class,
new Consumer<SomeEvent>() {
@Override
public void accept(SomeEvent someEvent) throws Exception {
// TODO: Do something
}
})
.withFilter(new Predicate<SomeEvent>() {
@Override
public boolean test(SomeEvent someEvent) throws Exception {
return "Specific message".equals(someEvent.message);
}
})
.withScheduler(Schedulers.trampoline());
bus.register(this);
bus.registerSubscriber(this, customSubscriber);
bus.unregister(this);
bus.post(new SomeEvent("Message"));
compile 'com.github.anadea:rxbus:1.0.1'

We build software and we do it right | Custom web and mobile development | https://anadea.info/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store