Пример #1
0
        private void LayoutSubviews()
        {
            _hiddenInfo = _info.Height().EqualTo(0f);

            View.AddConstraints(_toggleButton.FullWidthOf(View));
            View.AddConstraints(_mapView.FullWidthOf(View));
            View.AddConstraints(new FluentLayout[]
            {
                _toggleButton.AtBottomOf(View),
                _mapView.AtTopOf(View),
                _mapView.Above(_toggleButton),

                _hiddenInfo,
                _info.AtBottomOf(_toggleButton),
                _info.AtLeftOf(View),
                _info.AtRightOf(View)
            });

            _info.AddConstraints(new FluentLayout[]
            {
                _colon.WithSameCenterX(_info),
                _colon.AtBottomOf(_info, 10f),
                _colon.AtTopOf(_info, 10f),

                _latitude.AtLeftOf(_info, 10f),
                _latitude.ToRightOf(_colon, 10f),
                _latitude.AtBottomOf(_info, 10f),
                _latitude.AtTopOf(_info, 10f),

                _longitude.AtRightOf(_info, 10f),
                _longitude.ToLeftOf(_colon, 10f),
                _longitude.AtBottomOf(_info, 10f),
                _longitude.AtTopOf(_info, 10f),
            });
        }
        private void ResetConstraints()
        {
            if (trackedConstraints != null)
            {
                View.RemoveConstraints(trackedConstraints);
                trackedConstraints = null;
            }

            var keyboardVisible = keyboardHeight >= 1f;

            trackedConstraints = new FluentLayout[] {
                moodLabel.AtTopOf(View, keyboardVisible ? 20f : 70f),
                moodLabel.AtLeftOf(View, 5f),
                moodLabel.AtRightOf(View, 5f),
                moodLabel.Height().EqualTo(40f),

                neutralMoodButton.Below(moodLabel, 5f),
                neutralMoodButton.WithSameCenterX(View),

                positiveMoodSeparatorView.ToLeftOf(neutralMoodButton, 30f),
                positiveMoodSeparatorView.WithSameCenterY(neutralMoodButton),
                positiveMoodSeparatorView.Height().EqualTo(15f),
                positiveMoodSeparatorView.Width().EqualTo(1f),

                positiveMoodButton.ToLeftOf(positiveMoodSeparatorView, 30f),
                positiveMoodButton.WithSameCenterY(neutralMoodButton),

                negativeMoodSeparatorView.ToRightOf(neutralMoodButton, 30f),
                negativeMoodSeparatorView.WithSameCenterY(neutralMoodButton),
                negativeMoodSeparatorView.Height().EqualTo(15f),
                negativeMoodSeparatorView.Width().EqualTo(1f),

                negativeMoodButton.ToRightOf(negativeMoodSeparatorView, 30f),
                negativeMoodButton.WithSameCenterY(neutralMoodButton),

                messageTopBorderView.Below(neutralMoodButton, 15f),
                messageTopBorderView.AtLeftOf(View),
                messageTopBorderView.AtRightOf(View),
                messageTopBorderView.Height().EqualTo(1f),

                messageTextView.Below(messageTopBorderView),
                messageTextView.AtLeftOf(View),
                messageTextView.AtRightOf(View),

                messageBottomBorderView.Below(messageTextView),
                messageBottomBorderView.AtLeftOf(View),
                messageBottomBorderView.AtRightOf(View),
                messageBottomBorderView.Height().EqualTo(1f),

                sendButton.Below(messageBottomBorderView, 5f),
                sendButton.AtLeftOf(View),
                sendButton.AtRightOf(View),
                sendButton.AtBottomOf(View, (keyboardVisible ? keyboardHeight : 0f) + 5f),
                sendButton.Height().EqualTo(60f),

                null
            }.ToLayoutConstraints();

            View.AddConstraints(trackedConstraints);
        }
