Skip to content

Instantly share code, notes, and snippets.

@amanjeetsingh150
Last active May 11, 2019 07:19
Show Gist options
  • Save amanjeetsingh150/48b07f8915d604844ec499d530139755 to your computer and use it in GitHub Desktop.
Save amanjeetsingh150/48b07f8915d604844ec499d530139755 to your computer and use it in GitHub Desktop.
JourneyEventBus.getInstance().getOnJourneyEvent()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
if (o instanceof BeginJourneyEvent) {
Snackbar.make(linearLayout, "Journey has started",
Snackbar.LENGTH_SHORT).show();
} else if (o instanceof EndJourneyEvent) {
Snackbar.make(linearLayout, "Journey has ended",
Snackbar.LENGTH_SHORT).show();
} else if (o instanceof CurrentJourneyEvent) {
/*
* This can be used to receive the current location update of the car
*/
//Log.d(TAG,"Current "+((CurrentJourneyEvent) o).getCurrentLatLng());
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment