public UseFullLinkView()
        {
            BackgroundColor  = ApplicationColors.CellBackgroundColor;
            TopSeparatorView = new UIView();
            TopSeparatorView.BackgroundColor = ApplicationColors.SeparatorColor;

            Logo = new UIImageView();
            Name = new UILabel();

            BottomSeparatorView = new UIView();
            BottomSeparatorView.BackgroundColor = ApplicationColors.SeparatorColor;

            AddSubviews(TopSeparatorView, Logo, Name, BottomSeparatorView);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            nfloat separatorHeight = 1;
            nfloat hmargin         = 15;
            nfloat imageSize       = 25;

            this.AddConstraints(
                TopSeparatorView.WithSameWidth(this),
                TopSeparatorView.Height().EqualTo(separatorHeight),
                TopSeparatorView.AtTopOf(this),
                Logo.WithSameCenterY(this),
                Logo.AtLeftOf(this, hmargin),
                Logo.Width().EqualTo(imageSize),
                Logo.Height().EqualTo(imageSize),
                Name.WithSameCenterY(this),
                Name.ToRightOf(Logo, hmargin),
                BottomSeparatorView.WithSameWidth(this),
                BottomSeparatorView.Height().EqualTo(separatorHeight),
                BottomSeparatorView.AtBottomOf(this));
        }
Ejemplo n.º 2
0
        protected override void CreateConstraints()
        {
            base.CreateConstraints();

            ContentView.AddConstraints(
                _leftView.AtLeftOf(ContentView),
                _leftView.AtTopOf(ContentView),
                _leftView.AtBottomOf(ContentView),
                _leftView.Height().EqualTo(IMAGE_HEIGHT + 80),
                _leftView.WithRelativeWidth(ContentView, 0.4f),

                _imgView.AtTopOf(_leftView, 3 * PADDING),
                _imgView.WithSameCenterX(_leftView),
                _imgView.Width().EqualTo(IMAGE_WIDTH),
                _imgView.Height().EqualTo(IMAGE_HEIGHT),

                _lblCategory.Below(_imgView, PADDING),
                _lblCategory.WithSameLeft(_imgView),
                _lblCategory.WithSameWidth(_leftView),

                _rightView.AtRightOf(ContentView),
                _rightView.AtTopOf(ContentView),
                _rightView.AtBottomOf(ContentView),
                _rightView.WithRelativeWidth(ContentView, 0.6f),
                _rightView.WithSameHeight(_leftView),

                _lblName.AtLeftOf(_rightView, PADDING),
                _lblName.AtTopOf(_rightView, 3 * PADDING),
                _lblName.AtRightOf(_rightView, PADDING),

                _lblDesc.Below(_lblName, PADDING),
                _lblDesc.AtLeftOf(_rightView, PADDING),
                _lblDesc.AtRightOf(_rightView, PADDING)
                );
        }
        public SuggestionTableViewCell(IntPtr ptr) : base(ptr)
        {
            textContentView = new UIView();

            projectLabel     = new UILabel().Apply(Style.Recent.CellProjectLabel);
            clientLabel      = new UILabel().Apply(Style.Recent.CellClientLabel);
            descriptionLabel = new UILabel().Apply(Style.Recent.CellDescriptionLabel);

            textContentView.AddSubviews(projectLabel, clientLabel, descriptionLabel);

            ContentView.AddSubview(textContentView);

            ContentView.AddConstraints(new FluentLayout[] {
                textContentView.AtTopOf(ContentView),
                textContentView.AtBottomOf(ContentView),
                textContentView.AtLeftOf(ContentView),
                textContentView.AtRightOf(ContentView)
            }.ToLayoutConstraints());

            textContentView.AddConstraints(new FluentLayout[] {
                projectLabel.AtTopOf(textContentView, 8),
                projectLabel.AtLeftOf(textContentView, HorizPadding),
                clientLabel.WithSameCenterY(projectLabel).Plus(1),
                clientLabel.ToRightOf(projectLabel, 6),
                clientLabel.AtRightOf(textContentView, HorizPadding),
                descriptionLabel.Below(projectLabel, 4),
                descriptionLabel.AtLeftOf(textContentView, HorizPadding + 1),
                descriptionLabel.AtRightOf(textContentView, HorizPadding)
            }.ToLayoutConstraints());

            textContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
        }
Ejemplo n.º 4
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),
            });
        }
Ejemplo n.º 5
0
        public static UIView AddTopBottomLine(this UIView view, UIColor color, int height)
        {
            UIView _top = new UIView();

            _top.BackgroundColor = color;

            UIView _bottom = new UIView();

            _bottom.BackgroundColor = color;

            view.AddIfNotNull(_top, _bottom);
            view.AddConstraints(
                _top.AtTopOf(view),
                _top.AtLeftOf(view),
                _top.AtRightOf(view),
                _top.Height().EqualTo(height),

                _bottom.AtBottomOf(view),
                _bottom.AtLeftOf(view),
                _bottom.AtRightOf(view),
                _bottom.Height().EqualTo(height)
                );

            return(view);
        }
Ejemplo n.º 6
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _text.AtLeftOf(ContentView, 14),
                _text.WithSameCenterY(ContentView),

                _ruler.AtTopOf(ContentView),
                _ruler.AtRightOf(ContentView),
                _ruler.AtLeftOf(ContentView),
                _ruler.Height().EqualTo(1),

                _arrowImage.AtRightOf(ContentView, 14),
                _arrowImage.Height().EqualTo(15),
                _arrowImage.Width().EqualTo(9),
                _arrowImage.WithSameCenterY(ContentView),

                _text.AtRightOf(_arrowImage, 5),

                _bottomRuler.AtBottomOf(ContentView),
                _bottomRuler.AtLeftOf(ContentView),
                _bottomRuler.AtRightOf(ContentView),
                _bottomRuler.Height().EqualTo(1),

                ContentView.Height().EqualTo(50)
                );
        }
Ejemplo n.º 7
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _buttonCenterConstraint = _viewButton.WithSameCenterX(ContentView).ToLayoutConstraints().First();
            _buttonRightConstraint  = _viewButton.AtRightOf(ContentView, 14).ToLayoutConstraints().First();

            ContentView.AddConstraints(
                _background.AtLeftOf(ContentView),
                _background.AtRightOf(ContentView),
                _background.AtTopOf(ContentView),
                _background.AtBottomOf(ContentView),

                _name.AtLeftOf(ContentView, 14),
                _name.AtRightOf(ContentView, 14),
                _name.AtTopOf(ContentView, 30),

                GroupDescription.Below(_name, 14),
                GroupDescription.AtLeftOf(ContentView, 14),
                GroupDescription.AtRightOf(ContentView, 14),

                _viewButton.AtBottomOf(ContentView, 25),
                _viewButton.Width().EqualTo(130),
                _viewButton.Height().EqualTo(40),

                _ruler.AtBottomOf(ContentView),
                _ruler.AtLeftOf(ContentView),
                _ruler.AtRightOf(ContentView),
                _ruler.Height().EqualTo(1)
                );
        }
Ejemplo n.º 8
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _backPanel.AtTopOf(ContentView, 5),
                _backPanel.AtBottomOf(ContentView, 5),
                _backPanel.AtRightOf(ContentView, 0),
                _backPanel.AtLeftOf(ContentView, 0),
                _backPanel.Height().GreaterThanOrEqualTo(40),

                _topBorder.AtTopOf(_backPanel),
                _topBorder.AtLeftOf(_backPanel),
                _topBorder.AtRightOf(_backPanel),
                _topBorder.Height().EqualTo(1),

                _bottomBorder.AtBottomOf(_backPanel),
                _bottomBorder.AtLeftOf(_backPanel),
                _bottomBorder.AtRightOf(_backPanel),
                _bottomBorder.Height().EqualTo(1),

                _avatarImage.Below(_topBorder, 14),
                _avatarImage.AtLeftOf(_backPanel, 14),
                _avatarImage.Height().EqualTo(45),
                _avatarImage.Width().EqualTo(45),

                _displayName.WithSameCenterY(_avatarImage).Plus(-13),
                _displayName.ToRightOf(_avatarImage, 10),
                _displayName.AtRightOf(_backPanel, 13),

                _timeAgo.Below(_displayName, 3),
                _timeAgo.WithSameLeft(_displayName),
                _timeAgo.WithSameRight(_displayName),

                _contentContainer.Below(_avatarImage, 10),
                _contentContainer.WithSameLeft(_avatarImage),
                _contentContainer.WithSameRight(_displayName),
                _contentContainer.Height().GreaterThanOrEqualTo(30),

                _ruler.Below(_contentContainer, 15),
                _ruler.Height().EqualTo(1),
                _ruler.WithSameLeft(_avatarImage),
                _ruler.WithSameRight(_displayName),

                _commentButton.Below(_ruler),
                _commentButton.WithSameLeft(_avatarImage),
                _commentButton.Above(_bottomBorder),
                _commentButton.Height().EqualTo(50),

                _likeButton.WithSameCenterY(_commentButton),
                _likeButton.ToRightOf(_commentButton, 15),
                _likeButton.WithSameHeight(_commentButton)
                );

            // This call does not set the property on the child views of child views so we call this on the content container as well
            _contentContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _contentContainer.AddConstraints(AddContentConstraints(_contentContainer));
        }
Ejemplo n.º 9
0
        public override void UpdateConstraints()
        {
            if (ContentView.Constraints.Length > 0)
            {
                base.UpdateConstraints();
                return;
            }

            ContentView.AddConstraints(

                colorBox.AtLeftOf(ContentView, 0f),
                colorBox.AtTopOf(ContentView, 10f),
                colorBox.AtBottomOf(ContentView, 10f),
                colorBox.Width().EqualTo(3f),

                startBtn.AtRightOf(ContentView, 15f),
                startBtn.WithSameCenterY(ContentView),
                startBtn.Height().EqualTo(35f),
                startBtn.Width().EqualTo(35f),

                timeLabel.WithSameCenterY(ContentView),
                timeLabel.ToLeftOf(startBtn, 10f),
                timeLabel.Width().EqualTo(timeLabel.Bounds.Width),

                textContentView.AtLeftOf(ContentView, 50f),
                textContentView.ToLeftOf(timeLabel, 5f),
                textContentView.WithSameCenterY(ContentView),
                textContentView.WithSameHeight(ContentView)
                );

            textContentView.AddConstraints(
                projectLabel.AtLeftOf(textContentView, 0f)
                );

            if (data.IsEmpty)
            {
                textContentView.AddConstraints(
                    projectLabel.WithSameCenterY(textContentView),
                    null
                    );
            }
            else
            {
                textContentView.AddConstraints(
                    projectLabel.AtTopOf(textContentView, 10f),
                    descriptionLabel.WithSameLeft(projectLabel),
                    descriptionLabel.Below(projectLabel, 0f),
                    descriptionLabel.AtBottomOf(textContentView, 10f),
                    null
                    );
            }

            base.UpdateConstraints();

            LayoutIfNeeded();
        }
Ejemplo n.º 10
0
        public static IEnumerable <FluentLayout> FullHeightOf(this UIView view, UIView parent, nfloat?margin = null)
        {
            var marginValue = margin.GetValueOrDefault(DefaultMargin);

            return(new List <FluentLayout>
            {
                view.AtTopOf(parent, marginValue).WithIdentifier("Top"),
                view.AtBottomOf(parent, marginValue).WithIdentifier("Bottom")
            });
        }
Ejemplo n.º 11
0
        private void SetViews()
        {
            liveCameraStream = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            captureButton = new UIButton
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.White
            };
            captureButton.SetTitle("Capture", UIControlState.Normal);
            captureButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            captureButton.TouchUpInside += CaptureButtonClick;

            cancelButton = new UIButton
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.White
            };
            cancelButton.SetTitle("Cancel", UIControlState.Normal);
            cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal);

            activityView = new UIActivityIndicatorView
            {
                ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge,
                BackgroundColor            = UIColor.Black.ColorWithAlpha(0.2f),
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            View.AddSubviews(liveCameraStream, captureButton, cancelButton, activityView);
            View.AddConstraints(
                liveCameraStream.AtTopOf(View),
                liveCameraStream.AtLeftOf(View),
                liveCameraStream.AtRightOf(View),
                liveCameraStream.AtBottomOf(View),

                captureButton.Bottom().EqualTo(-20f).BottomOf(View),
                captureButton.Leading().EqualTo(20f).LeadingOf(View),
                captureButton.Trailing().EqualTo(-10f).LeadingOf(cancelButton),
                captureButton.Height().EqualTo(44f),
                cancelButton.Width().EqualTo(150f),

                cancelButton.Leading().EqualTo(10f).TrailingOf(captureButton),
                cancelButton.Trailing().EqualTo(-20f).TrailingOf(View),
                cancelButton.Height().EqualTo(44f),
                cancelButton.WithSameWidth(captureButton),
                cancelButton.Bottom().EqualTo().BottomOf(captureButton),

                activityView.AtTopOf(View),
                activityView.Leading().EqualTo().LeadingOf(View),
                activityView.Trailing().EqualTo().TrailingOf(View),
                activityView.AtBottomOf(View));
        }
Ejemplo n.º 12
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _ruler.AtTopOf(ContentView),
                _ruler.AtLeftOf(ContentView),
                _ruler.AtBottomOf(ContentView),
                _ruler.AtRightOf(ContentView),
                _ruler.Height().EqualTo(1)
                );
        }
Ejemplo n.º 13
0
        public static IEnumerable <FluentLayout> FullSizeOf(this UIView view, UIView parent, Margins margins)
        {
            margins = margins ?? new Margins();

            return(new List <FluentLayout>
            {
                view.AtTopOf(parent, margins.Top).WithIdentifier("Top"),
                view.AtBottomOf(parent, margins.Bottom).WithIdentifier("Bottom"),
                view.AtLeftOf(parent, margins.Left).WithIdentifier("Left"),
                view.AtRightOf(parent, margins.Right).WithIdentifier("Right")
            });
        }
Ejemplo n.º 14
0
        private void SetupConstraints()
        {
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContainerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                ContainerView.WithSameWidth(View),
                BackButton.AtTopOf(View, 15),
                BackButton.AtLeftOf(View, 15)
                );

            ScrollView.AddConstraints(
                ContainerView.AtTopOf(ScrollView),
                ContainerView.AtLeftOf(ScrollView),
                ContainerView.AtRightOf(ScrollView),
                ContainerView.AtBottomOf(ScrollView),
                ContainerView.Height().EqualTo(UIScreen.MainScreen.Bounds.Height)
                );

            ContainerView.AddConstraints(
                Logo.AtTopOf(ContainerView, 40),
                Logo.WithSameCenterX(ContainerView),

                Indicator.Below(Logo, 30),
                Indicator.WithSameCenterX(Logo),

                EmailRuler.Above(ResetButton, 0),
                EmailRuler.WithSameLeft(ResetButton),
                EmailRuler.WithSameRight(ResetButton),
                EmailRuler.Height().EqualTo(0),

                EmailInput.Above(EmailRuler, 15),
                EmailInput.AtRightOf(ContainerView, 15),
                EmailInput.Height().EqualTo(40),
                EmailInput.ToRightOf(EmailImage, 0),

                EmailImage.WithSameCenterY(EmailInput),
                EmailImage.WithSameLeft(EmailRuler),
                EmailImage.Height().EqualTo(0),
                EmailImage.Width().EqualTo(0),

                ResetButton.WithSameCenterX(ContainerView),
                ResetButton.AtBottomOf(ContainerView, 80),
                ResetButton.AtLeftOf(ContainerView, 15),
                ResetButton.AtRightOf(ContainerView, 15),
                ResetButton.Height().EqualTo(40)
                );
        }
Ejemplo n.º 15
0
        public static void AddMarginedBottomLine <T>(this T view, UIColor color, float height = 1, float marginLeft = 0f) where T : UIView
        {
            UIView bottomBorder = new UIView();

            bottomBorder.BackgroundColor = color;
            bottomBorder.TranslatesAutoresizingMaskIntoConstraints = false;
            view.AddSubview(bottomBorder);
            view.AddConstraints(
                bottomBorder.WithRelativeWidth(view),
                bottomBorder.Leading().EqualTo(marginLeft).LeadingOf(view),
                bottomBorder.WithSameRight(view),
                bottomBorder.Height().EqualTo(height),
                bottomBorder.AtBottomOf(view)
                );
        }
Ejemplo n.º 16
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _background.WithSameCenterX(ContentView),
                _background.AtTopOf(ContentView),
                _background.AtBottomOf(ContentView),

                _text.AtTopOf(_background, 2),
                _text.AtBottomOf(_background, 2),
                _text.WithSameCenterX(_background),
                _text.AtLeftOf(_background, 10),
                _text.AtRightOf(_background, 10)
                );
        }
Ejemplo n.º 17
0
        protected override void SetupLayoutConstraints()
        {
            base.SetupLayoutConstraints();

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            this.AddConstraints(
                ContentTableView.FullSizeOf(this).Concat(
                    new FluentLayout[]
            {
                _deviderView.AtTopOf(this),
                _deviderView.AtBottomOf(this),
                _deviderView.AtLeadingOf(this, -1),
                _deviderView.Width().EqualTo(Theme.Dimensions.DeviderWidth)
            }));
        }
Ejemplo n.º 18
0
 public static void AddBottomLine(this UIViewController controller, UIColor color, params UITextField[] fields)
 {
     foreach (var field in fields)
     {
         UIView bottomBorder = new UIView();
         bottomBorder.BackgroundColor = color;
         bottomBorder.TranslatesAutoresizingMaskIntoConstraints = false;
         field.AddSubview(bottomBorder);
         field.AddConstraints(
             bottomBorder.WithRelativeWidth(field),
             bottomBorder.WithSameLeft(field),
             bottomBorder.WithSameRight(field),
             bottomBorder.Height().EqualTo(1),
             bottomBorder.AtBottomOf(field)
             );
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(248, 191, 120);

            var viewContainer = new UIView {
                BackgroundColor = UIColor.Clear
            };

            var sampleText = new UITextView
            {
                Editable        = false,
                Selectable      = false,
                Text            = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet massa eu tempus semper. Nulla elementum mi quis erat blandit eleifend. Quisque dictum, sem eget volutpat scelerisque, quam orci lobortis enim, ut luctus enim massa in nisi. Mauris sed mi id leo lacinia lobortis. Integer elementum, erat gravida vestibulum rhoncus, enim velit consectetur est, dignissim condimentum urna turpis ac ex. Nulla arcu mauris, hendrerit nec tortor in, feugiat ullamcorper mauris. Aliquam eget tempus eros. Curabitur suscipit, arcu eu luctus mollis, nunc erat ornare erat, id viverra nisl ligula sit amet ex. Etiam in quam vitae est convallis eleifend. Fusce gravida arcu in orci lobortis pulvinar. Morbi tortor mi, elementum nec purus quis, eleifend imperdiet mi. Nunc commodo et sem vitae finibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nec erat eget orci malesuada vulputate. \n \nPhasellus vulputate dolor eu massa varius efficitur. Sed sed tortor eu elit ornare mollis id non sapien. Nam at turpis volutpat ligula aliquam aliquet placerat sed purus. Phasellus magna urna, maximus vitae erat et, malesuada tincidunt velit. Mauris efficitur velit fermentum imperdiet convallis. In eget erat nisi. Curabitur ut leo sodales, consectetur lorem ut, iaculis est. Nullam ornare, justo id condimentum pharetra, enim nisl posuere ex, a fermentum justo enim sit amet dolor. Sed suscipit sapien augue, nec dignissim nisl laoreet eu. Maecenas eros enim, aliquet vitae arcu id, fermentum dignissim lorem. Etiam sit amet commodo nunc. In vitae ullamcorper velit. Integer in mauris eget erat mattis feugiat at id neque.",
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.Clear
            };

            sampleText.TextContainer.LineBreakMode = UILineBreakMode.WordWrap;
            sampleText.Font = UIFont.BoldSystemFontOfSize(18f);

            View.AddSubview(viewContainer);
            viewContainer.AddSubview(sampleText);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            viewContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                viewContainer.AtLeftOf(View),
                viewContainer.AtTopOf(View),
                viewContainer.AtRightOf(View),
                viewContainer.AtBottomOf(View)
                );

            viewContainer.AddConstraints(
                sampleText.AtTopOf(viewContainer),
                // sampleText.AtTopOfSafeArea(viewContainer), -> use this when UINavigationBar not present to avoid content overlap under iPhone X notch
                sampleText.AtLeftOfSafeArea(viewContainer),
                //sampleText.AtLeftOf(viewContainer), -> if this is used, content overlaps under notch on landscape
                sampleText.AtRightOfSafeArea(viewContainer),
                //sampleText.AtRightOf(viewContainer), -> if this is used, content overlaps under notch on landscape
                sampleText.AtBottomOfSafeArea(viewContainer)
                //sampleText.AtBottomOf(viewContainer) -> if this is used, content overlaps under notch on landscape
                );
        }
Ejemplo n.º 20
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _headerContainer.AtTopOf(ContentView),
                _headerContainer.AtLeftOf(ContentView),
                _headerContainer.AtRightOf(ContentView),
                _headerContainer.AtBottomOf(ContentView, 5),

                _header.AtTopOf(_headerContainer),
                _header.AtLeftOf(_headerContainer),
                _header.AtRightOf(_headerContainer),
                _header.Height().EqualTo(280),

                _logoShadowView.WithSameCenterY(_logo),
                _logoShadowView.WithSameCenterX(_logo),
                _logoShadowView.Height().EqualTo(110),
                _logoShadowView.Width().EqualTo(110),

                _logo.WithSameBottom(_header).Plus(34),
                _logo.WithSameCenterX(_header),
                _logo.Height().EqualTo(112),
                _logo.Width().EqualTo(112),

                _name.Below(_header, 60),
                _name.AtLeftOf(ContentView, 14),
                _name.AtRightOf(ContentView, 14),
                _name.WithSameCenterX(_headerContainer),

                _joinButton.Below(_name, 20),
                _joinButton.AtLeftOf(ContentView, 50),
                _joinButton.AtRightOf(ContentView, 50),
                _joinButton.Height().EqualTo(45),

                _joinIndicator.WithSameCenterY(_joinButton),
                _joinIndicator.WithSameCenterX(_joinButton),

                //_headerBottomRuler.Below(_header, 140),
                _headerBottomRuler.AtBottomOf(_headerContainer),
                _headerBottomRuler.AtLeftOf(_headerContainer),
                _headerBottomRuler.AtRightOf(_headerContainer),
                _headerBottomRuler.Height().EqualTo(1)
                );
        }
Ejemplo n.º 21
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _backPanel.AtTopOf(ContentView),
                _backPanel.AtLeftOf(ContentView),
                _backPanel.AtRightOf(ContentView),
                _backPanel.AtBottomOf(ContentView),

                _bottomBorder.Height().EqualTo(1),
                _bottomBorder.AtBottomOf(_backPanel),
                _bottomBorder.AtLeftOf(_backPanel),
                _bottomBorder.AtRightOf(_backPanel),

                _text.WithSameCenterY(_backPanel),
                _text.WithSameCenterX(_backPanel)
                );
        }
Ejemplo n.º 22
0
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.Black;

            UIView firstContainer = new UIView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Blue
            },

                   secondContainer = new UIView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Red
            },

                   thirdContainer = new UIView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Yellow,
                Alpha           = .5f
            };

            View.AddSubviews(firstContainer, secondContainer, thirdContainer);

            View.AddConstraints(new FluentLayout[]
            {
                firstContainer.AtTopOf(View),
                firstContainer.AtLeftOf(View),
                firstContainer.AboveCenterOf(View, 10f),
                firstContainer.ToLeftOfCenterOf(View, 10f),

                secondContainer.AtBottomOf(View),
                secondContainer.AtRightOf(View),
                secondContainer.ToRightOfCenterOf(View, 10f),
                secondContainer.BelowCenterOf(View, 10f),

                thirdContainer.ToRightOfCenterOf(firstContainer),
                thirdContainer.ToLeftOfCenterOf(secondContainer),
                thirdContainer.AboveCenterOf(secondContainer),
                thirdContainer.BelowCenterOf(firstContainer)
            });
        }
Ejemplo n.º 23
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _logo.AtLeftOf(ContentView, 14),
                _logo.WithSameCenterY(ContentView),
                _logo.Height().EqualTo(40),
                _logo.Width().EqualTo(40),

                _name.ToRightOf(_logo, 14),
                _name.AtRightOf(ContentView, 14),
                _name.WithSameCenterY(_logo).Minus(3),

                _bottomRuler.AtBottomOf(ContentView),
                _bottomRuler.AtRightOf(ContentView, 14),
                _bottomRuler.AtLeftOf(ContentView, 14),
                _bottomRuler.Height().EqualTo(1)
                );
        }
