Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
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)
                );
        }
Ejemplo n.º 3
0
        public CommentCell(CGRect frame) : base(frame)
        {
            imageView = new UIImageView();
            imageView.Layer.CornerRadius     = 22;
            imageView.ContentMode            = UIViewContentMode.ScaleAspectFill;
            imageView.Layer.MasksToBounds    = true;
            imageView.UserInteractionEnabled = true;
            imageView.TranslatesAutoresizingMaskIntoConstraints = false;

            commentText = new UITextView();
            commentText.BackgroundColor = UIColor.White;
            commentText.TextColor       = UIColor.FromRGB(90, 89, 89);
            commentText.Selectable      = false;
            commentText.Font            = UIFont.SystemFontOfSize(14);
            commentText.TranslatesAutoresizingMaskIntoConstraints = false;
            commentText.Editable      = false;
            commentText.ScrollEnabled = false;

            likeButton = new UIFeedButton();
            likeButton.SetTitle("Like", UIControlState.Normal);
            likeButton.AddTarget(Self, new ObjCRuntime.Selector("LikeCommentClick:"), UIControlEvent.TouchUpInside);

            nameLabel           = new UILabel();
            nameLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            nameLabel.Font      = UIFont.BoldSystemFontOfSize(14);

            dateLabel           = new UILabel();
            dateLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            dateLabel.Font      = UIFont.SystemFontOfSize(12);

            lineSeparator = new UIView();
            lineSeparator.BackgroundColor = UIColor.FromRGBA(nfloat.Parse("0.88"), nfloat.Parse("0.89"), nfloat.Parse("0.90"), nfloat.Parse("1"));

            ContentView.Add(imageView);
            ContentView.Add(likeButton);
            ContentView.Add(nameLabel);
            ContentView.Add(commentText);
            ContentView.Add(dateLabel);
            ContentView.Add(lineSeparator);

            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContentView.AddConstraints(
                imageView.AtLeftOf(ContentView, 8),
                imageView.Width().EqualTo(40),
                imageView.Height().EqualTo(40),
                imageView.AtTopOf(ContentView, 8),

                likeButton.AtRightOf(ContentView, 8),
                likeButton.Width().EqualTo(60),
                likeButton.Height().EqualTo(24),
                likeButton.AtTopOf(ContentView, 4),

                nameLabel.Right().EqualTo().LeftOf(likeButton).Plus(8),
                nameLabel.AtTopOf(ContentView, 8),
                nameLabel.Left().EqualTo().RightOf(imageView).Plus(8),
                nameLabel.Height().EqualTo(20),

                commentText.AtTopOf(ContentView, 28),
                commentText.AtRightOf(ContentView, 8),
                commentText.Left().EqualTo().RightOf(imageView).Plus(3),
                commentText.AtBottomOf(ContentView, 30),

                dateLabel.Below(commentText, 5),
                dateLabel.Height().EqualTo(20),
                dateLabel.AtRightOf(ContentView, 8),
                dateLabel.AtLeftOf(ContentView, 56),
                dateLabel.AtBottomOf(ContentView, 5),

                lineSeparator.AtBottomOf(ContentView, 1),
                lineSeparator.AtRightOf(ContentView, 8),
                lineSeparator.AtLeftOf(ContentView, 8),
                lineSeparator.Height().EqualTo(1)

                );
        }
Ejemplo n.º 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)
                );
        }