Example #1
0
        public void UpdateHomeViewState(HomeViewModelState state)
        {
            switch (state)
            {
            case HomeViewModelState.Review:
            case HomeViewModelState.AirportDetails:
                PickupInputDisabled      = true;
                DestinationInputDisabled = true;
                VehicleTypeInputDisabled = true;
                IsDestinationSelected    = false;
                IsPickupSelected         = false;
                break;

            case HomeViewModelState.PickDate:
            case HomeViewModelState.AirportPickDate:
                PickupInputDisabled      = true;
                DestinationInputDisabled = true;
                VehicleTypeInputDisabled = true;
                IsDestinationSelected    = false;
                IsPickupSelected         = false;
                break;

            case HomeViewModelState.Initial:
                PickupInputDisabled      = false;
                DestinationInputDisabled = false;
                VehicleTypeInputDisabled = false;
                IsDestinationSelected    = AddressSelectionMode == AddressSelectionMode.DropoffSelection;
                IsPickupSelected         = AddressSelectionMode == AddressSelectionMode.PickupSelection;
                break;
            }
        }
Example #2
0
        private void ChangeState(HomeViewModelState state)
        {
            if (state == HomeViewModelState.PickDate ||
                state == HomeViewModelState.AirportPickDate)
            {
                ((ViewGroup.MarginLayoutParams)_orderOptions.LayoutParameters).TopMargin = 0;

                SetSelectedOnBookLater(true);

                var intent = new Intent(this, typeof(DateTimePickerActivity));
                intent.PutExtra("UseAmPmFormat", ViewModel.Settings.DisplayTimePickerInTwelveHourFormat);
                StartActivityForResult(intent, (int)ActivityEnum.DateTimePicked);
            }
            else if (state == HomeViewModelState.AddressSearch)
            {
                _searchAddress.Open(AddressLocationType.Unspecified);
            }
            else if (state == HomeViewModelState.AirportSearch)
            {
                _searchAddress.Open(AddressLocationType.Airport);
            }
            else if (state == HomeViewModelState.TrainStationSearch)
            {
                _searchAddress.Open(AddressLocationType.Train);
            }
            else if (state == HomeViewModelState.Initial)
            {
                _searchAddress.Close();

                SetSelectedOnBookLater(false);
            }
        }
Example #3
0
        private void ProcessSingleOrNoFilteredAddresses(AddressLocationType filter, HomeViewModelState state)
        {
            var filteredAddress = AddressPicker.FilteredPlaces
                                  .Where(address => address.Address.AddressLocationType == filter)
                                  .ToArray();

            if (!filteredAddress.Any())
            {
                var localize = this.Services().Localize;
                this.Services().Message.ShowMessage(localize["FilteredAddresses_Error_Title"], localize["FilteredAddresses_Error_Message"]);

                return;
            }

            if (filteredAddress.Length == 1)
            {
                var address = filteredAddress
                              .Select(place => place.Address)
                              .First();

                AddressPicker.SelectAddress(address);

                return;
            }

            CurrentViewState = state;
        }
 private void HomeViewModelStateChanged(HomeViewModelState state)
 {
     if (state == HomeViewModelState.Initial || state == HomeViewModelState.BookingStatus || state == HomeViewModelState.ManualRidelinq || state == HomeViewModelState.DropOffAddressSelection)
     {
         IsMapDisabled = false;
     }
     else
     {
         IsMapDisabled = true;
     }
 }
Example #5
0
        private void RefreshAppBarViewState(HomeViewModelState state)
        {
            if (state == HomeViewModelState.PickDate || state == HomeViewModelState.BookATaxi)
            {
                // These states don't affect visibility
                return;
            }

            HideOrderButtons          = !(state == HomeViewModelState.Initial && !IsManualRidelinqEnabled);
            HideReviewButtons         = state != HomeViewModelState.Review;
            HideEditButtons           = state != HomeViewModelState.Edit;
            HideManualRideLinqButtons = !(state == HomeViewModelState.Initial && IsManualRidelinqEnabled);
            HideAirportButtons        = state != HomeViewModelState.AirportDetails;
        }
Example #6
0
        private async Task VerifyActiveOrder()
        {
            var order = await _bookingService.GetActiveOrder();

            if (order == null)
            {
                return;
            }

            if (order.Order.IsManualRideLinq)
            {
                var manualRideLinq = await _bookingService.GetTripInfoFromManualRideLinq(order.Order.Id);

                CurrentViewState = HomeViewModelState.ManualRidelinq;

                BookingStatus.StartBookingStatus(manualRideLinq.Data, true);

                return;
            }

            CurrentViewState = HomeViewModelState.BookingStatus;

            BookingStatus.StartBookingStatus(order.Order, order.OrderStatus);
        }
Example #7
0
 public HomeViewModelPresentationHint(HomeViewModelState state)
 {
     State = state;
 }
