示例#1
0
        public void prepareControlView()
        {
            controlView = new ControlView(new CGRect(0, View.Bounds.Height - 56, View.Bounds.Width, 56));
            View.Layout(controlView).Bottom(0).Left(0).Right(0);

            var undoButton = new FlatButton();

            undoButton.PulseColor = MaterialColor.White;
            undoButton.SetTitle("UNDO", UIControlState.Normal);
            undoButton.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var undoButton2 = new FlatButton();

            undoButton2.PulseColor = MaterialColor.White;
            undoButton2.SetTitle("UNDO", UIControlState.Normal);
            undoButton2.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var label = new UILabel();

            label.Text      = "Archived";
            label.TextColor = MaterialColor.White;

            controlView.BackgroundColor = MaterialColor.Grey.Darken4;
            controlView.ContentView.AddSubview(label);
            controlView.RightControls = new UIControl[] {
                undoButton, undoButton2
            };
            controlView.ContentInsetPreset = MaterialEdgeInset.WideRectangle3;

            //View.AddSubview(controlView);
            controlView.ContentView.Grid().Views = new List <UIView>()
            {
                label
            };
        }
示例#2
0
        private static UIView CreateAccessoryViewWithCloseButton(Action <object, EventArgs> onClose)
        {
            var accessoryView = new UIView {
                Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 44), BackgroundColor = UIColor.FromRGB(251, 253, 253)
            };

            var closeButton     = new FlatButton();
            var closeButtonText = Localize.GetValue("OkButtonText");

            closeButton.SetTitle(closeButtonText, UIControlState.Normal);
            closeButton.TranslatesAutoresizingMaskIntoConstraints = false;
            FlatButtonStyle.Green.ApplyTo(closeButton);
            accessoryView.AddSubview(closeButton);

            var widthOfText = closeButton.GetSizeThatFits(closeButtonText, closeButton.Font).Width;
            var totalTextPaddingInButton = 30f;

            closeButton.AddConstraints(new [] {
                NSLayoutConstraint.Create(closeButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 36f),
                NSLayoutConstraint.Create(closeButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, widthOfText + totalTextPaddingInButton)
            });

            accessoryView.AddConstraints(new [] {
                NSLayoutConstraint.Create(closeButton, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, accessoryView, NSLayoutAttribute.Trailing, 1, -8f),
                NSLayoutConstraint.Create(closeButton, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, accessoryView, NSLayoutAttribute.CenterY, 1, 0),
            });

            closeButton.TouchUpInside += (sender, e) => onClose(sender, e);

            return(accessoryView);
        }
示例#3
0
        private UIButton GetPositiveButton(string title, Action action)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            var imageColor = UIColor.White.ColorWithAlpha(0.35f);

            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Normal);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Selected);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Highlighted);

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                ClickedEvent();
            };

            return(button);
        }
示例#4
0
        private UIButton GetNormalButton(string title, Action action, bool isCancellation = false)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = _dialogView.BackgroundColor,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                if (isCancellation)
                {
                    DismissEvent();
                }
                else
                {
                    ClickedEvent();
                }
            };

            return(button);
        }
        public void prepareFlatButtonExample()
        {
            nfloat w      = 200;
            var    button = new FlatButton(new CGRect((View.Bounds.Width - w) / 2, 100, w, 48));

            button.SetTitle("Button Raised", UIControlState.Normal);
            button.SetTitleColor(MaterialColor.Blue.Base, UIControlState.Normal);
            button.PulseColor      = MaterialColor.Blue.Base;
            button.TitleLabel.Font = MaterialFont.SystemFontWithSize(24f);
            View.AddSubview(button);
        }
示例#6
0
        private void Initialize()
        {
            BackgroundColor = UIColor.White;

            DatePicker = new UIDatePicker();

            CancelButton = new FlatButton();
            OrderButton  = new FlatButton();
            CancelButton.SetTitle(Localize.GetValue("Cancel"), UIControlState.Normal);
            OrderButton.SetTitle(Localize.GetValue("Order"), UIControlState.Normal);
            FlatButtonStyle.Red.ApplyTo(CancelButton);
            FlatButtonStyle.Green.ApplyTo(OrderButton);
        }
