private void HomeFragment_CurrentLocation(object sender, LocationCallbackHelper.OnLocationCaptionEventArgs e)
        {
            mLastLocation = e.Location;
            mLastLatLng   = new LatLng(mLastLocation.Latitude, mLastLocation.Longitude);

            if (availablityListener != null)
            {
                availablityListener.UpdateLocation(mLastLocation);
            }

            if (availablityStatus && availablityListener == null)
            {
                TakeDriverOnline();
            }

            switch (statusEnum)
            {
            case RideStatusEnum.Accepted:
            {
                //Update and Animate driver movement to pick up location
                LatLng pickupLatLng = new LatLng(newRideDetails.PickupLat, newRideDetails.PickupLng);
                mapHelper.UpdateMovement(mLastLatLng, pickupLatLng, ToPositionOf.Rider);

                //Updates Location in rideRequest Table, so that Rider can receive Updates
                newTripEventListener.UpdateLocation(mLastLocation);
                break;
            }

            case RideStatusEnum.Arrived:
                newTripEventListener.UpdateLocation(mLastLocation);
                break;

            case RideStatusEnum.Ontrip:
            {
                //Update and animate driver movement to Destination
                LatLng destinationLatLng = new LatLng(newRideDetails.DestinationLat, newRideDetails.DestinationLng);
                mapHelper.UpdateMovement(mLastLatLng, destinationLatLng, ToPositionOf.Destination);

                //Update Location on firebase
                newTripEventListener.UpdateLocation(mLastLocation);
                break;
            }

            case RideStatusEnum.Cancelled:
                break;

            case RideStatusEnum.Normal:
                break;

            case RideStatusEnum.Ended:
                break;
            }
        }
Exemple #2
0
        private void MLocationCallback_MyLocation(object sender, LocationCallbackHelper.OnLocationCaptionEventArgs e)
        {
            _mLastlocation = e.Location;

            LatLng myposition = new LatLng(_mLastlocation.Latitude, _mLastlocation.Longitude);

            MainMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(myposition, 15));

            CurrentLocation?.Invoke(this, new OnLocationCaptionEventArgs {
                Location = e.Location
            });
        }
Exemple #3
0
        void MLocationCallback_MyLocation(object sender, LocationCallbackHelper.OnLocationCaptionEventArgs e)
        {
            mLastlocation = e.Location;

            //Update our Lastlocation on the Map
            LatLng myposition = new LatLng(mLastlocation.Latitude, mLastlocation.Longitude);

            mainMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(myposition, 15));

            //Sends Location to Mainactivity
            CurrentLocation?.Invoke(this, new OnLocationCaptionEventArgs {
                Location = e.Location
            });
        }