WEBVTT

00:00.080 --> 00:01.840
Let's run our application.

00:01.880 --> 00:02.520
Here we go.

00:02.560 --> 00:03.880
We have this error.

00:04.120 --> 00:05.160
Dagger missing.

00:05.160 --> 00:07.640
Binding can't be provided.

00:07.640 --> 00:12.400
String can't be provided without inject constructor or provides annotation.

00:12.640 --> 00:19.760
So the only thing that we provide as a string here is the maps API key.

00:19.880 --> 00:25.920
And if we open the directions repository no need for the API key.

00:26.080 --> 00:32.560
If we go to directions repository implementation we need this API key for the response.

00:32.560 --> 00:38.640
So let me change this code because we didn't use this map.

00:38.640 --> 00:40.400
Provide maps API key.

00:40.640 --> 00:47.360
Let me remove this and call provide app maps API key function.

00:47.560 --> 00:49.640
Run it again and here we go.

00:49.680 --> 00:50.960
This is our map.

00:51.000 --> 00:54.800
You can click on the map to display this marker.

00:55.040 --> 01:00.970
And if you click on the marker you'll get selected location with the coordinates.

01:01.210 --> 01:08.450
Now let's get the route between the current position and the selected marker.

01:08.490 --> 01:11.650
Open expandable fab here.

01:11.690 --> 01:20.210
When I click Draw root button, I need to display the current location that the root between the current

01:20.210 --> 01:22.770
location and the selected location.

01:22.770 --> 01:33.250
So in order to do that here inside the extended floating action button, we need to call the Ondraw

01:33.370 --> 01:34.090
route.

01:34.130 --> 01:40.010
This is passed as a parameter inside this expandable fab.

01:40.170 --> 01:46.490
So on draw route it's a lambda expression returning nothing.

01:46.690 --> 01:50.130
Then let's move to the Uber clone map.

01:50.410 --> 01:55.570
Here in expandable fabs we need to pass the parameter.

01:55.610 --> 02:03.820
So here on draw route this is a lambda expression checking if marker position is not null.

02:04.020 --> 02:05.180
What we need to do.

02:05.420 --> 02:13.980
Call the ViewModel dot fetch route from current position to the marker and pass the marker position

02:13.980 --> 02:16.260
as the marker parameter.

02:16.300 --> 02:18.940
Okay, let me run the application.

02:18.940 --> 02:29.500
Go to the current position, scroll to here and you can select any place I need to go to Santa Rosa.

02:29.700 --> 02:31.620
Select the fab.

02:31.620 --> 02:37.300
Click on Draw Route, select the marker and then click Draw Route.

02:37.340 --> 02:39.020
Nothing drawn on the map.

02:39.020 --> 02:45.500
Maybe because we didn't define the polyline or there is an error in our request.

02:45.500 --> 02:47.620
So let me check the map.

02:47.620 --> 02:53.580
If we go back to the map here we have the marker position markers and user location.

02:53.580 --> 02:57.980
Those are the shapes that we drawn on the marker.

02:58.260 --> 02:59.520
So on the map.

02:59.520 --> 03:02.800
So here we need to draw the route for this.

03:02.840 --> 03:05.560
Use the route points dot.

03:05.680 --> 03:06.320
Let.

03:06.360 --> 03:13.480
If it is not null, go and create this lambda using the route points and draw polyline.

03:13.640 --> 03:17.360
Having the points equals to the route points.

03:17.400 --> 03:22.000
The color would be red and width is eight.

03:22.520 --> 03:32.080
Run again and if the polyline or the route is not visible on the map, so there is an error in the request

03:32.080 --> 03:33.040
and response.

03:33.080 --> 03:39.000
Again this is the current position and this is the marker Santa Rosa selected.

03:39.000 --> 03:40.800
And click on draw route.

03:40.840 --> 03:42.560
This is the selected location.

03:42.560 --> 03:45.720
And this is the drone a polyline.

03:45.720 --> 03:46.920
Congratulations guys.

03:46.920 --> 03:52.960
This is the route displayed between the current position and the selected marker.