示例#7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            // Setup buttons
            var Button1 = new FlatButton()
            {
                Depth     = 3f,
                FaceColor = ColorConstant.BUTTON1FACE,
                Frame     = new RectangleF(60, 80, 200, 60),
                Margin    = 4f,
                Radius    = 8f,
                SideColor = ColorConstant.BUTTON1SIDE
            };

            Button1.SetTitle("Button", UIControlState.Normal);
            Button1.SetTitleColor(UIColor.White, UIControlState.Normal);

            var Button2 = new FlatButton()
            {
                Depth     = 6f,
                FaceColor = ColorConstant.BUTTON2FACE,
                Frame     = new RectangleF(60, 180, 200, 60),
                Margin    = 7f,
                Radius    = 6f,
                SideColor = ColorConstant.BUTTON2SIDE
            };

            Button2.SetTitle("Button", UIControlState.Normal);
            Button2.SetTitleColor(UIColor.White, UIControlState.Normal);

            var Button3 = new FlatButton()
            {
                Enabled   = false,
                Depth     = 3f,
                FaceColor = ColorConstant.BUTTON3FACE,
                Frame     = new RectangleF(60, 280, 200, 60),
                Margin    = 4f,
                Radius    = 8f,
                SideColor = ColorConstant.BUTTON3SIDE
            };

            Button3.SetTitle("Disabled", UIControlState.Normal);
            Button3.SetTitleColor(UIColor.White, UIControlState.Normal);

            View.Add(Button1);
            View.Add(Button2);
            View.Add(Button3);
        }
		void prepareCardView()
		{
			var cardView = new Card();
			cardView.BackgroundColor = Color.Grey.Lighten5;
			cardView.SetCornerRadiusPreset(CornerRadiusPreset.Radius1);
			cardView.Divider = false;
			cardView.ContentViewEdgeInsets = EdgeInsetsPreset.None;
			cardView.SetLayoutEdgeInsetsPreset(EdgeInsetsPreset.Square2;
			cardView.righ = EdgeInsetsPreset.Square2;
			cardView.ContentViewInsetPreset = EdgeInsetsPreset.None;

			var titleLabel = new UILabel();
			titleLabel.Font = RobotoFont.MediumWithSize(20);
			titleLabel.Text = "Messages";
			titleLabel.TextAlignment = UITextAlignment.Center;
			titleLabel.TextColor = MaterialColor.BlueGrey.Darken4;

			var v = new UIView();
			v.BackgroundColor = MaterialColor.Blue.Accent1;

			var closeButton = new FlatButton();
			closeButton.SetTitle("Close", UIControlState.Normal);
			closeButton.SetTitleColor(MaterialColor.Blue.Accent3, UIControlState.Normal);

			var image = MaterialIcon.CM.Settings;
			var settingButton = new IconButton();
			settingButton.TintColor = MaterialColor.Blue.Accent3;
			settingButton.SetImage(image, UIControlState.Normal);
			settingButton.SetImage(image, UIControlState.Highlighted);

			cardView.TitleLabel = titleLabel;
			cardView.ContentView = tableView;
			cardView.LeftButtons = new UIButton[] { closeButton};
			cardView.RightButtons = new UIButton[] { settingButton };

			View.Layout(cardView).Edges(left: 10f, right: 10f, top: 100f, bottom: 100f);
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor   = UIColor.White;
            View.AutosizesSubviews = true;

            // Perform any additional setup after loading the view, typically from a nib.
            var button = new FlatButton(new RectangleF(20, 20, 280, 43));

            button.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            button.SetTitle("SHOW ALERT");
            View.AddSubview(button);

            var progressView = new FlatProgressView(new Rectangle(20, 84, 280, 20));

            progressView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            progressView.Progress         = .66f;
            View.AddSubview(progressView);

            var slider = new FlatSlider(new Rectangle(20, 114, 280, 20));

            slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            View.AddSubview(slider);
        }
示例#10
0
        void Initialize()
        {
            BackgroundColor = UIColor.Clear;
            Hidden          = true;

            AddressEditText = new FlatTextField
            {
                ShowShadow             = true,
                VerticalAlignment      = UIControlContentVerticalAlignment.Center,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No
            };

            AddressEditText.Placeholder        = Localize.GetValue("AddressSearch");
            AddressEditText.AccessibilityLabel = AddressEditText.Placeholder;

            AddressEditText.TranslatesAutoresizingMaskIntoConstraints = false;

            CancelButton = new FlatButton();
            CancelButton.TranslatesAutoresizingMaskIntoConstraints = false;
            CancelButton.SetTitle(Localize.GetValue("Cancel"), UIControlState.Normal);
            FlatButtonStyle.Red.ApplyTo(CancelButton);

            TableView = new UITableView(new CGRect(), UITableViewStyle.Plain)
            {
                BackgroundView = new  UIView {
                    BackgroundColor = UIColor.FromRGB(242, 242, 242)
                },
                BackgroundColor     = UIColor.FromRGB(242, 242, 242),
                SeparatorColor      = UIColor.Clear,
                SeparatorStyle      = UITableViewCellSeparatorStyle.None,
                RowHeight           = 44,
                SectionHeaderHeight = 15
            };
            TableView.AddGestureRecognizer(GetHideKeyboardOnTouchGesture());

            var source = new GroupedAddressTableViewSource(
                TableView,
                UITableViewCellStyle.Subtitle,
                new NSString(CellId),
                CellBindingText,
                UITableViewCellAccessory.None
                );

            source.CellCreator = CellCreator;
            TableView.Source   = source;

            AddSubviews(AddressEditText, CancelButton, TableView);

            AddressEditText.OnKeyDown()
            .Throttle(TimeSpan.FromMilliseconds(700))
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(text => ViewModel.TextSearchCommand.ExecuteIfPossible(text));

            AddConstraints(new []
            {
                NSLayoutConstraint.Create(AddressEditText, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 8f),
                NSLayoutConstraint.Create(AddressEditText, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 22f),
                NSLayoutConstraint.Create(AddressEditText, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, 44f),

                NSLayoutConstraint.Create(AddressEditText, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, CancelButton, NSLayoutAttribute.Leading, 1f, -9f),

                NSLayoutConstraint.Create(CancelButton, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, this, NSLayoutAttribute.Trailing, 1f, -8f),
                NSLayoutConstraint.Create(CancelButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 22f),
                NSLayoutConstraint.Create(CancelButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, 44f),
                NSLayoutConstraint.Create(CancelButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, 81f),
            });

            var set = this.CreateBindingSet <AddressPickerView, AddressPickerViewModel> ();

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.AllAddresses);

            set.Bind(source)
            .For(v => v.SelectedCommand)
            .To(vm => vm.AddressSelected);

            set.Bind(AddressEditText)
            .For(v => v.Text)
            .To(vm => vm.StartingText)
            .OneWay();

            set.Bind(CancelButton)
            .For("TouchUpInside")
            .To(vm => vm.Cancel);

            set.Bind(source)
            .For(v => v.AddressLocationTypePicker)
            .To(vm => vm.PickerFilter);

            set.Apply();

            SetNeedsLayout();
        }
