Commute Sample is a Sample Android Application that uses https://fake-poi-api.mytaxi.com API to get a list of vehicles. It takes coordinates of organ and destination points and returns a list of vehicles available between those two points. Commute Sample display the list of vehicle and all the related information available in response. It also includes maps that show the points where the vehicle is available and whenever the user selects any vehicle it shows a window where all the information regarding the vehicle is displayed. Users can also get routes from Source to Destination on click of a window in Maps.
Commute Sample App uses the API during SplashActivity and once data get fetched successfully, it passes the data to MainActivity. MainActivity includes BottomSheetNavigator with two Fragments “VehicleListFragment & DashboardFragment”.
VehicleListFragment is used to display the list of vehicles received in response. It arranges the list from String format using the below method which takes String as a parameter and returns a list of vehicles.
Utils.parseJSONToList(jsonObject: String)MutableList<Vehicle>
VehicleListFragment receives the list, it sets the same list to VehicleListAdapter which handles the view of each vehicle item in the list. VehicleListAdapter is subclass of RecyclerView.Adapter which includes certain native methods that bind the data with UI. On click of each vehicle list item, a MapsActivity will be opened which will help to display the current position of the vehicle with its bound, and at the top window will be displayed which shows information regarding the vehicle. If users wish to get navigation from Source to Destination then, they can click on Window at the top which will redirect them to Google Maps App with Source & Destination Information.