Ejemplo n.º 1
0
        public OrderOptions(Context context, IAttributeSet attrs) : base(Resource.Layout.SubView_OrderOptions, context, attrs)
        {
            this.DelayBind(() =>
            {
                _viewPickup      = Content.FindViewById <AddressTextBox>(Resource.Id.viewPickup);
                _viewDestination = Content.FindViewById <AddressTextBox>(Resource.Id.viewDestination);
                _viewVehicleType = Content.FindViewById <VehicleTypeAndEstimateControl>(Resource.Id.viewEstimate);

                _viewDestination.IsDestination = true;
                _viewPickup.IsDestination      = false;

                _viewPickup.SetInvisibleButton(BigInvisibleButton);
                _viewDestination.SetInvisibleButton(BigInvisibleButton);

                _etaContainer = (LinearLayout)Content.FindViewById(Resource.Id.EtaContainer);
                _etaBadge     = (LinearLayout)Content.FindViewById(Resource.Id.EtaBadge);
                _etaLabelInVehicleSelection = (AutoResizeTextView)Content.FindViewById(Resource.Id.EtaLabelInVehicleSelection);
                _etaBadgeImage = new VehicleTypeControl(base.Context, (VehicleType)null);
                _etaBadge.AddView(_etaBadgeImage);

                _etaContainer.SetBackgroundColorWithRoundedCorners(0, 0, 3, 3, Resources.GetColor(Resource.Color.company_color));

                _viewVehicleType.Visibility = ViewStates.Gone;
                InitializeBinding();
            });
        }
Ejemplo n.º 2
0
        private void Redraw()
        {
            if (ShowEstimate)
            {
                this.SetBackgroundColorWithRoundedCorners(0, 0, 3, 3, Resources.GetColor(Resource.Color.company_color));
                _horizontalDivider.Background.SetColorFilter(Resources.GetColor(Resource.Color.company_color), PorterDuff.Mode.SrcAtop);
                _rideEstimate.Visibility     = ViewStates.Visible;
                _vehicleSelection.Visibility = ViewStates.Gone;
                _etaLabel.Visibility         = (Eta.HasValue() && _showEta) ? ViewStates.Visible : ViewStates.Gone;
            }
            else
            {
                this.SetBackgroundColorWithRoundedCorners(0, 0, 3, 3, Color.Transparent);
                _rideEstimate.Visibility = ViewStates.Gone;

                _vehicleSelection.Visibility = ShowVehicleSelection ? ViewStates.Visible : ViewStates.Gone;

                _vehicleSelectionAndEta.Visibility = _showVehicleSelectionContainer ? ViewStates.Visible : ViewStates.Gone;

                _vehicleSelection.RemoveAllViews();

                if (_showVehicleSelectionContainer)
                {
                    _horizontalDivider.SetBackgroundColor(Resources.GetColor(Resource.Color.orderoptions_horizontal_divider));
                }

                if (ShowVehicleSelection && Vehicles != null)
                {
                    foreach (var vehicle in Vehicles)
                    {
                        var vehicleView = new VehicleTypeControl(base.Context, vehicle, SelectedVehicle == null ? false : vehicle.Id == SelectedVehicle.Id);

                        var layoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent);
                        layoutParameters.Weight      = 1.0f;
                        vehicleView.LayoutParameters = layoutParameters;

                        vehicleView.Click += (sender, e) => {
                            if (!IsReadOnly && VehicleSelected != null)
                            {
                                VehicleSelected(vehicle);
                            }
                        };

                        _vehicleSelection.AddView(vehicleView);
                    }
                }
            }
            this.Visibility = ViewStates.Visible;
        }
Ejemplo n.º 3
0
        protected override void OnFinishInflate()
        {
            base.OnFinishInflate();
            var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
            var layout   = inflater.Inflate(Resource.Layout.Control_VehicleTypeAndEstimate, this, true);

            _horizontalDivider      = (View)layout.FindViewById(Resource.Id.HorizontalDivider);
            _rideEstimate           = (LinearLayout)layout.FindViewById(Resource.Id.RideEstimate);
            _vehicleSelectionAndEta = (LinearLayout)layout.FindViewById(Resource.Id.VehicleSelectionAndEta);
            _vehicleSelection       = (LinearLayout)layout.FindViewById(Resource.Id.VehicleSelection);

            _estimatedFareLabel = (AutoResizeTextView)layout.FindViewById(Resource.Id.estimateFareAutoResizeLabel);

            _etaLabel = (AutoResizeTextView)layout.FindViewById(Resource.Id.EtaLabel);

            _estimateSelectedVehicleType          = (VehicleTypeControl)layout.FindViewById(Resource.Id.estimateSelectedVehicle);
            _estimateSelectedVehicleType.Selected = true;

            this.SetBackgroundColorWithRoundedCorners(0, 0, 3, 3, Resources.GetColor(Resource.Color.company_color));
        }