示例#11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (ViewModel.CanUserLeaveScreen())
            {
                NavigationItem.HidesBackButton = false;
            }
            else
            {
                NavigationItem.HidesBackButton = true;
            }

            View.BackgroundColor                 = UIColor.FromRGB(242, 242, 242);
            ratingTableView.BackgroundColor      = UIColor.Clear;
            ratingTableView.SeparatorColor       = UIColor.Clear;
            ratingTableView.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            ratingTableView.DelaysContentTouches = false;

            var btnSubmit = new FlatButton(new CGRect(8f, BottomPadding, 304f, 41f));

            FlatButtonStyle.Green.ApplyTo(btnSubmit);
            btnSubmit.SetTitle(Localize.GetValue("Submit"), UIControlState.Normal);

            ViewModel.PropertyChanged += async(sender, e) => {
                if (e.PropertyName == "CanRate")
                {
                    ShowDoneButton();
                }
            };

            var source = new MvxActionBasedTableViewSource(
                ratingTableView,
                UITableViewCellStyle.Default,
                BookRatingCell.Identifier,
                BookRatingCell.BindingText,
                UITableViewCellAccessory.None);

            source.CellCreator = (tableView, indexPath, item) =>
            {
                var cell = BookRatingCell.LoadFromNib(tableView);
                cell.RemoveDelay();
                return(cell);
            };
            ratingTableView.Source = source;

            var set = this.CreateBindingSet <BookRatingView, BookRatingViewModel>();

            set.Bind(btnSubmit)
            .For("TouchUpInside")
            .To(vm => vm.RateOrder);
            set.Bind(btnSubmit)
            .For(v => v.Hidden)
            .To(vm => vm.CanRate)
            .WithConversion("BoolInverter");

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.RatingList);

            set.Apply();
        }
