Ejemplo n.º 1
0
            public override void UpdateConstraints()
            {
                RemoveConstraints(Constraints);

                switch (viewLayout)
                {
                case LayoutVariant.StartOnly:
                    arrowImageView.RemoveFromSuperview();
                    stopDateTimeButton.RemoveFromSuperview();

                    this.AddConstraints(
                        startDateTimeButton.WithSameCenterX(this),
                        startDateTimeButton.WithSameCenterY(this),
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f)
                        );
                    break;

                case LayoutVariant.BothCenterStart:
                    AddSubview(arrowImageView);
                    AddSubview(stopDateTimeButton);

                    this.AddConstraints(
                        startDateTimeButton.WithSameCenterX(this),
                        startDateTimeButton.WithSameCenterY(this),
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f),

                        arrowImageView.WithSameCenterY(startDateTimeButton),
                        arrowImageView.ToRightOf(startDateTimeButton, 10f),
                        arrowImageView.ToLeftOf(stopDateTimeButton, 10f),

                        stopDateTimeButton.AtTopOf(this, 10f),
                        stopDateTimeButton.AtBottomOf(this, 10f)
                        );
                    break;

                case LayoutVariant.BothCenterAll:
                default:
                    AddSubview(arrowImageView);
                    AddSubview(stopDateTimeButton);

                    this.AddConstraints(
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f),

                        arrowImageView.WithSameCenterX(this),
                        arrowImageView.WithSameCenterY(this),
                        arrowImageView.ToRightOf(startDateTimeButton, 10f),
                        arrowImageView.ToLeftOf(stopDateTimeButton, 10f),

                        stopDateTimeButton.AtTopOf(this, 10f),
                        stopDateTimeButton.AtBottomOf(this, 10f)
                        );
                    break;
                }

                base.UpdateConstraints();
            }
Ejemplo n.º 2
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.º 3
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.º 4
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.º 5
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.º 6
0
        public override void LoadView()
        {
            View = new UIImageView()
            {
                UserInteractionEnabled = true,
            }.Apply(Style.Welcome.Background);
            View.Add(logoImageView = new UIImageView().Apply(Style.Welcome.Logo));
            View.Add(sloganLabel   = new UILabel()
            {
                Text = "WelcomeSlogan".Tr(),
            }.Apply(Style.Welcome.Slogan));
            View.Add(createButton   = new UIButton().Apply(Style.Welcome.CreateAccount));
            View.Add(passwordButton = new UIButton().Apply(Style.Welcome.PasswordLogin));
            View.Add(googleButton   = new UIButton().Apply(Style.Welcome.GoogleLogin));

            createButton.SetTitle("WelcomeCreate".Tr(), UIControlState.Normal);
            passwordButton.SetTitle("WelcomePassword".Tr(), UIControlState.Normal);
            googleButton.SetTitle("WelcomeGoogle".Tr(), UIControlState.Normal);

            createButton.TouchUpInside   += OnCreateButtonTouchUpInside;
            passwordButton.TouchUpInside += OnPasswordButtonTouchUpInside;
            googleButton.TouchUpInside   += OnGoogleButtonTouchUpInside;

            View.AddConstraints(
                logoImageView.AtTopOf(View, 70f),
                logoImageView.WithSameCenterX(View),

                sloganLabel.Below(logoImageView, 18f),
                sloganLabel.AtLeftOf(View, 25f),
                sloganLabel.AtRightOf(View, 25f),

                googleButton.AtBottomOf(View, 20f),
                googleButton.AtLeftOf(View),
                googleButton.AtRightOf(View),
                googleButton.Height().EqualTo(60f),

                passwordButton.Above(googleButton, 25f),
                passwordButton.AtLeftOf(View),
                passwordButton.AtRightOf(View),
                passwordButton.Height().EqualTo(60f),

                createButton.Above(passwordButton, 5f),
                createButton.AtLeftOf(View),
                createButton.AtRightOf(View),
                createButton.Height().EqualTo(60f)
                );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
        }
Ejemplo n.º 7
0
        public override void LoadView ()
        {
            View = new UIImageView () {
                UserInteractionEnabled = true,
            } .Apply (Style.Welcome.Background);
            View.Add (logoImageView = new UIImageView ().Apply (Style.Welcome.Logo));
            View.Add (sloganLabel = new UILabel () {
                Text = "WelcomeSlogan".Tr (),
            } .Apply (Style.Welcome.Slogan));
            View.Add (createButton = new UIButton ().Apply (Style.Welcome.CreateAccount));
            View.Add (passwordButton = new UIButton ().Apply (Style.Welcome.PasswordLogin));
            View.Add (googleButton = new UIButton ().Apply (Style.Welcome.GoogleLogin));

            createButton.SetTitle ("WelcomeCreate".Tr (), UIControlState.Normal);
            passwordButton.SetTitle ("WelcomePassword".Tr (), UIControlState.Normal);
            googleButton.SetTitle ("WelcomeGoogle".Tr (), UIControlState.Normal);

            createButton.TouchUpInside += OnCreateButtonTouchUpInside;
            passwordButton.TouchUpInside += OnPasswordButtonTouchUpInside;
            googleButton.TouchUpInside += OnGoogleButtonTouchUpInside;

            View.AddConstraints (
                logoImageView.AtTopOf (View, 70f),
                logoImageView.WithSameCenterX (View),

                sloganLabel.Below (logoImageView, 18f),
                sloganLabel.AtLeftOf (View, 25f),
                sloganLabel.AtRightOf (View, 25f),

                googleButton.AtBottomOf (View, 20f),
                googleButton.AtLeftOf (View),
                googleButton.AtRightOf (View),
                googleButton.Height ().EqualTo (60f),

                passwordButton.Above (googleButton, 25f),
                passwordButton.AtLeftOf (View),
                passwordButton.AtRightOf (View),
                passwordButton.Height ().EqualTo (60f),

                createButton.Above (passwordButton, 5f),
                createButton.AtLeftOf (View),
                createButton.AtRightOf (View),
                createButton.Height ().EqualTo (60f)
            );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints ();
        }
Ejemplo n.º 8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _mapView = new BindingMKMapView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _delegate = new LocationTrackingMapDelegate(_mapView);

            _toggleButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Black
            };
            _toggleButton.SetTitle("Pins", UIControlState.Normal);

            View.AddSubviews(_mapView, _toggleButton);

            View.AddConstraints(new FluentLayout[]
            {
                _toggleButton.AtBottomOf(View),
                _toggleButton.AtLeftOf(View),
                _toggleButton.AtRightOf(View),

                _mapView.AtTopOf(View),
                _mapView.AtLeftOf(View),
                _mapView.AtRightOf(View),
                _mapView.Above(_toggleButton)
            });

            var bindingSet = this.CreateBindingSet <LocationTrackingView, LocationTrackingViewModel>();

            bindingSet.Bind(_mapView).For(v => v.UserCurrentLocation).To(vm => vm.UserLocation);
            bindingSet.Bind(_mapView).For(v => v.CenterMapLocation).To(vm => vm.UserLocation);
            bindingSet.Bind(_mapView).For(v => v.ShowsUserLocation).To(vm => vm.CanTrackLocation);
            bindingSet.Bind(_delegate).For(v => v.AnnotationSource).To(vm => vm.Pins);
            bindingSet.Bind(_toggleButton).To(vm => vm.NavigateToMapPinsCommand);
            bindingSet.Bind(_delegate).For(v => v.LocationChanged).To(vm => vm.UserLocationChangedCommand);

            _mapView.Delegate = _delegate;

            bindingSet.Apply();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Creates the hold button.
        /// </summary>
        public void CreateHoldButton()
        {
            //1. create view
            HoldButton = new UIButton();
            HoldButton.BackgroundColor = View.BackgroundColor;
            HoldButton.TouchDown      += HoldButton_TouchDown;
            HoldButton.TouchUpInside  += HoldButton_TouchUpInside;

            //2. add view to parent view
            Add(HoldButton);

            //3. call method on parent view
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            //4. add constraints
            View.AddConstraints(
                HoldButton.AtBottomOf(View),
                HoldButton.Width().EqualTo(100),
                HoldButton.Height().EqualTo(StatusBarH + ButtonPadding)
                );
        }
        private void SetupView()
        {
            View.BackgroundColor = UIColor.White;

            _welcomeLabel           = new UILabel();
            _welcomeLabel.Text      = "Congratulations! You found secret ingredient!";
            _welcomeLabel.Font      = UIFont.FromName("ArialMT", 12f);
            _welcomeLabel.TextColor = UIColor.Black;

            _mainImage             = new UIImageView();
            _mainImage.Image       = UIImage.FromBundle("details_logo");
            _mainImage.Frame       = new CGRect(0, 0, _mainImage.Image.CGImage.Width, _mainImage.Image.CGImage.Height);
            _mainImage.ContentMode = UIViewContentMode.ScaleAspectFit;

            _dismissButton = new UIButton(UIButtonType.RoundedRect);
            _dismissButton.SetTitle("Dismiss", UIControlState.Normal);
            _dismissButton.Font = UIFont.FromName("HelveticaNeue-Bold", 15f);
            _dismissButton.SetTitleColor(UIColor.FromRGB(36, 183, 128), UIControlState.Normal);

            Add(_welcomeLabel);
            Add(_mainImage);
            Add(_dismissButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();


            View.AddConstraints(
                _welcomeLabel.WithSameCenterY(View),
                _welcomeLabel.WithSameCenterX(View),

                _mainImage.Below(_welcomeLabel, 20),
                _mainImage.Height().EqualTo(70),
                _mainImage.Width().EqualTo(70),
                _mainImage.WithSameCenterX(_welcomeLabel),
                _dismissButton.AtBottomOf(View, 40),
                _dismissButton.WithSameCenterX(_mainImage),
                _dismissButton.AtLeftOf(View, 40),
                _dismissButton.AtRightOf(View, 40)
                );
        }
Ejemplo n.º 11
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",
                IsLoadAsync          = false
            };


            var btn = new UIButton();
            btn.SetTitle("Test1", UIControlState.Normal);
            btn.SetContentCompressionResistancePriority((float)UILayoutPriority.Required, UILayoutConstraintAxis.Vertical);

            //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);
            View.Add(btn);

            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

                btn.AtRightOf(View),
                btn.AtLeftOf(View),
                btn.AtBottomOf(View),

                image.Below(back),
                image.AtLeftOf(View),
                //Test: Width forced, free height
                image.WithSameWidth(View),
                //Test: Width forced, Height forced to view height
                //image.Height().LessThanOrEqualTo().HeightOf(View)
                image.Above(btn)
                //Test: Width forced, Height forced (50)
                );


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


            btn.TouchUpInside += (sender, args) =>
            {
                //var sb = UIStoryboard.FromName("TestFullWidthConstraint", null);
                //var vc = sb.InstantiateViewController("TestFullWidthConstraintViewController");
                var sb = UIStoryboard.FromName("AllViews", null);

                //var vc = sb.InstantiateViewController(nameof(TestUpdateViewController));
                var vc = sb.InstantiateViewController(nameof(TestImageFactoryViewController));

                NavigationController.PushViewController(vc, true);
            };
#endif
            image.FillMode = SvgFillMode.Fit;

            NavigationItem.TitleView = new UISvgImageView("res:images.atom")
            {
                IsLoadAsync   = false,
                FillMode      = SvgFillMode.Fit,
                AlignmentMode = SvgAlignmentMode.Center,
                Frame         = new CGRect(0, 0, NavigationController.NavigationBar.Bounds.Width, NavigationController.NavigationBar.Bounds.Height)
            };

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

            //image.UserInteractionEnabled = true;


            //var bounds = SvgFactory.GetBounds("res:images.logoImage", 100, 100, fillMode: SvgFillMode.Fit);
            //var image = SvgFactory.FromBundle("res:images.logoImage", 100, 100, fillMode: SvgFillMode.Fit);
        }
Ejemplo n.º 12
0
        private void SetupConstraints()
        {
            ScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _containerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                _containerView.WithSameWidth(View),

                _background.AtTopOf(View),
                _background.AtLeftOf(View),
                _background.AtRightOf(View),
                _background.AtBottomOf(View)
                );

            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),

                _registerButton.AtBottomOf(_containerView, 40),
                _registerButton.AtLeftOf(_containerView, 35),

                _forgotPasswordButton.AtBottomOf(_containerView, 40),
                _forgotPasswordButton.AtRightOf(_containerView, 35),

                _signinButton.Above(_registerButton, 40),
                _signinButton.Height().EqualTo(40),
                _signinButton.WithSameLeft(_registerButton),
                _signinButton.WithSameRight(_forgotPasswordButton),

                _passwordRuler.Above(_signinButton, 30),
                _passwordRuler.WithSameLeft(_registerButton),
                _passwordRuler.WithSameRight(_forgotPasswordButton),
                _passwordRuler.Height().EqualTo(1),

                _password.Above(_passwordRuler, 15),
                _password.WithSameRight(_forgotPasswordButton),
                _password.Height().EqualTo(20),
                _password.ToRightOf(_passwordImage, 15),

                _passwordImage.WithSameCenterY(_password),
                _passwordImage.WithSameLeft(_passwordRuler),
                _passwordImage.Height().EqualTo(20),
                _passwordImage.Width().EqualTo(20),

                _emailRuler.Above(_password, 15),
                _emailRuler.WithSameLeft(_registerButton),
                _emailRuler.WithSameRight(_forgotPasswordButton),
                _emailRuler.Height().EqualTo(1),

                _email.Above(_emailRuler, 15),
                _email.WithSameRight(_forgotPasswordButton),
                _email.Height().EqualTo(20),
                _email.ToRightOf(_emailImage, 15),

                _emailImage.WithSameCenterY(_email),
                _emailImage.WithSameLeft(_emailRuler),
                _emailImage.Height().EqualTo(20),
                _emailImage.Width().EqualTo(20)
                );
        }
Ejemplo n.º 13
0
        public override void LoadView()
        {
            View = new UIView();

            _pageViewController = new MultiStepProcessHorizontal(new MultiStepProcessDataSource(Steps));
            _pageViewController.WillTransition += _multiStepProcessHorizontal_WillTransition;

            _pageControl = new HorizontalSwipePageControl
            {
                CurrentPage = 0,
                Pages       = Steps.Count - 1
            };
            _skipButton = new UIButton();
            _skipButton.SetTitle("Skip", UIControlState.Normal);
            _skipButton.SetTitleColor(IOSTheme.JGLightPink, UIControlState.Normal);
            _skipButton.Font = IOSTheme.ThemeFontRegular(14);

            _skipButton.TouchUpInside += SkipTapped;


            _getStartedButton = new UIButton();
            _getStartedButton.SetTitle("Get started", UIControlState.Normal);
            _getStartedButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _getStartedButton.Font = IOSTheme.ThemeFontBold(16);
            _getStartedButton.Layer.BorderWidth  = 1;
            _getStartedButton.Layer.BorderColor  = UIColor.White.CGColor;
            _getStartedButton.Layer.CornerRadius = 2;
            _getStartedButton.AccessibilityLabel = "GetStartedButton";


            _getStartedButton.TouchUpInside += GetStartedTapped;

            _pageControl.CurrentPage = 0;

            View.Add(_pageViewController.View);
            View.Add(_pageControl);
            View.Add(_skipButton);
            View.Add(_getStartedButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(
                _pageViewController.View.AtTopOf(View),
                _pageViewController.View.AtBottomOf(View),
                _pageViewController.View.AtLeftOf(View),
                _pageViewController.View.AtRightOf(View),

                _pageControl.WithSameCenterX(_pageViewController.View),
                _pageControl.AtBottomOf(View, 20),

                _skipButton.AtRightOf(View, 18),
                _skipButton.WithSameCenterY(_pageControl),

                _getStartedButton.Height().EqualTo(44),
                _getStartedButton.WithSameCenterX(View),
                _getStartedButton.AtLeftOf(View, 22),
                _getStartedButton.AtRightOf(View, 22),
                _getStartedButton.AtBottomOf(View, 22)
                );

            View.BringSubviewToFront(_getStartedButton);
        }
Ejemplo n.º 14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "Chafu";

            var deleteAll = new UIBarButtonItem(UIBarButtonSystemItem.Trash)
            {
                TintColor = Configuration.BackgroundColor
            };


            NavigationController.NavigationBar.BarTintColor = Configuration.TintColor;
            NavigationController.NavigationBar.TintColor    = Configuration.BaseTintColor;
            NavigationItem.RightBarButtonItem = deleteAll;

            View.BackgroundColor = Configuration.BackgroundColor;

            Configuration.CropImage = true;

            var imageView = new UIImageView {
                BackgroundColor = UIColor.Black
            };
            var urlLabel     = new UILabel();
            var pickerButton = new UIButton(UIButtonType.System)
            {
                BackgroundColor = Configuration.TintColor,
                TintColor       = UIColor.Black
            };

            pickerButton.SetTitle("Pick Image", UIControlState.Normal);
            var albumButton = new UIButton(UIButtonType.System)
            {
                BackgroundColor = Configuration.TintColor,
                TintColor       = UIColor.Black
            };

            albumButton.SetTitle("Show Album", UIControlState.Normal);

            var chafu = new ChafuViewController {
                HasVideo = true
            };

            chafu.ImageSelected += (sender, image) =>
            {
                DispatchQueue.MainQueue.DispatchAsync(() =>
                {
                    imageView.Image = image;
                });

                CopyImageToLocalFolder(image);
            };
            chafu.VideoSelected += (sender, videoUrl) =>
            {
                urlLabel.Text = videoUrl.AbsoluteString;
                CopyVideoToLocalFolder(videoUrl);
            };
            chafu.Closed += (sender, e) =>
            {
                /* do stuff on closed */
            };

            pickerButton.TouchUpInside += (sender, args) =>
            {
                NavigationController.PresentModalViewController(chafu, true);
            };

            var albumViewController = new AlbumViewController
            {
                LazyDataSource = (view, size, mediaTypes) =>
                                 new LocalFilesDataSource(view, size, mediaTypes)
                {
                    ImagesPath = TempPath()
                },
                LazyDelegate     = (view, source) => new LocalFilesDelegate(view, (LocalFilesDataSource)source),
                ShowExtraButton  = true,
                ShowDoneButton   = false,
                ShowDeleteButton = true
            };

            albumViewController.Extra += (sender, args) =>
            {
                albumViewController.Dismiss();
                NavigationController.PresentModalViewController(chafu, true);
            };

            albumViewController.ImageSelected += (sender, image) =>
            {
                imageView.Image = image;
            };

            albumButton.TouchUpInside += (sender, args) =>
            {
                // Test InitialSelectedImage by selecting random path
                albumViewController.InitialSelectedImagePath = GetRandomPath();

                NavigationController.PresentModalViewController(albumViewController, true);
            };

            deleteAll.Clicked += (sender, args) =>
            {
                DeleteAllStuff();
                ((LocalFilesDataSource)albumViewController.AlbumDataSource)?.UpdateImageSource(TempPath());
            };

            Add(imageView);
            Add(urlLabel);
            Add(pickerButton);
            Add(albumButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            EdgesForExtendedLayout = UIRectEdge.None;

            View.AddConstraints(
                imageView.Width().EqualTo().HeightOf(imageView),
                imageView.AtTopOf(View, 5),
                imageView.AtLeftOf(View, 5),
                imageView.AtRightOf(View, 5),
                imageView.Above(urlLabel, 10),

                urlLabel.AtLeftOf(View, 5),
                urlLabel.AtRightOf(View, 5),
                urlLabel.Above(pickerButton, 10),

                pickerButton.AtLeftOf(View, 50),
                pickerButton.AtRightOf(View, 50),
                pickerButton.Height().EqualTo(50),
                pickerButton.Above(albumButton, 20),

                albumButton.AtLeftOf(View, 50),
                albumButton.AtRightOf(View, 50),
                albumButton.Height().EqualTo(50),
                albumButton.AtBottomOf(View, 10f)
                );
        }
            public override void UpdateConstraints()
            {
                if (trackedConstraints.Count > 0)
                {
                    RemoveConstraints(trackedConstraints.ToArray());
                    trackedConstraints.Clear();
                }

                switch (viewLayout)
                {
                case LayoutVariant.StartOnly:
                    arrowImageView.RemoveFromSuperview();
                    stopDateTimeButton.RemoveFromSuperview();

                    trackedConstraints.AddRange(new [] {
                        startDateTimeButton.WithSameCenterX(this),
                        startDateTimeButton.WithSameCenterY(this),
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f)
                    }.ToLayoutConstraints());
                    break;

                case LayoutVariant.BothCenterStart:
                    AddSubview(arrowImageView);
                    AddSubview(stopDateTimeButton);

                    trackedConstraints.AddRange(new [] {
                        startDateTimeButton.WithSameCenterX(this),
                        startDateTimeButton.WithSameCenterY(this),
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f),

                        arrowImageView.WithSameCenterY(startDateTimeButton),
                        arrowImageView.ToRightOf(startDateTimeButton, 10f),
                        arrowImageView.ToLeftOf(stopDateTimeButton, 10f),

                        stopDateTimeButton.AtTopOf(this, 10f),
                        stopDateTimeButton.AtBottomOf(this, 10f)
                    }.ToLayoutConstraints());
                    break;

                default:
                    AddSubview(arrowImageView);
                    AddSubview(stopDateTimeButton);

                    trackedConstraints.AddRange(new [] {
                        startDateTimeButton.AtTopOf(this, 10f),
                        startDateTimeButton.AtBottomOf(this, 10f),

                        arrowImageView.WithSameCenterX(this),
                        arrowImageView.WithSameCenterY(this),
                        arrowImageView.ToRightOf(startDateTimeButton, 10f),
                        arrowImageView.ToLeftOf(stopDateTimeButton, 10f),

                        stopDateTimeButton.AtTopOf(this, 10f),
                        stopDateTimeButton.AtBottomOf(this, 10f)
                    }.ToLayoutConstraints());
                    break;
                }

                AddConstraints(trackedConstraints.ToArray());

                base.UpdateConstraints();
            }
