Esempio n. 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));
        }
Esempio n. 2
0
        protected override void SetupLayoutConstraints()
        {
            base.SetupLayoutConstraints();

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            // TODO
            var halfWidth = UIScreen.MainScreen.Bounds.Width / 2;

            this.AddConstraints(
                VacationsPager.AtLeftOf(this),
                VacationsPager.AtTopOf(this),
                VacationsPager.AtRightOf(this),
                VacationsPager.WithRelativeHeight(this, (nfloat)0.45));

            this.AddConstraints(
                VacationPageControl.AtBottomOf(VacationsPager),
                VacationPageControl.WithSameCenterX(VacationsPager));

            this.AddConstraints(
                AboveDatesSeparator.AtLeftOf(this),
                AboveDatesSeparator.Below(VacationPageControl, AppDimens.Inset1X),
                AboveDatesSeparator.AtRightOf(this),
                AboveDatesSeparator.Height().EqualTo(AppDimens.DefaultSeparatorSize));

            this.AddConstraints(
                StartDayView.AtLeftOf(this),
                StartDayView.Below(AboveDatesSeparator),
                StartDayView.Width().EqualTo(halfWidth));

            this.AddConstraints(
                StartDayLabel.AtLeftOf(StartDayView, AppDimens.Inset1X),
                StartDayLabel.AtTopOf(StartDayView),
                StartDayLabel.AtBottomOf(StartDayView));

            this.AddConstraints(
                StartMonthLabel.ToRightOf(StartDayLabel, AppDimens.InsetHalf),
                StartMonthLabel.AtTopOf(StartDayLabel, AppDimens.Inset1X));

            this.AddConstraints(
                StartYearLabel.WithSameRight(StartMonthLabel),
                StartYearLabel.AtBottomOf(StartDayLabel, AppDimens.Inset1X));

            this.AddConstraints(
                EndDayView.ToRightOf(StartDayView),
                EndDayView.WithSameTop(StartDayView),
                EndDayView.AtRightOf(this),
                EndDayView.WithSameBottom(StartDayView));

            this.AddConstraints(
                EndDayLabel.ToLeftOf(EndMonthLabel, AppDimens.InsetHalf),
                EndDayLabel.WithSameTop(StartDayLabel),
                EndDayLabel.WithSameBottom(StartDayLabel));

            this.AddConstraints(
                EndMonthLabel.AtRightOf(EndDayView, AppDimens.Inset1X),
                EndMonthLabel.WithSameTop(StartMonthLabel));

            this.AddConstraints(
                EndYearLabel.WithSameTop(StartYearLabel),
                EndYearLabel.WithSameRight(EndMonthLabel),
                EndYearLabel.AtBottomOf(EndDayLabel, AppDimens.Inset1X));

            this.AddConstraints(
                BelowDatesSeparator.AtLeftOf(this),
                BelowDatesSeparator.Below(EndDayView),
                BelowDatesSeparator.AtRightOf(this),
                BelowDatesSeparator.Height().EqualTo(AppDimens.DefaultSeparatorSize));

            this.AddConstraints(
                StatusSegmentedControl.Below(BelowDatesSeparator, AppDimens.Inset2X),
                StatusSegmentedControl.WithSameCenterX(this));

            this.AddConstraints(
                VacationStartDatePicker.WithRelativeHeight(this, (nfloat)0.25),
                VacationStartDatePicker.AtBottomOf(this));

            this.AddConstraints(
                VacationEndDatePicker.WithRelativeHeight(this, (nfloat)0.25),
                VacationEndDatePicker.AtBottomOf(this));
        }