Ejemplo n.º 24
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _companyButton.AtLeftOf(ContentView, 14),
                _companyButton.Height().EqualTo(34),
                _companyButton.WithSameCenterY(ContentView),

                _memberButton.WithSameWidth(_companyButton),
                _memberButton.WithSameHeight(_companyButton),
                _memberButton.ToRightOf(_companyButton, 14),
                _memberButton.AtRightOf(ContentView, 14),
                _memberButton.WithSameCenterY(ContentView),

                _bottomRuler.AtBottomOf(ContentView),
                _bottomRuler.AtLeftOf(ContentView),
                _bottomRuler.AtRightOf(ContentView),
                _bottomRuler.Height().EqualTo(1)
                );
        }
Ejemplo n.º 25
0
        protected sealed override List <FluentLayout> AddContentConstraints(UIView contentContainer)
        {
            // Base does not set this property on child views
            _childContentContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            // Add the constraints to the child content container which is placed below the text in the parent content container
            _childContentContainer.AddConstraints(AddContentConstraintsBelowText(_childContentContainer));

            // Return constraints for the post text and child content container
            return(new List <FluentLayout>
            {
                _postText.AtTopOf(contentContainer, 10),
                _postText.WithSameLeft(contentContainer),
                _postText.WithSameRight(contentContainer),

                _childContentContainer.Below(_postText, 5),
                _childContentContainer.WithSameLeft(contentContainer),
                _childContentContainer.WithSameRight(contentContainer),
                _childContentContainer.AtBottomOf(contentContainer, 10)
            });
        }
Ejemplo n.º 26
0
        private IEnumerable <FluentLayout> VerticalLinearLayout(UIView container)
        {
            UIView prev = null;

            var subviews = container.Subviews.Where(v => !v.Hidden && !(v == datePicker && DatePickerHidden)).ToList();

            foreach (var v in subviews)
            {
                var isLast = subviews [subviews.Count - 1] == v;

                if (prev == null)
                {
                    yield return(v.AtTopOf(container));
                }
                else if (isLast)
                {
                    yield return(v.Top().GreaterThanOrEqualTo().BottomOf(prev).Plus(5f));
                }
                else
                {
                    yield return(v.Below(prev, 5f));
                }
                yield return(v.Height().EqualTo(60f).SetPriority(UILayoutPriority.DefaultLow));

                yield return(v.Height().GreaterThanOrEqualTo(60f));

                yield return(v.AtLeftOf(container));

                yield return(v.AtRightOf(container));

                prev = v;
            }

            if (prev != null)
            {
                yield return(prev.AtBottomOf(container));
            }
        }
Ejemplo n.º 27
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _avatar.AtTopOf(ContentView, 14),
                _avatar.AtLeftOf(ContentView, 14),
                _avatar.Height().EqualTo(30),
                _avatar.Width().EqualTo(30),

                _displayName.WithSameTop(_avatar),
                _displayName.ToRightOf(_avatar, 10),

                _timeAgo.ToRightOf(_displayName, 6),
                _timeAgo.WithSameBottom(_displayName),
                //_timeAgo.AtLeftOf(ContentView, 14),

                _text.Below(_displayName, 5),
                _text.WithSameLeft(_displayName),
                _text.AtRightOf(ContentView, 14),

                _extraText.Below(_text, 10),
                _extraText.WithSameLeft(_text),
                _extraText.AtRightOf(ContentView, 14),

                _bottomRuler.Below(_extraText, 10),
                _bottomRuler.WithSameLeft(ContentView),
                _bottomRuler.WithSameRight(ContentView),
                _bottomRuler.Height().EqualTo(1),
                _bottomRuler.AtBottomOf(ContentView),

                _backgroundColor.AtLeftOf(ContentView),
                _backgroundColor.AtTopOf(ContentView),
                _backgroundColor.AtRightOf(ContentView),
                _backgroundColor.AtBottomOf(ContentView)
                );
        }
Ejemplo n.º 28
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _bottomRulerLeftConstraint  = _bottomRuler.AtLeftOf(ContentView, 14).ToLayoutConstraints().First();
            _bottomRulerRightConstraint = _bottomRuler.AtRightOf(ContentView, 14).ToLayoutConstraints().First();

            ContentView.AddConstraint(_bottomRulerLeftConstraint);
            ContentView.AddConstraint(_bottomRulerRightConstraint);

            ContentView.AddConstraints(
                _avatar.AtTopOf(ContentView, 14),
                _avatar.AtLeftOf(ContentView, 14),
                _avatar.Height().EqualTo(35),
                _avatar.Width().EqualTo(35),

                _displayName.WithSameTop(_avatar).Minus(2),
                _displayName.Height().EqualTo(20),
                _displayName.ToRightOf(_avatar, 13),

                _timeAgo.ToRightOf(_displayName, 7),
                _timeAgo.WithSameBottom(_displayName),
                //_timeAgo.AtLeftOf(ContentView, 14),

                Text.Below(_displayName, 3),
                Text.ToLeftOf(_contextButton, 10),
                Text.ToRightOf(_avatar, 10),

                _contextButton.AtRightOf(ContentView, 10),
                _contextButton.AtTopOf(ContentView, 5),
                _contextButton.Width().EqualTo(30),
                _contextButton.Height().EqualTo(30),

                _bottomRuler.Height().EqualTo(1),
                _bottomRuler.AtBottomOf(ContentView)
                );
        }
