WEBVTT

00:00.080 --> 00:00.960
Welcome back.

00:01.280 --> 00:08.240
Now let's call those functions from our fabs open Uber clone map.

00:08.240 --> 00:11.160
And here expandable fab.

00:11.200 --> 00:14.120
Let me create two expandable fabs.

00:14.160 --> 00:15.440
Additional fabs.

00:15.440 --> 00:17.640
And here scroll down.

00:17.640 --> 00:23.080
This is the second floating action button for drawing map drawing route.

00:23.080 --> 00:32.040
And before the clear markers fab I need to create another two floating action buttons.

00:32.280 --> 00:35.760
So copy this paste it here first time.

00:35.760 --> 00:41.320
And the second time we have request right draw route.

00:41.640 --> 00:47.160
The third one is adding markers to multi points list.

00:47.160 --> 00:55.240
So this floating action button will add the markers to the multi points list.

00:55.280 --> 01:04.740
The expanded equals to false and set on a place multi place multi markers.

01:04.740 --> 01:14.180
Then scroll down instead of draw a route I need to make it add marker, add multi markers, then scroll

01:14.180 --> 01:17.260
down to the fourth floating action button.

01:17.260 --> 01:18.820
Instead of drawing route.

01:18.820 --> 01:23.220
Here we need to set the route between multiple markers.

01:23.220 --> 01:24.780
Remove and draw route.

01:24.820 --> 01:28.740
Set it to on multiple markers route.

01:28.780 --> 01:32.980
Now let's pass those to Lambda expressions.

01:32.980 --> 01:40.300
Here in the constructor pass on place multiple markers and on multiple markers route.

01:40.420 --> 01:47.460
Those are two lambda expressions having nothing in the parameters and returning nothing.

01:47.620 --> 01:49.900
Go back to Uber clone map.

01:49.900 --> 01:57.190
Here we need to specify the logic behind the newly created Parameters.

01:57.310 --> 02:02.550
Let's start with on a place multiple markers.

02:02.550 --> 02:10.310
Here it's simply specified as a toggle to enable or disable adding markers to a list.

02:10.310 --> 02:18.470
So here we need to create like a flag, a boolean in order to allow the user to add markers to the list

02:18.470 --> 02:19.430
or not.

02:19.430 --> 02:27.510
Since when the user clicks on the map, there are markers created on the map on the touched position.

02:27.510 --> 02:32.950
We need to enable or disable adding those markers to the multiple list.

02:32.950 --> 02:41.390
So for this purpose I created this floating action button and on place multiple markers parameter.

02:41.670 --> 02:49.990
In order to allow this enable or disable adding markers to the list, I'm going to create a new variable

02:50.150 --> 02:51.550
up here.

02:51.910 --> 02:55.030
Outside the box that contains the Google map.

02:55.330 --> 03:01.650
We need to create the variables to control the multiple marker selection status.

03:01.690 --> 03:06.610
VAR is adding markers enabled by.

03:06.650 --> 03:11.450
Remember mutable state flow and set it to false.

03:11.490 --> 03:23.210
Then val mutable multiple markers list equals to remember mutable state list of lat long.

03:23.250 --> 03:29.930
Also, we need to create a variable for holding list of multiple points.

03:29.930 --> 03:41.010
So route multi points by ViewModel dot multi points dot collect as state with life cycle.

03:41.250 --> 03:49.090
If you notice I'm not lecturing anything because those are simple and in the previous videos I lectured

03:49.090 --> 03:51.730
about them exactly like this.

03:51.970 --> 03:54.750
Exactly like this and others.

03:54.790 --> 04:00.190
Okay, so there's no need to mention them in the current videos.

04:00.230 --> 04:00.710
Okay.

04:00.870 --> 04:03.870
So let's use those variables.

04:03.990 --> 04:05.230
Scroll down.

04:05.230 --> 04:12.270
And here on place multiple markers we need to specify those points.

04:12.270 --> 04:15.950
So enable or disable adding markers to the list.

04:15.990 --> 04:19.310
If it is enabled go and disabled.

04:19.310 --> 04:21.710
If it is disabled go and enabled.

04:21.710 --> 04:24.550
So this is the switch and this is a toggle.

04:24.590 --> 04:28.590
Now let's specify the multi markers route.

04:28.630 --> 04:34.790
If is adding enabled go and fetch the ViewModel.

04:34.830 --> 04:38.630
Fetch multiple route marker okay.

04:38.750 --> 04:41.750
Go and execute this function.

04:41.790 --> 04:46.590
Now let's make use of this add marker to Multi Points route.

04:46.630 --> 04:56.280
Scroll up and control the click on map click so here if is adding markers enabled.

04:56.280 --> 05:00.320
So here I am checking if multiple marker enabled.

05:00.320 --> 05:08.280
Go and add the multiple markers list and add the mile at long mile marker.

05:08.320 --> 05:13.640
Also store markers to waypoints api url.

05:13.680 --> 05:20.800
Okay, so the idea here, if we are clicking on the map, there is a new marker being displayed.

05:20.960 --> 05:27.840
But if adding markers are enabled then go and add it to the marker.

05:27.840 --> 05:33.280
And here go and store the marker to waypoints api URL.

05:33.320 --> 05:33.840
Okay.

05:34.040 --> 05:39.880
So in this case we are storing the marker to the list if it is enabled.

05:40.040 --> 05:45.840
If not, just go and display it and set the selected location to my marker.
