Example #1
0
        protected override void SetupLayoutConstraints()
        {
            base.SetupLayoutConstraints();

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            DateBeginView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            DateEndView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _contentViewExpanded                  = ContentView.AtBottomOf(this);
            _contentViewCollapsedByToolbar        = ContentView.Above(DatePickerToolbar);
            _contentViewCollapsedByToolbar.Active = false;

            this.AddConstraints(
                ContentView.FullWidthOf(this));

            this.AddConstraints(
                ContentView.AtTopOf(this),
                _contentViewExpanded,
                _contentViewCollapsedByToolbar);

            this.AddConstraints(
                VacationsPager.AtTopOf(ContentView, AppDimens.Inset3X),
                VacationsPager.WithSameCenterX(ContentView),
                VacationsPager.WithRelativeHeight(ContentView, 0.3f),
                VacationsPager.WithSameWidth(ContentView));

            this.AddConstraints(
                VacationPageControl.WithSameCenterX(ContentView),
                VacationPageControl.Below(VacationsPager, AppDimens.Inset1X),
                VacationPageControl.WithSameWidth(ContentView),
                VacationPageControl.Height().EqualTo(AppDimens.Inset2X));

            this.AddConstraints(
                AboveDateSeparator.AtLeftOf(ContentView),
                AboveDateSeparator.Below(VacationPageControl, AppDimens.Inset1X),
                AboveDateSeparator.AtRightOf(ContentView),
                AboveDateSeparator.Height().EqualTo(AppDimens.SeparatorSize));

            this.AddConstraints(
                DateBeginView.Below(AboveDateSeparator, AppDimens.Inset1X),
                DateBeginView.AtLeftOf(ContentView),
                DateBeginView.WithRelativeWidth(ContentView, 0.5f),
                DateBeginView.Height().EqualTo(AppDimens.Inset9X));

            this.AddConstraints(
                DateEndView.ToRightOf(DateBeginView),
                DateEndView.Below(AboveDateSeparator),
                DateEndView.WithRelativeWidth(ContentView, 0.5f),
                DateEndView.Height().EqualTo(AppDimens.Inset9X));

            this.AddConstraints(
                BelowDateSeparator.AtLeftOf(ContentView),
                BelowDateSeparator.Below(DateBeginView, AppDimens.Inset1X),
                BelowDateSeparator.AtRightOf(ContentView),
                BelowDateSeparator.Height().EqualTo(AppDimens.SeparatorSize));

            this.AddConstraints(
                StatusSegmentedControl.Below(BelowDateSeparator, AppDimens.Inset4X),
                StatusSegmentedControl.WithSameCenterX(ContentView));

            _toolbarBottom                  = DatePickerToolbar.AtBottomOf(this);
            _toolbarAboveStartPicker        = DatePickerToolbar.Above(StartDatePicker);
            _toolbarAboveStartPicker.Active = false;
            _toolbarAboveEndPicker          = DatePickerToolbar.Above(EndDatePicker);
            _toolbarAboveEndPicker.Active   = false;

            _datePickerToolbarCollapsed       = DatePickerToolbar.Height().EqualTo(0);
            _datePickerToolbarExpanded        = DatePickerToolbar.Height().EqualTo(AppDimens.ToolbarSize);
            _datePickerToolbarExpanded.Active = false;

            this.AddConstraints(
                DatePickerToolbar.AtLeftOf(this),
                DatePickerToolbar.AtRightOf(this),
                _toolbarBottom,
                _toolbarAboveStartPicker,
                _toolbarAboveEndPicker,
                _datePickerToolbarCollapsed,
                _datePickerToolbarExpanded);

            _datePickerStartCollapsed       = StartDatePicker.Height().EqualTo(0);
            _datePickerStartExpanded        = StartDatePicker.Height().EqualTo(AppDimens.DatePickerSize);
            _datePickerStartExpanded.Active = false;

            this.AddConstraints(
                StartDatePicker.AtLeftOf(this),
                StartDatePicker.AtBottomOf(this),
                StartDatePicker.AtRightOf(this),
                _datePickerStartCollapsed,
                _datePickerStartExpanded);

            _datePickerEndCollapsed       = EndDatePicker.Height().EqualTo(0);
            _datePickerEndExpanded        = EndDatePicker.Height().EqualTo(AppDimens.DatePickerSize);
            _datePickerEndExpanded.Active = false;

            this.AddConstraints(
                EndDatePicker.AtLeftOf(this),
                EndDatePicker.AtBottomOf(this),
                EndDatePicker.AtRightOf(this),
                _datePickerEndCollapsed,
                _datePickerEndExpanded);

            this.AddConstraints(
                ActivityIndicator.WithSameCenterX(this),
                ActivityIndicator.WithSameCenterY(this));
        }