Ejemplo n.º 29
0
        public UseFullLinkView()
        {
            BackgroundColor  = ApplicationColors.CellBackgroundColor;
            TopSeparatorView = new UIView();
            TopSeparatorView.BackgroundColor = ApplicationColors.SeparatorColor;

            Logo               = new UIImageView();
            Name               = new UILabel();
            Name.TextColor     = ApplicationColors.ForegroundHeaderCellColor;
            Name.Font          = UIFont.FromName(ApplicationStyle.ContentFontName, ApplicationStyle.TitleCellFontSize);
            Name.LineBreakMode = UILineBreakMode.TailTruncation;

            BottomSeparatorView = new UIView();
            BottomSeparatorView.BackgroundColor = ApplicationColors.SeparatorColor;

            AddSubviews(TopSeparatorView, Logo, Name, BottomSeparatorView);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            nfloat separatorHeight = 1;
            nfloat hmargin         = 15;
            nfloat imageSize       = 25;

            this.AddConstraints(
                TopSeparatorView.WithSameWidth(this),
                TopSeparatorView.Height().EqualTo(separatorHeight),
                TopSeparatorView.AtTopOf(this),
                Logo.WithSameCenterY(this),
                Logo.AtLeftOf(this, hmargin),
                Logo.Width().EqualTo(imageSize),
                Logo.Height().EqualTo(imageSize),
                Name.WithSameCenterY(this),
                Name.ToRightOf(Logo, hmargin),
                BottomSeparatorView.WithSameWidth(this),
                BottomSeparatorView.Height().EqualTo(separatorHeight),
                BottomSeparatorView.AtBottomOf(this));
        }
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            ContentView.AddConstraints(
                _backpanel.AtTopOf(ContentView, 5),
                _backpanel.AtLeftOf(ContentView),
                _backpanel.AtRightOf(ContentView),
                _backpanel.AtBottomOf(ContentView),

                _topBorder.AtTopOf(_backpanel),
                _topBorder.AtLeftOf(_backpanel),
                _topBorder.AtRightOf(_backpanel),
                _topBorder.Height().EqualTo(1),

                _background1.AtTopOf(_backpanel, 7),
                _background1.AtLeftOf(_backpanel, 14),
                _background1.AtBottomOf(_backpanel, 0),

                _title1.WithSameCenterX(_background1),
                _title1.WithSameCenterY(_background1),
                _title1.WithSameRight(_background1),
                _title1.WithSameLeft(_background1),

                _background2.AtTopOf(_backpanel, 7),
                _background2.AtRightOf(_backpanel, 14),
                _background2.AtBottomOf(_backpanel, 0),
                _background2.WithSameWidth(_background1),
                _background2.ToRightOf(_background1, 7),

                _title2.WithSameCenterX(_background2),
                _title2.WithSameRight(_background2),
                _title2.WithSameLeft(_background2),
                _title2.WithSameCenterY(_background2)
                );
        }
        public override void LoadView ()
        {
            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = model.StartTime,
                StopTime = model.StopTime,
            }.Apply (BindStartStopView));
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            }.Apply (Style.EditTimeEntry.DatePicker).Apply (BindDatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (BindProjectButton));
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = (tf) => tf.ResignFirstResponder (),
            }.Apply (Style.EditTimeEntry.DescriptionField).Apply (BindDescriptionField));
            descriptionTextField.EditingChanged += OnDescriptionFieldEditingChanged;
            descriptionTextField.EditingDidEnd += (s, e) => CommitDescriptionChanges ();

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.TagsButton).Apply (BindTagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            }.Apply (Style.EditTimeEntry.BillableContainer).Apply (BindBillableSwitch));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);
            billableSwitch.Switch.ValueChanged += OnBillableSwitchValueChanged;

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            wrapper.AddConstraints (VerticalLinearLayout (wrapper));
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
Ejemplo n.º 32
0
        public override void LoadView ()
        {
            View = new UIView ()
                .Apply (Style.Screen);

            View.Add (inputsContainer = new UIView ().Apply (Style.Signup.InputsContainer));

            inputsContainer.Add (topBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            inputsContainer.Add (emailTextField = new UITextField () {
                Placeholder = "SignupEmailHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType = UIKeyboardType.EmailAddress,
                ReturnKeyType = UIReturnKeyType.Next,
                ClearButtonMode = UITextFieldViewMode.Always,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Signup.EmailField));
            emailTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add (middleBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            inputsContainer.Add(passwordTextField = new PasswordTextField () {
                Placeholder = "SignupPasswordHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                SecureTextEntry = true,
                ReturnKeyType = UIReturnKeyType.Go,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Signup.PasswordField));
            passwordTextField.EditingChanged += OnTextFieldEditingChanged;

            inputsContainer.Add (bottomBorder = new UIView ().Apply (Style.Signup.InputsBorder));

            View.Add (passwordActionButton = new UIButton ()
                .Apply (Style.Signup.SignupButton));
            passwordActionButton.SetTitle ("SignupSignupButtonText".Tr (), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            View.Add (googleActionButton = new UIButton ()
                .Apply (Style.Signup.GoogleButton));
            googleActionButton.SetTitle ("SignupGoogleButtonText".Tr (), UIControlState.Normal);
            googleActionButton.TouchUpInside += OnGoogleActionButtonTouchUpInside;

            View.Add (legalLabel = new TTTAttributedLabel () {
                Delegate = new LegalLabelDelegate (),
            }.Apply (Style.Signup.LegalLabel));
            SetLegalText (legalLabel);

            inputsContainer.AddConstraints (
                topBorder.AtTopOf (inputsContainer),
                topBorder.AtLeftOf (inputsContainer),
                topBorder.AtRightOf (inputsContainer),
                topBorder.Height ().EqualTo (1f),

                emailTextField.Below (topBorder),
                emailTextField.AtLeftOf (inputsContainer, 20f),
                emailTextField.AtRightOf (inputsContainer, 10f),
                emailTextField.Height ().EqualTo (42f),

                middleBorder.Below (emailTextField),
                middleBorder.AtLeftOf (inputsContainer, 20f),
                middleBorder.AtRightOf (inputsContainer),
                middleBorder.Height ().EqualTo (1f),

                passwordTextField.Below (middleBorder),
                passwordTextField.AtLeftOf (inputsContainer, 20f),
                passwordTextField.AtRightOf (inputsContainer),
                passwordTextField.Height ().EqualTo (42f),

                bottomBorder.Below (passwordTextField),
                bottomBorder.AtLeftOf (inputsContainer),
                bottomBorder.AtRightOf (inputsContainer),
                bottomBorder.AtBottomOf (inputsContainer),
                bottomBorder.Height ().EqualTo (1f)
            );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            View.AddConstraints (
                inputsContainer.AtTopOf (View, 80f),
                inputsContainer.AtLeftOf (View),
                inputsContainer.AtRightOf (View),

                passwordActionButton.Below (inputsContainer, 20f),
                passwordActionButton.AtLeftOf (View),
                passwordActionButton.AtRightOf (View),
                passwordActionButton.Height ().EqualTo (60f),

                googleActionButton.Below (passwordActionButton, 5f),
                googleActionButton.AtLeftOf (View),
                googleActionButton.AtRightOf (View),
                googleActionButton.Height ().EqualTo (60f),

                legalLabel.AtBottomOf (View, 30f),
                legalLabel.AtLeftOf (View, 40f),
                legalLabel.AtRightOf (View, 40f)
            );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            ResetSignupButtonState ();
        }
Ejemplo n.º 33
0
        public override void LoadView ()
        {
            View = new UIView ()
                .Apply (Style.Screen);

            View.Add (inputsContainer = new UIView ().Apply (Style.Login.InputsContainer));

            inputsContainer.Add (topBorder = new UIView ().Apply (Style.Login.InputsBorder));

            inputsContainer.Add (emailTextField = new UITextField () {
                Placeholder = "LoginEmailHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType = UIKeyboardType.EmailAddress,
                ReturnKeyType = UIReturnKeyType.Next,
                ClearButtonMode = UITextFieldViewMode.Always,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Login.EmailField));

            inputsContainer.Add (middleBorder = new UIView ().Apply (Style.Login.InputsBorder));

            inputsContainer.Add (passwordTextField = new UITextField () {
                Placeholder = "LoginPasswordHint".Tr (),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType = UITextAutocorrectionType.No,
                SecureTextEntry = true,
                ReturnKeyType = UIReturnKeyType.Go,
                ShouldReturn = HandleShouldReturn,
            }.Apply (Style.Login.PasswordField));

            inputsContainer.Add (bottomBorder = new UIView ().Apply (Style.Login.InputsBorder));

            View.Add (passwordActionButton = new UIButton ()
                .Apply (Style.Login.LoginButton));
            passwordActionButton.SetTitle ("LoginLoginButtonText".Tr (), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            inputsContainer.AddConstraints (
                topBorder.AtTopOf (inputsContainer),
                topBorder.AtLeftOf (inputsContainer),
                topBorder.AtRightOf (inputsContainer),
                topBorder.Height ().EqualTo (1f),

                emailTextField.Below (topBorder),
                emailTextField.AtLeftOf (inputsContainer, 20f),
                emailTextField.AtRightOf (inputsContainer, 10f),
                emailTextField.Height ().EqualTo (42f),

                middleBorder.Below (emailTextField),
                middleBorder.AtLeftOf (inputsContainer, 20f),
                middleBorder.AtRightOf (inputsContainer),
                middleBorder.Height ().EqualTo (1f),

                passwordTextField.Below (middleBorder),
                passwordTextField.AtLeftOf (inputsContainer, 20f),
                passwordTextField.AtRightOf (inputsContainer),
                passwordTextField.Height ().EqualTo (42f),

                bottomBorder.Below (passwordTextField),
                bottomBorder.AtLeftOf (inputsContainer),
                bottomBorder.AtRightOf (inputsContainer),
                bottomBorder.AtBottomOf (inputsContainer),
                bottomBorder.Height ().EqualTo (1f)
            );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();

            View.AddConstraints (
                inputsContainer.AtTopOf (View, 80f),
                inputsContainer.AtLeftOf (View),
                inputsContainer.AtRightOf (View),

                passwordActionButton.Below (inputsContainer, 20f),
                passwordActionButton.AtLeftOf (View),
                passwordActionButton.AtRightOf (View),
                passwordActionButton.Height ().EqualTo (60f)
            );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
        }
        public override void LoadView ()
        {
            durationButton = new UIButton ().Apply (Style.NavTimer.DurationButton);
            durationButton.SetTitle (DefaultDurationText, UIControlState.Normal); // Dummy content to use for sizing of the label
            durationButton.SizeToFit ();
            durationButton.TouchUpInside += OnDurationButtonTouchUpInside;
            NavigationItem.TitleView = durationButton;

            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = ViewModel.StartDate,
                StopTime = ViewModel.StopDate,
            });
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            } .Apply (Style.EditTimeEntry.DatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = tf => tf.ResignFirstResponder (),
            } .Apply (Style.EditTimeEntry.DescriptionField));

            descriptionTextField.ShouldBeginEditing += (s) => {
                ForceDimissDatePicker();
                return true;
            };
            descriptionTextField.ShouldEndEditing += s => {
                return true;
            };

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.TagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            } .Apply (Style.EditTimeEntry.BillableContainer));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            ResetWrapperConstraints ();
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
Ejemplo n.º 35
0
        public override void LoadView ()
        {
            base.LoadView ();

            isUserLogged = UserDefaults.BoolForKey (IsUserLoggedKey);
            isAppActive = UserDefaults.BoolForKey (AppActiveEntryKey);
            isAppOnBackground = UserDefaults.BoolForKey (AppBackgroundEntryKey);

            marginTop = (isUserLogged && isAppActive) ? 10f : 1f;
            height = (isUserLogged && isAppActive) ? 250f : 62f; // 4 x 60f(cells),

            var v = new UIView {
                BackgroundColor = UIColor.Clear,
                Frame = new CGRect (0,0, UIScreen.MainScreen.Bounds.Width, height),
            };

            v.Add (tableView = new UITableView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Clear,
                TableFooterView = new UIView(),
                ScrollEnabled = false,
                RowHeight = cellHeight,
            });

            v.Add (openAppView = new UIView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = true,
            });

            UIView bg;
            openAppView.Add (bg = new UIView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Black,
                Alpha = 0.1f,
            });

            UILabel textView;
            openAppView.Add (textView = new UILabel {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.FromName ("Helvetica", 13f),
                Text = isAppActive ? "NoLoggedUser".Tr() : "NoActiveApp".Tr(),
                TextColor = UIColor.White,
                BackgroundColor = UIColor.Clear,
            });

            openAppView.Add (openAppBtn = new StartStopBtn {
                TranslatesAutoresizingMaskIntoConstraints = false,
                IsActive = true,
            });

            openAppView.AddConstraints (

                bg.AtTopOf (openAppView),
                bg.AtLeftOf (openAppView),
                bg.AtRightOf (openAppView),
                bg.AtBottomOf (openAppView),

                textView.WithSameCenterY (openAppView),
                textView.AtLeftOf (openAppView, 50f),
                textView.WithSameHeight (openAppView),
                textView.AtRightOf (openAppView),

                openAppBtn.Width().EqualTo (35f),
                openAppBtn.Height().EqualTo (35f),
                openAppBtn.AtRightOf (openAppView, 15f),
                openAppBtn.WithSameCenterY (openAppView),

                null
            );

            v.AddConstraints (

                tableView.AtTopOf (v),
                tableView.WithSameWidth (v),
                tableView.Height().EqualTo (height - marginTop).SetPriority (UILayoutPriority.DefaultLow),
                tableView.AtBottomOf (v),

                openAppView.AtTopOf (v),
                openAppView.WithSameWidth (v),
                openAppView.Height().EqualTo (cellHeight),

                null
            );

            View = v;
        }