Ejemplo n.º 16
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)
                );
        }
Ejemplo n.º 17
0
        private void SetupConstraints()
        {
            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _imageBackgroundTopSpacingConstraint =
                _imageBackground.Below(_infoBackGround, 5).ToLayoutConstraints().First();
            _imageBackgroundHeightConstraint = _imageBackground.Height().EqualTo(134).ToLayoutConstraints().First();

            _attendingHeight = _ruler.Below(_header, 125).ToLayoutConstraints().First();

            ContentView.AddConstraint(_imageBackgroundHeightConstraint);
            ContentView.AddConstraint(_imageBackgroundTopSpacingConstraint);
            ContentView.AddConstraint(_attendingHeight);

            ContentView.AddConstraints(
                _header.AtTopOf(ContentView),
                _header.AtLeftOf(ContentView),
                _header.AtRightOf(ContentView),
                _header.Height().EqualTo(345),

                _dateBackPanel.AtTopOf(ContentView, 20),
                _dateBackPanel.AtRightOf(ContentView, 20),
                _dateBackPanel.Width().EqualTo(90),
                _dateBackPanel.Height().EqualTo(25),

                _date.WithSameCenterY(_dateBackPanel),
                _date.WithSameCenterX(_dateBackPanel),

                _infoContainerPlaceHolder.Below(_dateBackPanel),
                _infoContainerPlaceHolder.Above(_attendButton),
                _infoContainerPlaceHolder.AtLeftOf(_header),
                _infoContainerPlaceHolder.AtRightOf(_header),

                _infoContainer.AtLeftOf(_header),
                _infoContainer.AtRightOf(_header),
                _infoContainer.WithSameCenterY(_infoContainerPlaceHolder),

                _title.AtTopOf(_infoContainer),
                _title.AtRightOf(_infoContainer, 20),
                _title.AtLeftOf(_infoContainer, 20),

                _time.Below(_title, 5),
                _time.AtLeftOf(_infoContainer, 20),
                _time.AtRightOf(_infoContainer, 20),

                _location.Below(_time, 5),
                _location.AtLeftOf(_infoContainer, 20),
                _location.AtRightOf(_infoContainer, 20),
                _location.Below(_infoContainer),

                _attendButton.Height().EqualTo(45),
                _attendButton.AtBottomOf(_header, 39),
                _attendButton.AtLeftOf(_header, 39),
                _attendButton.AtRightOf(_header, 39),

                _infoBackGround.Below(_header),
                _infoBackGround.AtLeftOf(ContentView),
                _infoBackGround.AtRightOf(ContentView),

                _attendingLabel.Below(_header, 30),
                _attendingLabel.AtLeftOf(ContentView, 14),
                _attendingLabel.AtRightOf(ContentView, 14),

                _attendingCollection.Below(_attendingLabel, 13),
                _attendingCollection.AtLeftOf(ContentView, 14),
                _attendingCollection.AtRightOf(ContentView, 14),
                _attendingCollection.Height().EqualTo(31),

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

                _eventInfoHeader.Below(_ruler, 13),
                _eventInfoHeader.AtLeftOf(ContentView, 14),
                _eventInfoHeader.Height().EqualTo(20),

                _eventDateLabel.Below(_eventInfoHeader, 14),
                _eventDateLabel.AtLeftOf(ContentView, 14),
                _eventDateLabel.Height().EqualTo(20),

                _eventDate.AtLeftOf(ContentView, 100),
                _eventDate.WithSameCenterY(_eventDateLabel),

                _eventTimeLabel.Below(_eventDateLabel, 7),
                _eventTimeLabel.AtLeftOf(ContentView, 14),

                _eventTime.WithSameCenterY(_eventTimeLabel),
                _eventTime.WithSameLeft(_eventDate),
                _eventTime.AtRightOf(ContentView, 14),

                _eventLocationLabel.Below(_eventTimeLabel, 7),
                _eventLocationLabel.AtLeftOf(ContentView, 14),

                EventLocation.WithSameTop(_eventLocationLabel),
                EventLocation.WithSameLeft(_eventDate),
                EventLocation.AtRightOf(ContentView, 14),

                _infoBottomBorder.Below(EventLocation, 30),
                _infoBottomBorder.Height().EqualTo(1),
                _infoBottomBorder.AtLeftOf(ContentView),
                _infoBottomBorder.AtRightOf(ContentView),
                _infoBottomBorder.AtBottomOf(_infoBackGround),

                _imageBackground.AtLeftOf(ContentView),
                _imageBackground.AtRightOf(ContentView),

                _imageTopBorder.AtTopOf(_imageBackground),
                _imageTopBorder.AtLeftOf(ContentView),
                _imageTopBorder.AtRightOf(ContentView),
                _imageTopBorder.Height().EqualTo(1),

                _imageBottomBorder.AtBottomOf(_imageBackground),
                _imageBottomBorder.AtLeftOf(ContentView),
                _imageBottomBorder.AtRightOf(ContentView),
                _imageBottomBorder.Height().EqualTo(1),

                _imageCollection.AtTopOf(_imageBackground),
                _imageCollection.AtLeftOf(_imageBackground, 14),
                _imageCollection.AtRightOf(_imageBackground, 14),
                _imageCollection.AtBottomOf(_imageBackground),

                _aboutBackground.Below(_imageBackground, 5),
                _aboutBackground.AtLeftOf(ContentView),
                _aboutBackground.AtRightOf(ContentView),

                _aboutHeaderLabel.AtTopOf(_aboutBackground, 14),
                _aboutHeaderLabel.AtLeftOf(_aboutBackground, 14),
                _aboutHeaderLabel.AtRightOf(_aboutBackground, 14),
                _aboutHeaderLabel.Height().EqualTo(20),

                AboutText.Below(_aboutHeaderLabel, 13),
                AboutText.AtLeftOf(_aboutBackground, 12),
                AboutText.AtRightOf(_aboutBackground, 12),

                _aboutTopBorder.AtTopOf(_aboutBackground),
                _aboutTopBorder.Height().EqualTo(1),
                _aboutTopBorder.AtLeftOf(_aboutBackground),
                _aboutTopBorder.AtRightOf(_aboutBackground),

                _aboutRuler.Below(AboutText, 10),
                _aboutRuler.AtLeftOf(_aboutBackground),
                _aboutRuler.AtRightOf(_aboutBackground),
                _aboutRuler.Height().EqualTo(1),
                _aboutRuler.AtBottomOf(_aboutBackground)

                //_commentButton.Below(_aboutRuler),
                //_commentButton.AtLeftOf(ContentView, 14),
                //_commentButton.Height().EqualTo(50),
                );
        }