Пример #3
0
        protected void InitView()
        {
            this.Hidden  = false;
            sqrRotationA = new RotativeButton()
            {
                BackgroundColor = Color.White.SMooth().ToNative()
            };
            sqrRotationA.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRA).ToString(), UIControlState.Normal);
            sqrRotationB = new RotativeButton()
            {
                BackgroundColor = Color.White.FResh().ToNative()
            };
            sqrRotationB.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRB).ToString(), UIControlState.Normal);
            sqrRotationC = new RotativeButton()
            {
                BackgroundColor = Color.White.Micadormissador().ToNative()
            };
            sqrRotationC.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRC).ToString(), UIControlState.Normal);
            sqrRotationD = new RotativeButton()
            {
                BackgroundColor = Color.White.GIMME().ToNative()
            };
            sqrRotationD.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRD).ToString(), UIControlState.Normal);

            separator = new UIView()
            {
                BackgroundColor = UIColor.Gray
            };
            informationText = new UITextView()
            {
                Text = "Just tap a box to rotate the adyacents. Each box rotates different. Try to aligne all the boxes, if you can.", TextColor = UIColor.DarkGray, Font = UIFont.FromName("Helvetica", 24), TextAlignment = UITextAlignment.Center, ScrollEnabled = false
            };
            backScreenButton = new NavButton();
            backScreenButton.SetTitle("To previous Screen", UIControlState.Normal);
            backScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenOne());

            this.AddSubview(sqrRotationA);
            this.AddSubview(sqrRotationB);
            this.AddSubview(sqrRotationC);
            this.AddSubview(sqrRotationD);
            this.AddSubview(separator);
            this.AddSubview(informationText);
            this.AddSubview(backScreenButton);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            var margin = 50;

            this.AddConstraints(

                informationText.AtTopOf(this, margin),
                informationText.AtLeftOf(this, margin),
                informationText.AtRightOf(this, margin),
                informationText.WithRelativeHeight(sqrRotationA, 0.5f),

                sqrRotationA.Below(informationText, margin),
                sqrRotationA.WithRelativeWidth(this, 0.15f),
                sqrRotationA.Height().EqualTo().WidthOf(sqrRotationA),
                sqrRotationA.Right().EqualTo(-margin).CenterXOf(this),

                sqrRotationB.WithSameCenterY(sqrRotationA),
                sqrRotationB.WithSameWidth(sqrRotationA),
                sqrRotationB.WithSameHeight(sqrRotationA),
                sqrRotationB.Left().EqualTo(margin).CenterXOf(this),

                sqrRotationC.Below(sqrRotationA, margin),
                sqrRotationC.WithSameWidth(sqrRotationA),
                sqrRotationC.WithSameHeight(sqrRotationA),
                sqrRotationC.WithSameCenterX(sqrRotationA),

                sqrRotationD.WithSameWidth(sqrRotationA),
                sqrRotationD.WithSameHeight(sqrRotationA),
                sqrRotationD.WithSameCenterX(sqrRotationB),
                sqrRotationD.WithSameCenterY(sqrRotationC),

                separator.Below(sqrRotationC, margin),
                separator.AtLeftOf(this, margin),
                separator.AtRightOf(this, margin),
                separator.Height().EqualTo(3f),

                backScreenButton.Below(separator, margin),
                backScreenButton.WithSameCenterX(this),
                backScreenButton.WithRelativeWidth(this, 0.3f)
                );
        }
Пример #4
0
        protected void InitView()
        {
            this.Hidden = false;
            sqrColorA   = new UIButton();
            sqrColorB   = new UIButton();
            sqrColorC   = new UIButton();

            backScreenButton = new NavButton();
            backScreenButton.SetTitle("To previous Screen", UIControlState.Normal);
            backScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenStart());

            separator = new UIView()
            {
                BackgroundColor = UIColor.Gray
            };
            informationText = new UITextView()
            {
                Text = "Just tap on any color box to aleatory change color of other color box.", TextColor = UIColor.DarkGray, Font = UIFont.FromName("Helvetica", 24), TextAlignment = UITextAlignment.Center, ScrollEnabled = false
            };
            nextScreenButton = new NavButton();
            nextScreenButton.SetTitle("To next Screen", UIControlState.Normal);
            nextScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenTwo());

            this.AddSubview(sqrColorA);
            this.AddSubview(sqrColorB);
            this.AddSubview(sqrColorC);
            this.AddSubview(separator);
            this.AddSubview(informationText);
            this.AddSubview(nextScreenButton);
            this.AddSubview(backScreenButton);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            var margin = 50;

            this.AddConstraints(

                informationText.AtTopOf(this, margin),
                informationText.AtLeftOf(this, margin),
                informationText.AtRightOf(this, margin),
                informationText.WithRelativeHeight(sqrColorA, 0.5f),

                sqrColorA.AtTopOf(informationText, margin),
                sqrColorA.WithRelativeWidth(this, 0.2f),
                sqrColorA.Height().EqualTo().WidthOf(sqrColorA),
                sqrColorA.AtLeftOf(this, margin),

                sqrColorB.WithSameCenterY(sqrColorA),
                sqrColorB.WithSameWidth(sqrColorA),
                sqrColorB.WithSameHeight(sqrColorA),
                sqrColorB.WithSameCenterX(this),

                sqrColorC.WithSameCenterY(sqrColorA),
                sqrColorC.WithSameWidth(sqrColorA),
                sqrColorC.WithSameHeight(sqrColorA),
                sqrColorC.AtRightOf(this, margin),

                separator.AtBottomOf(sqrColorB, -margin),
                separator.AtLeftOf(this, margin),
                separator.AtRightOf(this, margin),
                separator.Height().EqualTo(5f),

                nextScreenButton.AtBottomOf(separator, -margin * 3),
                nextScreenButton.WithSameCenterX(this),
                nextScreenButton.WithRelativeWidth(this, 0.2f),

                backScreenButton.Below(nextScreenButton, margin),
                backScreenButton.WithSameCenterX(this),
                backScreenButton.WithRelativeWidth(this, 0.3f)
                );
        }