Ejemplo n.º 36
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.Blue;
            TheViewController = this;

            //Enumerate SVG with BundleResource action in the Resources/svg folder
            //var path = Path.Combine(NSBundle.MainBundle.BundlePath,"svg");
            var bundleSvgs = new List<string>(); //Directory.EnumerateFiles(path, "*.svg").Select(Path.GetFileName).OrderBy(s => s).ToList();

            //Enumerate SVG with EmbeddedResource action in the XamSvgDemo.Shared project, in the images folder.
            var assembly = typeof (App).GetTypeInfo().Assembly;
            var sharedSvgs = assembly.GetManifestResourceNames().Where(n => n.EndsWith(".svg")).OrderBy(n => n).ToArray();

            //Combine both lists
            var svgNames = bundleSvgs.Select(s => "svg/" + s).Concat(
                            sharedSvgs.Select(s => "res:" + s)
                            ).ToList();

            var index = 0;

#if !USEAUTOLAYOUT
            //Fix width, let height be changed by UISvgImageView
            var bounds = UIScreen.MainScreen.Bounds;
            image = new UISvgImageView(svgNames[index], bounds.Width, 0) { Frame = new CGRect(0,0,bounds.Width, bounds.Height) };
#else
            image = new UISvgImageView(svgNames[index]);
#endif

            image.Layer.BorderWidth = 1;
            image.Layer.BorderColor = UIColor.Green.CGColor;
            View.Add(image);

            title = new UILabel
            {
                TextColor=UIColor.White,
                Font = UIFont.SystemFontOfSize(14f),
                LineBreakMode = UILineBreakMode.CharacterWrap,
                Lines = 0,
#if !USEAUTOLAYOUT
                Frame = new CGRect(0,30,320,100),
#endif
            };
            View.Add(title);

#if USEAUTOLAYOUT
            var back = new UIView {BackgroundColor = UIColor.DarkGray.ColorWithAlpha(.6f)};
            var back2 = new UIView { BackgroundColor = UIColor.Clear };
            var inputUrl = new UITextField
            {
                TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(14f),

                AttributedPlaceholder = new NSMutableAttributedString("Enter url of svg file, or tap anywhere for demo",
                    foregroundColor: UIColor.Gray, font: UIFont.ItalicSystemFontOfSize(12)),
                KeyboardType = UIKeyboardType.Url, AutocorrectionType = UITextAutocorrectionType.No,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                //ReturnKeyType = UIReturnKeyType.Go,
                //EnablesReturnKeyAutomatically = true, ShouldReturn = 
            };
            //var inputOk = new UISvgImageView("res:images.download", 25, colorMapping: "000000=FF546D", colorMappingSelected: "000000=00FF59")
            //{
            //    UserInteractionEnabled = true,
            //};
            var inputOk = new UISvgImageView
            {
                UserInteractionEnabled = true,
                TranslatesAutoresizingMaskIntoConstraints = false,
                FillWidth = 25,
                ColorMapping="000000=FF546D",
                ColorMappingSelected="000000=00FF59",
                BundleName = "res:images.download"
            };
            //var inputOk = new UISvgImageView("", 25); //for debug
            View.Add(back);
            View.Add(back2);
            View.SendSubviewToBack(back);
            View.SendSubviewToBack(image); //image behind back
            View.Add(inputUrl);
            View.Add(inputOk);

            inputOk.AddGestureRecognizer(new UITapGestureRecognizer(tap =>
            {
                inputUrl.ResignFirstResponder();
                var dontWait = LoadSvg(inputUrl.Text);
            }));

            inputUrl.EditingDidBegin += (sender, args) =>
            {
                inputUrl.SelectAll(this);
            };

            inputUrl.SetContentHuggingPriority((float)UILayoutPriority.FittingSizeLevel, UILayoutConstraintAxis.Horizontal);
            inputOk.SetContentCompressionResistancePriority((float)UILayoutPriority.Required, UILayoutConstraintAxis.Horizontal);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(
                back.WithSameTop(inputOk).Minus(5),
                back.AtLeftOf(View),
                back.AtRightOf(View),
                back.WithSameBottom(title).Plus(5),

                back2.Below(back),
                back2.AtLeftOf(View),
                back2.AtRightOf(View),
                back2.AtBottomOf(View),

                inputUrl.AtLeftOf(View, 5),
                inputUrl.WithSameCenterY(inputOk),

                inputOk.AtTopOf(View,30),
                inputOk.AtRightOf(View, 5),
                inputOk.ToRightOf(inputUrl,5),

                title.Below(inputUrl, 20),
                title.AtLeftOf(View, 5),
                title.AtRightOf(View,5),
                //No height for title, use its intrinsic height

                image.AtBottomOf(View),
                image.AtLeftOf(View),
                //Test: Width forced, free height
                image.WithSameWidth(View),
                //Test: Width forced, Height forced to view height
                image.Height().LessThanOrEqualTo().HeightOf(View)
                //Test: Width forced, Height forced (50)
                );
#endif
            image.FillMode = SvgFillMode.Fit;

            //var t = new UIImageView(new CGRect(0, 0, 100, 100));
            //t.Image = LoadLastSvgFromString();
            //View.Add(t);

            //image.UserInteractionEnabled = true;
            back2.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                index = ++index%svgNames.Count;
                image.BundleName = svgNames[index];
                title.Text = $"Displaying {svgNames[index]}";
                title.TextColor = UIColor.White;

            }) { NumberOfTapsRequired = 1 });

        }