Ejemplo n.º 18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ClearNavigationStack();

            _txtUsername = new UITextField
            {
                Placeholder            = "Username",
                BorderStyle            = UITextBorderStyle.RoundedRect,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No
            };
            _txtPassword = new UITextField
            {
                Placeholder            = "Password",
                BorderStyle            = UITextBorderStyle.RoundedRect,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                SecureTextEntry        = true
            };
            _btnLogin = new UIButton();
            _btnLogin.SetTitle("Login", UIControlState.Normal);
            _btnLogin.SetTitleColor(UIColor.DarkGray, UIControlState.Normal);

            _btnRegister = new UIButton();
            _btnRegister.SetTitle("Register", UIControlState.Normal);
            _btnRegister.SetTitleColor(UIColor.DarkGray, UIControlState.Normal);

            _btnModal = new UIButton();
            _btnModal.SetTitle("Open modal view", UIControlState.Normal);
            _btnModal.SetTitleColor(UIColor.DarkGray, UIControlState.Normal);
            _viewContainer = new UIView();

            View.AddSubview(_viewContainer);
            _viewContainer.AddSubviews(_txtUsername, _txtPassword, _btnLogin, _btnRegister, _btnModal);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _viewContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                _viewContainer.WithSameCenterY(View),
                _viewContainer.WithSameLeft(View),
                _viewContainer.WithSameRight(View)
                );
            _viewContainer.AddConstraints(
                _txtUsername.AtTopOf(_viewContainer),
                _txtUsername.WithSameLeft(_viewContainer),
                _txtUsername.WithSameRight(_viewContainer),

                _txtPassword.Below(_txtUsername, 8f),
                _txtPassword.WithSameLeft(_viewContainer),
                _txtPassword.WithSameRight(_viewContainer),

                _btnLogin.Below(_txtPassword, 8f),
                _btnLogin.WithSameLeft(_viewContainer),
                _btnLogin.WithSameRight(_viewContainer),

                _btnRegister.Below(_btnLogin, 8f),
                _btnRegister.WithSameLeft(_viewContainer),
                _btnRegister.WithSameRight(_viewContainer),

                _btnModal.Below(_btnRegister, 16f),
                _btnModal.WithSameLeft(_viewContainer),
                _btnModal.WithSameRight(_viewContainer),
                _btnModal.AtBottomOf(_viewContainer)
                );

            var set = this.CreateBindingSet <LoginView, LoginViewModel>();

            set.Bind(_txtUsername).To(vm => vm.Username);
            set.Bind(_txtPassword).To(vm => vm.Password);
            set.Bind(_btnLogin).To(vm => vm.LoginCommand);
            set.Bind(_btnRegister).To(vm => vm.RegisterCommand);
            set.Bind(_btnModal).To(vm => vm.OpenModalCommand);
            set.Apply();
        }