Example #8
0
 public HomeViewModelPresentationHint(HomeViewModelState state, bool newOrder)
 {
     State      = state;
     IsNewOrder = newOrder;
 }
        private void ChangeState(HomeViewModelState state)
        {
            if (state == HomeViewModelState.PickDate)
            {
                // Order Options: Visible
                // Order Review: Hidden
                // Order Edit: Hidden
                // Date Picker: Visible

                CloseBookATaxiDialog();

                _datePicker.ViewState = state;
                _datePicker.Show();
            }
            else if (state == HomeViewModelState.AirportPickDate)
            {
                _datePicker.ViewState = state;
                _datePicker.Show();
            }
            else if (state == HomeViewModelState.BookATaxi)
            {
                // nothing to do but we can't remove the condition
                // otherwise it gets picked up in the "search mode" catch all
            }
            else if (state == HomeViewModelState.Initial)
            {
                // Order Options: Visible
                // Order Review: Hidden
                // Order Edit: Hidden
                // Date Picker: Hidden

                CloseBookATaxiDialog();
                constraintContactTaxiTopSpace.Constant      = ContactDriverHiddenConstraintValue;
                constraintChangeDropOffTopSpace.Constant    = ChangeDropOffHiddenConstraintValue;
                constraintDropOffSelectionTopSpace.Constant = -ctrlDropOffSelection.Frame.Height - 200f;
                ctrlDropOffSelection.SetNeedsLayout();
                homeView.LayoutIfNeeded();

                ctrlAddressPicker.Close();
                ctrlAddressPicker.ResignFirstResponderOnSubviews();
                _datePicker.Hide();

                UIView.Animate(
                    0.6f,
                    () =>
                {
                    bookingStatusTopSpaceConstraint.Constant = BookingStatusHiddenConstraintValue;

                    ctrlOrderReview.SetNeedsDisplay();

                    constraintOrderReviewTopSpace.Constant     = UIScreen.MainScreen.Bounds.Height;
                    constraintOrderReviewBottomSpace.Constant  = constraintOrderReviewBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    constraintOrderOptionsTopSpace.Constant    = 22;
                    constraintOrderEditTrailingSpace.Constant  = UIScreen.MainScreen.Bounds.Width;
                    constraintOrderAirportTopSpace.Constant    = UIScreen.MainScreen.Bounds.Height + 22;
                    constraintOrderAirportBottomSpace.Constant = constraintOrderAirportBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    homeView.LayoutIfNeeded();
                },
                    RedrawSubViews);
            }
            else if (state == HomeViewModelState.Review)
            {
                // Order Options: Visible
                // Order Review: Visible
                // Order Edit: Hidden
                // Date Picker: Hidden
                CloseBookATaxiDialog();
                _datePicker.Hide();

                UIView.Animate(
                    0.6f,
                    () =>
                {
                    orderEdit.SetNeedsDisplay();
                    ctrlOrderBookingOptions.SetNeedsDisplay();
                    constraintOrderReviewTopSpace.Constant     = 10;
                    constraintOrderReviewBottomSpace.Constant  = -65;
                    constraintOrderOptionsTopSpace.Constant    = 22;
                    constraintOrderEditTrailingSpace.Constant  = UIScreen.MainScreen.Bounds.Width;
                    constraintOrderAirportTopSpace.Constant    = UIScreen.MainScreen.Bounds.Height + 22;
                    constraintOrderAirportBottomSpace.Constant = constraintOrderAirportBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;

                    homeView.LayoutIfNeeded();
                },
                    RedrawSubViews);
            }
            else if (state == HomeViewModelState.Edit)
            {
                // Order Options: Hidden
                // Order Review: Hidden
                // Order Edit: Visible
                // Date Picker: Hidden
                UIView.Animate(
                    0.6f,
                    () =>
                {
                    constraintOrderReviewTopSpace.Constant     = UIScreen.MainScreen.Bounds.Height;
                    constraintOrderReviewBottomSpace.Constant  = constraintOrderReviewBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    constraintOrderOptionsTopSpace.Constant    = -ctrlOrderOptions.Frame.Height - 23f;
                    constraintOrderEditTrailingSpace.Constant  = 8;
                    constraintOrderAirportTopSpace.Constant    = UIScreen.MainScreen.Bounds.Height + 22;
                    constraintOrderAirportBottomSpace.Constant = constraintOrderAirportBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;

                    homeView.LayoutIfNeeded();
                    ctrlOrderReview.SetNeedsDisplay();
                    ctrlOrderOptions.SetNeedsDisplay();
                }, () => orderEdit.SetNeedsDisplay());
            }
            else if (state == HomeViewModelState.BookingStatus || state == HomeViewModelState.ManualRidelinq)
            {
                // Order Options: Hidden
                // Order Review: Hidden
                // Order Edit: Hidden
                // Date Picker: Hidden
                // Adress Picker: Hidden
                // Initial app bar: Hidden
                // Booking Status app bar: Visible

                CloseBookATaxiDialog();
                _bookingStatusContactDriverSubscription.Disposable = ObserveIsContactTaxiVisible();
                _bookingStatusChangeDropOffSubscription.Disposable = ObserveIsChangeDropOffVisible();

                if (ViewModel.BookingStatus != null && !ViewModel.BookingStatus.IsContactTaxiVisible)
                {
                    constraintContactTaxiTopSpace.Constant = ContactDriverInTaxiHiddenConstraintValue;
                }
                if (ViewModel.BookingStatus != null && !ViewModel.BookingStatus.IsChangeDropOffVisible)
                {
                    constraintChangeDropOffTopSpace.Constant = ChangeDropOffHiddenConstraintValue;
                }
                if (ViewModel.BookingStatus != null)
                {
                    var isManualPairing = state == HomeViewModelState.ManualRidelinq;

                    ResizeBookingStatusControl(!isManualPairing && ViewModel.BookingStatus.IsDriverInfoAvailable);
                }

                homeView.LayoutIfNeeded();

                ctrlAddressPicker.Close();
                _datePicker.Hide();

                UIView.Animate(
                    0.6f,
                    () =>
                {
                    ctrlOrderReview.SetNeedsDisplay();

                    constraintOrderReviewTopSpace.Constant     = UIScreen.MainScreen.Bounds.Height + 100f;
                    constraintOrderReviewBottomSpace.Constant  = constraintOrderReviewBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    constraintOrderOptionsTopSpace.Constant    = -ctrlOrderOptions.Frame.Height - 122f;
                    constraintOrderEditTrailingSpace.Constant  = UIScreen.MainScreen.Bounds.Width;
                    constraintOrderAirportTopSpace.Constant    = UIScreen.MainScreen.Bounds.Height + 122;
                    constraintOrderAirportBottomSpace.Constant = constraintOrderAirportBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    bookingStatusTopSpaceConstraint.Constant   = 22f;
                    homeView.LayoutIfNeeded();
                    CenterOnMap();
                },
                    RedrawSubViews);
            }
            else if (state == HomeViewModelState.DropOffAddressSelection)
            {
                // Order Options: Hidden
                // Order Review: Hidden
                // Order Edit: Hidden
                // Date Picker: Hidden
                // Adress Picker: Hidden
                // Initial app bar: Hidden
                // Booking Status app bar: Hidden
                // Drop Off app bar: Visible
                // Drop Off Selection: Visible

                UIView.Animate(
                    0.6f,
                    () =>
                {
                    ctrlAddressPicker.Close();
                    constraintChangeDropOffTopSpace.Constant    = ChangeDropOffHiddenConstraintValue;
                    constraintContactTaxiTopSpace.Constant      = ContactDriverInTaxiHiddenConstraintValue;
                    bookingStatusTopSpaceConstraint.Constant    = BookingStatusHiddenConstraintValue;
                    constraintDropOffSelectionTopSpace.Constant = 22f;

                    ctrlDropOffSelection.SetNeedsLayout();
                }, () =>
                {
                    RedrawSubViews();
                    homeView.LayoutIfNeeded();
                    CenterOnMap();
                });
            }
            else if (state == HomeViewModelState.AirportDetails)
            {
                // Order Options: Hidden
                // Order Review: Hidden
                // Order Edit: Hidden
                // Date Picker: Hidden
                // Order Airport: Visable

                ctrlAddressPicker.Close();
                _datePicker.Hide();
                CloseBookATaxiDialog();

                UIView.Animate(
                    0.6f,
                    () =>
                {
                    constraintOrderReviewTopSpace.Constant     = UIScreen.MainScreen.Bounds.Height;
                    constraintOrderReviewBottomSpace.Constant  = constraintOrderReviewBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    constraintOrderOptionsTopSpace.Constant    = 22;
                    constraintOrderEditTrailingSpace.Constant  = UIScreen.MainScreen.Bounds.Width;
                    constraintOrderAirportTopSpace.Constant    = 10;
                    constraintOrderAirportBottomSpace.Constant = -65;
                    ctrlOrderOptions.SetNeedsLayout();
                },
                    RedrawSubViews);
            }
            // We consider any other options as one of the search options.
            else
            {
                // Order Options: Hidden
                UIView.Animate(
                    0.6f,
                    () =>
                {
                    constraintOrderOptionsTopSpace.Constant     = -ctrlOrderOptions.Frame.Height - 23f;
                    constraintDropOffSelectionTopSpace.Constant = -ctrlDropOffSelection.Frame.Height - 200f;
                    constraintOrderAirportTopSpace.Constant     = UIScreen.MainScreen.Bounds.Height + 22;
                    constraintOrderAirportBottomSpace.Constant  = constraintOrderAirportBottomSpace.Constant + UIScreen.MainScreen.Bounds.Height;
                    homeView.LayoutIfNeeded();
                }, RedrawSubViews);

                switch (state)
                {
                case HomeViewModelState.AddressSearch:
                    ctrlAddressPicker.Open(AddressLocationType.Unspecified);
                    break;

                case HomeViewModelState.AirportSearch:
                    ctrlAddressPicker.Open(AddressLocationType.Airport);
                    break;

                case HomeViewModelState.TrainStationSearch:
                    ctrlAddressPicker.Open(AddressLocationType.Train);
                    break;
                }
            }
        }