示例#12
0
        protected override void SetupUserInterface()
        {
            View.BackgroundColor   = MobileCore.Values.Colors.LightGray.ToNative();
            EdgesForExtendedLayout = UIRectEdge.None;

            logo = new UIImageView(UIImage.FromFile("logo.png"));
            Add(logo);

            username = new JVFloatLabeledTextField(RectangleF.Empty)
            {
                Placeholder = MobileCore.Values.Strings.Login_Username,
                FloatingLabelActiveTextColor = MobileCore.Values.Colors.Orange.ToNative(),
                BorderStyle  = UITextBorderStyle.RoundedRect,
                KeyboardType = UIKeyboardType.EmailAddress
            };
            username.RoundedViewBackground(MobileCore.Values.Colors.White.ToNative());
            Add(username);

            password = new JVFloatLabeledTextField(RectangleF.Empty)
            {
                SecureTextEntry = true,
                Placeholder     = MobileCore.Values.Strings.Login_Password,
                FloatingLabelActiveTextColor = MobileCore.Values.Colors.Orange.ToNative(),
                BorderStyle = UITextBorderStyle.RoundedRect,
            };
            password.RoundedViewBackground(MobileCore.Values.Colors.White.ToNative());
            Add(password);

            login = new FlatButton(RectangleF.Empty);
            login.SetTitle(MobileCore.Values.Strings.Login_Login, UIControlState.Normal);
            login.TintColor = MobileCore.Values.Colors.White.ToNative();
            login.SetBackgroundColor(MobileCore.Values.Colors.DarkGray.ToNative(), UIControlState.Normal);
            Add(login);

            createNewAccount = new UIButton(UIButtonType.System);
            createNewAccount.SetTitle(MobileCore.Values.Strings.Login_CreateNewAccount, UIControlState.Normal);
            Add(createNewAccount);

            forgotPassword = new UIButton(UIButtonType.System);
            forgotPassword.SetTitle(MobileCore.Values.Strings.Login_ForgotPassword, UIControlState.Normal);
            Add(forgotPassword);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                logo.AtTopOf(View, Constants.Layout.VerticalPadding * 4f),
                logo.WithSameCenterX(View),

                username.Below(logo, Constants.Layout.VerticalPadding),
                username.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                username.AtRightOf(View, Constants.Layout.HorizontalPadding),
                username.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                password.Below(username, Constants.Layout.VerticalPadding),
                password.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                password.AtRightOf(View, Constants.Layout.HorizontalPadding),
                password.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                login.Below(password, Constants.Layout.VerticalPadding),
                login.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                login.AtRightOf(View, Constants.Layout.HorizontalPadding),
                login.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                createNewAccount.Below(login, Constants.Layout.VerticalPadding),
                createNewAccount.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                createNewAccount.AtRightOf(View, Constants.Layout.HorizontalPadding),

                forgotPassword.Below(createNewAccount, Constants.Layout.VerticalPadding),
                forgotPassword.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                forgotPassword.AtRightOf(View, Constants.Layout.HorizontalPadding)
                );
        }