Ejemplo n.º 19
0
        /// <inheritdoc />
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _menuView = new MenuView
            {
                BackgroundColor = Configuration.BackgroundColor,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Opaque             = false,
                AccessibilityLabel = "MenuView"
            };
            _menuView.AddBottomBorder(UIColor.Black, 1);
            View.AddSubviews(_menuView);

            _libraryButton = new UIButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode       = UILineBreakMode.MiddleTruncation,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
                VerticalAlignment   = UIControlContentVerticalAlignment.Center,
                ContentMode         = UIViewContentMode.ScaleToFill,
                ContentEdgeInsets   = new UIEdgeInsets(2, 2, 2, 2),
                AccessibilityLabel  = "LibraryButton"
            };

            _videoButton = new UIButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode       = UILineBreakMode.MiddleTruncation,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
                VerticalAlignment   = UIControlContentVerticalAlignment.Center,
                ContentMode         = UIViewContentMode.ScaleToFill,
                ContentEdgeInsets   = new UIEdgeInsets(2, 2, 2, 2),
                AccessibilityLabel  = "VideoButton"
            };

            _cameraButton = new UIButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode       = UILineBreakMode.MiddleTruncation,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
                VerticalAlignment   = UIControlContentVerticalAlignment.Center,
                ContentMode         = UIViewContentMode.ScaleToFill,
                ContentEdgeInsets   = new UIEdgeInsets(2, 2, 2, 2),
                AccessibilityLabel  = "PhotoButton"
            };

            View.AddSubviews(_libraryButton, _cameraButton);

            _cameraView = new CameraView {
                BackgroundColor = Configuration.BackgroundColor,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            if (CellSize == CGSize.Empty)
            {
                CellSize = CalculateCellSize();
            }

            AlbumView = new AlbumView(CellSize)
            {
                BackgroundColor = Configuration.BackgroundColor,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            View.AddSubviews(_cameraView, AlbumView);

            View.AddConstraints(
                _menuView.Height().EqualTo(50),
                _menuView.AtTopOf(View),
                _menuView.AtLeftOf(View),
                _menuView.AtRightOf(View),

                AlbumView.AtLeftOf(View),
                AlbumView.AtRightOf(View),
                AlbumView.Below(_menuView),

                _cameraView.WithSameLeft(AlbumView),
                _cameraView.WithSameRight(AlbumView),
                _cameraView.Below(_menuView),

                _libraryButton.AtLeftOf(View),
                _libraryButton.AtBottomOf(View),

                _cameraButton.ToRightOf(_libraryButton),
                _cameraButton.AtBottomOf(View),

                _libraryButton.Height().EqualTo(45),
                _cameraButton.Height().EqualTo(45),

                _cameraButton.WithSameWidth(_libraryButton),

                AlbumView.Above(_libraryButton),
                _cameraView.Above(_libraryButton)
                );

            View.BackgroundColor = Configuration.BackgroundColor;

            var albumImage  = Configuration.AlbumImage ?? UIImage.FromBundle("ic_insert_photo");
            var cameraImage = Configuration.CameraImage ?? UIImage.FromBundle("ic_photo_camera");
            var videoImage  = Configuration.VideoImage ?? UIImage.FromBundle("ic_videocam");

            if (Configuration.TintIcons)
            {
                albumImage  = albumImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                cameraImage = cameraImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                videoImage  = videoImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
            }

            _libraryButton.SetImage(albumImage, UIControlState.Normal);
            _libraryButton.SetImage(albumImage, UIControlState.Highlighted);
            _libraryButton.SetImage(albumImage, UIControlState.Selected);

            _cameraButton.SetImage(cameraImage, UIControlState.Normal);
            _cameraButton.SetImage(cameraImage, UIControlState.Highlighted);
            _cameraButton.SetImage(cameraImage, UIControlState.Selected);

            _videoButton.SetImage(videoImage, UIControlState.Normal);
            _videoButton.SetImage(videoImage, UIControlState.Highlighted);
            _videoButton.SetImage(videoImage, UIControlState.Selected);

            if (Configuration.TintIcons)
            {
                _libraryButton.TintColor = Configuration.TintColor;
                _libraryButton.AdjustsImageWhenHighlighted = false;
                _cameraButton.TintColor = Configuration.TintColor;
                _cameraButton.AdjustsImageWhenHighlighted = false;
                _videoButton.TintColor = Configuration.TintColor;
                _videoButton.AdjustsImageWhenHighlighted = false;
            }

            _cameraButton.ClipsToBounds  = true;
            _libraryButton.ClipsToBounds = true;
            _videoButton.ClipsToBounds   = true;

            if (HasVideo)
            {
                _videoView = new VideoView {
                    BackgroundColor = Configuration.BackgroundColor,
                    TranslatesAutoresizingMaskIntoConstraints = false
                };

                View.AddSubviews(_videoView, _videoButton);

                View.AddConstraints(
                    _videoView.WithSameLeft(AlbumView),
                    _videoView.WithSameRight(AlbumView),
                    _videoView.Below(_menuView),

                    _videoButton.ToRightOf(_cameraButton),
                    _videoButton.AtBottomOf(View),
                    _videoButton.AtRightOf(View),
                    _videoButton.WithSameWidth(_cameraButton),
                    _videoButton.Height().EqualTo(45),

                    _videoView.Above(_libraryButton)
                    );
            }
            else
            {
                View.AddConstraints(
                    _cameraButton.AtRightOf(View)
                    );
            }
        }