Skip to content

Instantly share code, notes, and snippets.

@amanjeetsingh150
Last active May 11, 2019 07:19
Show Gist options
  • Save amanjeetsingh150/df98c5125f997b37d1368da7ca0a1698 to your computer and use it in GitHub Desktop.
Save amanjeetsingh150/df98c5125f997b37d1368da7ca0a1698 to your computer and use it in GitHub Desktop.
/**
Begin of the journey when index of LatLng in list will be 0.
**/
if (index == 0) {
BeginJourneyEvent beginJourneyEvent = new BeginJourneyEvent();
beginJourneyEvent.setBeginLatLng(startPosition);
JourneyEventBus.getInstance().setOnJourneyBegin(beginJourneyEvent);
}
/**
End of the journey when index of LatLng in list will be last that is size()-1.
**/
if (index == polyLineList.size() - 1) {
EndJourneyEvent endJourneyEvent = new EndJourneyEvent();
endJourneyEvent.setEndJourneyLatLng(
new LatLng(polyLineList.get(index).latitude,
polyLineList.get(index).longitude));
JourneyEventBus.getInstance().setOnJourneyEnd(endJourneyEvent);
}
/**
In CallBack of ValueAnimator we can get current location as
**/
CurrentJourneyEvent currentJourneyEvent = new CurrentJourneyEvent();
currentJourneyEvent.setCurrentLatLng(newPos);
JourneyEventBus.getInstance().setOnJourneyUpdate(currentJourneyEvent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment