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 (); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var scrollView = new UIScrollView(); var topTextRowView = new UIView(); var centerTextRowView = new UIView(); var bottomTextRowView = new UIView(); var bottomView = new UIView(); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); backHomeView = UIButton.FromType(UIButtonType.Custom); backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); nameOfPageLabel = LabelInformationAboutPage(UIColor.White, "Profile", UIFont.BoldSystemFontOfSize(16f)); informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter Your Personal Information.", UIFont.FromName("Helvetica", 14f)); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size)); profileNavigationBarBackground.Frame = new CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); var labelView = new UIView(); labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel); labelView.AddConstraints( nameOfPageLabel.AtTopOf(labelView, 20), nameOfPageLabel.WithSameCenterX(labelView), nameOfPageLabel.WithSameCenterY(labelView), nameOfPageLabel.WithSameWidth(labelView), nameOfPageLabel.WithRelativeHeight(labelView, 0.3f), informationAboutPageLabel.Below(nameOfPageLabel, 5), informationAboutPageLabel.WithSameWidth(labelView), informationAboutPageLabel.WithSameCenterX(labelView), informationAboutPageLabel.WithRelativeHeight(labelView, 0.3f) ); topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backHomeView.WithSameCenterY(topView), backHomeView.AtLeftOf(topView, 20), backHomeView.WithRelativeWidth(topView, 0.1f), backHomeView.WithRelativeHeight(topView, 0.2f), labelView.WithSameCenterX(topView), labelView.WithSameCenterY(topView), labelView.WithRelativeWidth(topView, 0.8f), labelView.WithRelativeHeight(topView, 0.6f) ); firstNameTextField = TextFieldInitializer("First Name"); lastNameTextField = TextFieldInitializer("Last Name"); emailTextField = TextFieldInitializer("Email"); addressTextField = TextFieldInitializer("Address"); cityTextField = TextFieldInitializer("City"); zipCodeTextField = TextFieldInitializer("Zip Code"); zipCodeTextField.TextFieldWithValidator.TextField.SecureTextEntry = true; stateTextField = TextFieldInitializer("State"); statesPicker = new UIPickerView(); statesPickerViewModel = new MvxPickerViewModel(statesPicker); statesPicker.Model = statesPickerViewModel; statesPicker.ShowSelectionIndicator = true; statesPicker.BackgroundColor = UIColor.White; addLicenseButton = ProfileButtonManager.ButtonInitiaziler("Add License Plate", UIImage.FromFile(@"Images/ProfileView/ic_license.png")); showCreditCardButton = ProfileButtonManager.ButtonInitiaziler("Credit Cards", UIImage.FromFile(@"Images/ProfileView/ic_card.png")); topTextRowView.AddIfNotNull(firstNameTextField, lastNameTextField); topTextRowView.AddConstraints( firstNameTextField.AtTopOf(topTextRowView), firstNameTextField.AtLeftOf(topTextRowView), firstNameTextField.WithRelativeWidth(topTextRowView, 0.475f), firstNameTextField.WithSameHeight(topTextRowView), lastNameTextField.AtTopOf(topTextRowView), lastNameTextField.AtRightOf(topTextRowView), lastNameTextField.WithRelativeWidth(topTextRowView, 0.475f), lastNameTextField.WithSameHeight(topTextRowView) ); centerTextRowView.AddIfNotNull(emailTextField, addressTextField, cityTextField); centerTextRowView.AddConstraints( emailTextField.AtTopOf(centerTextRowView), emailTextField.WithSameCenterX(centerTextRowView), emailTextField.WithSameWidth(centerTextRowView), emailTextField.WithRelativeHeight(centerTextRowView, 0.3f), addressTextField.Below(emailTextField, 10), addressTextField.WithSameCenterX(centerTextRowView), addressTextField.WithSameWidth(centerTextRowView), addressTextField.WithRelativeHeight(centerTextRowView, 0.3f), cityTextField.Below(addressTextField, 10), cityTextField.WithSameCenterX(centerTextRowView), cityTextField.WithSameWidth(centerTextRowView), cityTextField.WithRelativeHeight(centerTextRowView, 0.3f) ); bottomTextRowView.AddIfNotNull(stateTextField, zipCodeTextField); bottomTextRowView.AddConstraints( stateTextField.AtTopOf(bottomTextRowView), stateTextField.AtLeftOf(bottomTextRowView), stateTextField.WithRelativeWidth(bottomTextRowView, 0.475f), stateTextField.WithSameHeight(bottomTextRowView), zipCodeTextField.AtTopOf(bottomTextRowView), zipCodeTextField.AtRightOf(bottomTextRowView), zipCodeTextField.WithRelativeWidth(bottomTextRowView, 0.475f), zipCodeTextField.WithSameHeight(bottomTextRowView) ); bottomView.AddIfNotNull(addLicenseButton, showCreditCardButton); bottomView.AddConstraints( addLicenseButton.AtTopOf(bottomView), addLicenseButton.WithSameCenterX(bottomView), addLicenseButton.WithSameWidth(bottomView), addLicenseButton.WithRelativeHeight(bottomView, 0.4f), showCreditCardButton.Below(addLicenseButton, 10), showCreditCardButton.WithSameCenterX(bottomView), showCreditCardButton.WithSameWidth(bottomView), showCreditCardButton.WithRelativeHeight(bottomView, 0.4f) ); scrollView.AddIfNotNull(topTextRowView, centerTextRowView, bottomTextRowView, bottomView); scrollView.AddConstraints( topTextRowView.AtTopOf(scrollView, 30), topTextRowView.WithSameWidth(scrollView), topTextRowView.WithSameCenterX(scrollView), topTextRowView.WithRelativeHeight(scrollView, 0.12f), centerTextRowView.Below(topTextRowView, 10), centerTextRowView.WithSameWidth(scrollView), centerTextRowView.AtLeftOf(scrollView), centerTextRowView.AtRightOf(scrollView), centerTextRowView.WithRelativeHeight(scrollView, 0.4f), bottomTextRowView.Below(centerTextRowView, 10), bottomTextRowView.WithSameWidth(scrollView), bottomTextRowView.WithSameCenterX(scrollView), bottomTextRowView.WithRelativeHeight(scrollView, 0.12f), bottomView.Below(bottomTextRowView, 10), bottomView.WithSameWidth(scrollView), bottomView.AtLeftOf(scrollView), bottomView.AtRightOf(scrollView), bottomView.AtBottomOf(scrollView, 100), bottomView.WithRelativeHeight(scrollView, 0.27f) ); View.AddIfNotNull(topView, scrollView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), scrollView.Below(topView, 30), scrollView.AtLeftOf(View, 30), scrollView.AtRightOf(View, 30), scrollView.WithRelativeHeight(View, 0.8f) ); EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField, addressTextField.TextFieldWithValidator.TextField, cityTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField, zipCodeTextField.TextFieldWithValidator.TextField); }
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, AutocorrectionType = UITextAutocorrectionType.No }.Apply(Style.Login.EmailField)); inputsContainer.Add(middleBorder = new UIView().Apply(Style.Login.InputsBorder)); inputsContainer.Add(passwordTextField = new PasswordTextField() { 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 ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.FromRGB(204, 242, 255); var border = new CALayer(); nfloat width = 2; border.BorderColor = UIColor.Black.CGColor; border.BorderWidth = width; ViewModel.Show(); _contentConteiner = new UIView(); _scrollView = new UIScrollView(); _scrollView.AddSubview(_contentConteiner); Add(_scrollView); var _BackBarButton = new UIBarButtonItem(); _BackBarButton.Title = "Back"; NavigationItem.LeftBarButtonItem = _BackBarButton; _peopleConroller = new ABPeoplePickerNavigationController(); _peopleConroller.SelectPerson2 += SelectPeople; _peopleConroller.Cancelled += delegate { this.DismissModalViewController(true); }; _labelTaskName = new UILabel(); _contentConteiner.AddSubview(_labelTaskName); _labelError = new UILabel(); _labelError.Font = _labelError.Font.WithSize(10); _labelError.TextColor = UIColor.Red; _contentConteiner.AddSubview(_labelError); _textEdit = new UITextField(); _textEdit.Placeholder = "todo..."; _textEdit.BorderStyle = UITextBorderStyle.RoundedRect; _textEdit.ShouldReturn = (textField) => { textField.ResignFirstResponder(); return(true); }; _contentConteiner.AddSubview(_textEdit); _textContactName = new UITextField(); _textContactName.Placeholder = "add contact..."; _textContactName.BorderStyle = UITextBorderStyle.RoundedRect; _textContactName.ShouldReturn = (textField) => { textField.ResignFirstResponder(); return(true); }; _contentConteiner.AddSubview(_textContactName); _textContactPhone = new UITextField(); _textContactPhone.Placeholder = "add Phone..."; _textContactPhone.KeyboardType = UIKeyboardType.NamePhonePad; _textContactPhone.ReturnKeyType = UIReturnKeyType.Done; _textContactPhone.BorderStyle = UITextBorderStyle.RoundedRect; _textContactPhone.ShouldReturn = (textField) => { textField.ResignFirstResponder(); return(true); }; _contentConteiner.AddSubview(_textContactPhone); _buttonSelectContact = new UIButton(); _buttonSelectContact.BackgroundColor = UIColor.Blue; _buttonSelectContact.SetTitle("Add", UIControlState.Normal); _buttonSelectContact.Layer.CornerRadius = 5; _buttonSelectContact.Layer.BorderWidth = 1; _buttonSelectContact.TouchUpInside += delegate { PresentModalViewController(_peopleConroller, true); }; _contentConteiner.AddSubview(_buttonSelectContact); _buttonCall = new UIButton(); _buttonCall.BackgroundColor = UIColor.Blue; _buttonCall.SetTitle("Call", UIControlState.Normal); _buttonCall.Layer.CornerRadius = 5; _buttonCall.Layer.BorderWidth = 1; _contentConteiner.AddSubview(_buttonCall); _swith = new UISwitch(); _swith.On = true; _contentConteiner.AddSubview(_swith); _buttonSave = new UIButton(UIButtonType.Custom); _buttonSave.BackgroundColor = UIColor.Blue; _buttonSave.Layer.CornerRadius = 5; _buttonSave.Layer.BorderWidth = 1; _buttonSave.SetTitle("Save", UIControlState.Normal); _contentConteiner.AddSubview(_buttonSave); _buttonDelete = new UIButton(UIButtonType.Custom); _buttonDelete.Layer.CornerRadius = 5; _buttonDelete.Layer.BorderWidth = 1; _buttonDelete.BackgroundColor = UIColor.Blue; _buttonDelete.SetTitle("Delete", UIControlState.Normal); _buttonDelete.TitleColor(UIControlState.Selected); _contentConteiner.AddSubview(_buttonDelete); var set = this.CreateBindingSet <ItemView, ItemViewModel>(); set.Bind(_BackBarButton).To(vm => vm.BackToCommand); set.Bind(_labelTaskName).To(vm => vm.TaskName); set.Bind(_textEdit).To(vm => vm.TaskContent); set.Bind(_swith).To(vm => vm.TaskDone); set.Bind(_buttonSave).To(vm => vm.SaveItem); set.Bind(_buttonDelete).To(vm => vm.DeleteItem); set.Bind(_textContactName).To(vm => vm.ContactName); set.Bind(_textContactPhone).To(vm => vm.ContactPhone); set.Bind(_buttonCall).To(vm => vm.PhoneCallCommand); set.Bind(_labelError).To(vm => vm.Error); set.Apply(); //conastraint _scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _scrollView.AddConstraints(_contentConteiner.FullWidthOf(_scrollView)); _scrollView.AddConstraints(_contentConteiner.FullHeightOf(_scrollView)); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints(_scrollView.FullWidthOf(View)); View.AddConstraints(_scrollView.FullHeightOf(View)); View.AddConstraints( _contentConteiner.WithSameWidth(View), _contentConteiner.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow) ); _contentConteiner.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _contentConteiner.AddConstraints( _labelError.AtTopOf(_contentConteiner), _labelError.WithSameWidth(_contentConteiner), _labelError.WithSameCenterX(_contentConteiner), _labelError.Height().EqualTo(20), _labelTaskName.WithSameCenterX(_contentConteiner), _labelTaskName.Below(_labelError, 25), _labelTaskName.WithSameWidth(_contentConteiner).Minus(130), _labelTaskName.Height().LessThanOrEqualTo(60), _textEdit.WithSameCenterX(_contentConteiner), _textEdit.Below(_labelTaskName, 20), _textEdit.WithSameWidth(_contentConteiner).Minus(25), _textEdit.Height().LessThanOrEqualTo(60), _textContactName.AtLeftOf(_contentConteiner, 25), _textContactName.Below(_textEdit, 20), _textContactName.WithSameWidth(_contentConteiner).Minus(130), _textContactName.Height().EqualTo(40), _textContactPhone.AtLeftOf(_contentConteiner, 25), _textContactPhone.Below(_textContactName, 20), _textContactPhone.WithSameWidth(_contentConteiner).Minus(130), _textContactPhone.Height().EqualTo(40), _buttonSelectContact.ToRightOf(_textContactName, 20), _buttonSelectContact.WithSameCenterY(_textContactName), _buttonSelectContact.Width().EqualTo(80), _swith.AtLeftOf(_contentConteiner, 25), _swith.Below(_textContactPhone, 20), _buttonCall.WithSameCenterY(_textContactPhone), _buttonCall.ToRightOf(_textContactPhone, 20), _buttonCall.Width().EqualTo(80), _buttonSave.AtLeftOf(_contentConteiner, 25), _buttonSave.Below(_swith, 40), _buttonSave.Width().EqualTo(80), _buttonSave.Height().LessThanOrEqualTo(35), _buttonDelete.WithSameCenterX(_buttonCall), _buttonDelete.Below(_swith, 40), _buttonDelete.Width().EqualTo(80), _buttonDelete.Height().LessThanOrEqualTo(35) ); // very important to make scrolling work var bottomViewConstraint = _contentConteiner.Subviews.Last() .AtBottomOf(_contentConteiner).Minus(20); _contentConteiner.AddConstraints(bottomViewConstraint); }
public UIButton ResetButton; //resets the button to the default settings public ButtonMaintenanceScreen() { GeneralMaintenanceScreen.Saved += SaveGeneral; // //create screen Screen = new UIViewController(); Screen.View.BackgroundColor = UIColor.White; //create button Button = new ButtonData(); //create media picker MediaPicker = new UIImagePickerController(); //MediaPicker.VideoExportPreset = AVAssetExportSessionPreset.HighestQuality.ToString(); //System.Diagnostics.Debug.WriteLine(MediaPicker.VideoExportPreset); MediaPicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; MediaPicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); //MediaPicker.ImageExportPreset = UIImagePickerControllerImageUrlExportPreset.Current; MediaPicker.VideoExportPreset = AVAssetExportSessionPreset.Passthrough.GetConstant().ToString(); MediaPicker.FinishedPickingMedia += Handle_FinishedPickingMedia; MediaPicker.Canceled += Handle_Canceled; //1. create views //create reset button ResetButton = new UIButton(); ResetButton.BackgroundColor = UIColor.Green; ResetButton.SetTitle("Reset button\nsettings", UIControlState.Normal); ResetButton.SetTitleColor(UIColor.Black, UIControlState.Normal); //when video button clicked - open the media picker native interface ResetButton.TouchUpInside += ResetButtonData; ResetButton.Layer.BorderColor = ButtonBorderColour.CGColor; ResetButton.Layer.BorderWidth = ButtonBorderWidth; ResetButton.BackgroundColor = ButtonBackgroundColour; ResetButton.LineBreakMode = UILineBreakMode.WordWrap;//allow multiple lines for text inside video button ResetButton.VerticalAlignment = UIControlContentVerticalAlignment.Center; ResetButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; ResetButton.Layer.CornerRadius = ButtonCornerRadius; //create video button VideoButton = new UIButton(); VideoButton.BackgroundColor = UIColor.Green; VideoButton.SetTitle("Choose a video for\nthe button \nto play", UIControlState.Normal); VideoButton.SetTitleColor(UIColor.Black, UIControlState.Normal); //when video button clicked - open the media picker native interface VideoButton.TouchUpInside += (s, e) => { try { //set the media picker to show only videos MediaPicker.MediaTypes = new string[] { UTType.Movie, UTType.Video }; //vids? Screen.PresentViewControllerAsync(MediaPicker, true); } catch (Exception ex) { //if the device doesn't have any videos, pop up an alert box with a message Console.WriteLine(ex.Message); UIAlertView alert = new UIAlertView() { Title = "No Videos Alert", Message = "You don't have any videos to select. To download or record vids..." }; alert.AddButton("OK"); alert.Show(); } }; VideoButton.Layer.BorderColor = ButtonBorderColour.CGColor; VideoButton.Layer.BorderWidth = ButtonBorderWidth; VideoButton.BackgroundColor = ButtonBackgroundColour; VideoButton.LineBreakMode = UILineBreakMode.WordWrap;//allow multiple lines for text inside video button //VideoButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; //center text VideoButton.VerticalAlignment = UIControlContentVerticalAlignment.Center; VideoButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; VideoButton.Layer.CornerRadius = ButtonCornerRadius; //create image button ImageButton = new UIButton(); ImageButton.BackgroundColor = UIColor.Green; ImageButton.SetTitle("Choose an image for\nthe button thumbnail", UIControlState.Normal); ImageButton.SetTitleColor(UIColor.Black, UIControlState.Normal); //when image button clicked - open the media picker native interface ImageButton.TouchUpInside += (s, e) => { try { //set the media picker to show only images MediaPicker.MediaTypes = new string[] { UTType.Image }; Screen.PresentViewControllerAsync(MediaPicker, true); } catch (Exception ex) { //if the device doesn't have any images, pop up an alert box with a message Console.WriteLine(ex.Message); UIAlertView alert = new UIAlertView() { Title = "No Images Alert", Message = "You don't have any images to select. To download or take photos..." }; alert.AddButton("OK"); alert.Show(); } }; ImageButton.Layer.BorderColor = ButtonBorderColour.CGColor; ImageButton.Layer.BorderWidth = ButtonBorderWidth; ImageButton.BackgroundColor = ButtonBackgroundColour; ImageButton.LineBreakMode = UILineBreakMode.WordWrap; //allow multiple lines for text inside video button ImageButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; //center text ImageButton.Layer.CornerRadius = ButtonCornerRadius; //create image box ImageBox = new UIImageView(); ImageBox.Layer.BorderWidth = ButtonBorderWidth; ImageBox.Layer.CornerRadius = ButtonCornerRadius; ImageBox.ClipsToBounds = true; ImageBox.Layer.BorderColor = UIColor.Gray.CGColor; //create video box VideoBox = new UIImageView(); VideoBox.Layer.BorderWidth = ButtonBorderWidth; VideoBox.Layer.CornerRadius = ButtonCornerRadius; VideoBox.ClipsToBounds = true; VideoBox.Layer.BorderColor = UIColor.Gray.CGColor; //create back button BackButton = new UIButton(); BackButton.TouchUpInside += CloseScreen; BackButton.SetTitle("Back", UIControlState.Normal); BackButton.SetTitleColor(UIColor.Black, UIControlState.Normal); Screen.Add(BackButton); //add back button to screen BackButton.Layer.BorderColor = ButtonBorderColour.CGColor; BackButton.Layer.BorderWidth = ButtonBorderWidth; BackButton.BackgroundColor = ButtonBackgroundColour; BackButton.Layer.CornerRadius = ButtonCornerRadius; //create save button SaveButton = new UIButton(); SaveButton.BackgroundColor = UIColor.Red; SaveButton.TouchUpInside += Save; SaveButton.SetTitle("Save", UIControlState.Normal); SaveButton.SetTitleColor(UIColor.Black, UIControlState.Normal); Screen.Add(SaveButton); //add save button to screen SaveButton.Layer.BorderColor = ButtonBorderColour.CGColor; SaveButton.Layer.BorderWidth = ButtonBorderWidth; SaveButton.BackgroundColor = ButtonBackgroundColour; SaveButton.Layer.CornerRadius = ButtonCornerRadius; //create colour box ColourBox = new UIView(); ColourBox.Layer.BorderWidth = ButtonBorderWidth; ColourBox.Layer.CornerRadius = ButtonCornerRadius; ColourBox.Layer.BorderColor = UIColor.Gray.CGColor; //create general button GeneralButton = new UIButton(); GeneralButton.BackgroundColor = UIColor.Green; //open the general settings modal. //pass some app data GeneralButton.TouchUpInside += (o, s) => { //remove? //GeneralMaintenanceScreen.ButtonsPerPage = ButtonsPerPage; //GeneralMaintenanceScreen.NumberOfPages = NumberOfPages; Screen.PresentModalViewController(GeneralMaintenanceScreen.Screen, false); // GeneralMaintenanceScreen.NumberOfPages = this.NumberOfPages; GeneralMaintenanceScreen.ButtonsPerPage = this.ButtonsPerPage; GeneralMaintenanceScreen.BordersThickness = this.ButtonBorderWidth; GeneralMaintenanceScreen.SetDropDowns(); //ImageBox.Layer.BorderColor = UIColor.Clear.CGColor; }; GeneralButton.SetTitle("JustButtons\nSettings", UIControlState.Normal); GeneralButton.SetTitleColor(UIColor.Black, UIControlState.Normal); GeneralButton.Layer.BorderColor = ButtonBorderColour.CGColor; GeneralButton.Layer.BorderWidth = ButtonBorderWidth; GeneralButton.BackgroundColor = ButtonBackgroundColour; GeneralButton.Layer.CornerRadius = ButtonCornerRadius; GeneralButton.LineBreakMode = UILineBreakMode.WordWrap; //allow multiple lines for text inside video button GeneralButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; //center text //color sliders RedSlider = new UISlider(); RedSlider.ValueChanged += UpdateBorderColor; GreenSlider = new UISlider(); GreenSlider.ValueChanged += UpdateBorderColor; BlueSlider = new UISlider(); BlueSlider.ValueChanged += UpdateBorderColor; //create labels VideoButtonTitle = new UILabel(); VideoButtonTitle.Text = "Click below to change the video played:"; VideoButtonTitle.TextColor = UIColor.Black; VideoButtonTitle.TextAlignment = UITextAlignment.Left; VideoButtonTitle.LineBreakMode = UILineBreakMode.WordWrap; VideoButtonTitle.Lines = 2; ImageButtonTitle = new UILabel(); ImageButtonTitle.Text = "Click below to change the button's image:"; ImageButtonTitle.TextColor = UIColor.Black; ImageButtonTitle.TextAlignment = UITextAlignment.Left; ImageButtonTitle.LineBreakMode = UILineBreakMode.WordWrap; ImageButtonTitle.Lines = 2; ColourBoxTitle = new UILabel(); ColourBoxTitle.Text = "Adjust the sliders to change the border colour:"; ColourBoxTitle.TextColor = UIColor.Black; ColourBoxTitle.TextAlignment = UITextAlignment.Left; ColourBoxTitle.LineBreakMode = UILineBreakMode.WordWrap; ColourBoxTitle.Lines = 2; SettingsButtonTitle = new UILabel(); SettingsButtonTitle.Text = "Click below to change the number of pages and buttons, and border thickness:"; SettingsButtonTitle.TextColor = UIColor.Black; SettingsButtonTitle.TextAlignment = UITextAlignment.Left; SettingsButtonTitle.LineBreakMode = UILineBreakMode.WordWrap; SettingsButtonTitle.Lines = 2; //2. add views to parent view Screen.View.Add(VideoButton); Screen.View.Add(ImageButton); Screen.View.Add(ImageBox); Screen.View.Add(VideoBox); Screen.View.Add(BackButton); Screen.View.Add(SaveButton); Screen.Add(ColourBox); Screen.Add(GeneralButton); Screen.Add(RedSlider); Screen.Add(GreenSlider); Screen.Add(BlueSlider); Screen.Add(ImageButtonTitle); Screen.Add(VideoButtonTitle); Screen.Add(ColourBoxTitle); Screen.Add(SettingsButtonTitle); Screen.Add(ResetButton); //3. call method on parent view Screen.View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); //4. add constraints Screen.View.AddConstraints( VideoButton.AtTopOf(Screen.View, UIApplication.SharedApplication.StatusBarFrame.Height + 75), VideoButton.AtLeftOf(Screen.View, 70), VideoButton.WithRelativeWidth(Screen.View, 0.19f), VideoButton.Height().EqualTo(100), ImageButton.Below(VideoButton, 80), ImageButton.WithSameLeft(VideoButton), ImageButton.WithSameWidth(VideoButton), ImageButton.WithSameHeight(VideoButton), VideoBox.WithSameTop(VideoButton), VideoBox.Left().EqualTo().RightOf(VideoButton).Plus(35), VideoBox.WithRelativeWidth(Screen.View, 0.17f), VideoBox.Height().EqualTo(100), ImageBox.WithSameTop(ImageButton), ImageBox.WithSameLeft(VideoBox), ImageBox.WithSameWidth(VideoBox), ImageBox.WithSameHeight(VideoBox), BackButton.WithSameTop(VideoButton), BackButton.AtRightOf(Screen.View, 70), BackButton.WithSameWidth(VideoButton), BackButton.WithSameHeight(VideoButton), SaveButton.WithSameTop(ImageButton), SaveButton.AtRightOf(Screen.View, 70), SaveButton.WithSameWidth(VideoButton), SaveButton.WithSameHeight(VideoButton), ColourBox.Below(ImageButton, 80), ColourBox.WithSameLeft(VideoButton), ColourBox.WithSameWidth(VideoButton), ColourBox.WithSameHeight(VideoBox), GeneralButton.Below(ColourBox, 80), GeneralButton.WithSameLeft(VideoButton), GeneralButton.WithSameWidth(VideoButton), GeneralButton.WithSameHeight(VideoButton), RedSlider.WithSameTop(ColourBox), RedSlider.Left().EqualTo().RightOf(ColourBox).Plus(35), RedSlider.WithRelativeWidth(Screen.View, 0.11f), RedSlider.WithSameHeight(ColourBox), GreenSlider.WithSameTop(ColourBox), GreenSlider.Left().EqualTo().RightOf(RedSlider).Plus(30), GreenSlider.WithSameWidth(RedSlider), GreenSlider.WithSameHeight(ColourBox), BlueSlider.WithSameTop(ColourBox), BlueSlider.Left().EqualTo().RightOf(GreenSlider).Plus(30), BlueSlider.WithSameWidth(RedSlider), BlueSlider.WithSameHeight(ColourBox), VideoButtonTitle.Above(VideoButton, 5), VideoButtonTitle.WithSameLeft(VideoButton), VideoButtonTitle.WithRelativeWidth(VideoButton, 3.1f), VideoButtonTitle.Height().EqualTo(80), ImageButtonTitle.Above(ImageButton, 5), ImageButtonTitle.WithSameLeft(VideoButtonTitle), ImageButtonTitle.WithSameWidth(VideoButtonTitle), ImageButtonTitle.WithSameHeight(VideoButtonTitle), ColourBoxTitle.Above(ColourBox, 5), ColourBoxTitle.WithSameLeft(VideoButtonTitle), ColourBoxTitle.WithSameWidth(VideoButtonTitle), ColourBoxTitle.WithSameHeight(VideoButtonTitle), SettingsButtonTitle.Above(GeneralButton, 5), SettingsButtonTitle.WithSameLeft(VideoButtonTitle), SettingsButtonTitle.WithSameWidth(VideoButtonTitle), SettingsButtonTitle.WithSameHeight(VideoButtonTitle), ResetButton.WithSameTop(GeneralButton), ResetButton.AtRightOf(Screen.View, 70), ResetButton.WithSameWidth(VideoButton), ResetButton.WithSameHeight(VideoButton) ); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.FromRGB(77, 210, 255); //save user _filePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ToDoUser.txt"); File.WriteAllText(_filePath, $"{SignViewModel.UserCurrent.UserLogin}`" + $"{SignViewModel.UserCurrent.UserPassword}"); _contentConteiner = new UIView(); _scrollView = new UIScrollView(); _scrollView.AddSubview(_contentConteiner); Add(_scrollView); _titleView = new UIView(); _titleView.BackgroundColor = UIColor.FromRGB(245, 245, 239); _titleView.Layer.CornerRadius = 10; _contentConteiner.AddSubview(_titleView); _userImage = new UIImageView(); _userImage.BackgroundColor = UIColor.LightGray; _contentConteiner.AddSubview(_userImage); _imageButton = new UIButton(); _imageButton.BackgroundColor = UIColor.Clear; _imageButton.TouchUpInside += ChoosePicture; _contentConteiner.AddSubview(_imageButton); _userLogin = new UILabel(); _contentConteiner.AddSubview(_userLogin); _home = new UIButton(); _home.SetTitle("Task List", UIControlState.Normal); _home.SetTitleColor(UIColor.Black, UIControlState.Normal); _home.TitleLabel.ShadowOffset = new CGSize(width: 0, height: 0.1); _home.TitleLabel.Layer.ShadowOpacity = 1; _home.TitleLabel.Layer.ShadowRadius = 8; _home.TitleLabel.Layer.MasksToBounds = false; _home.SetImage(UIImage.FromFile("Image/todoIOS.png"), UIControlState.Normal); _home.TouchUpInside += delegate { File.Delete(_filePath); ViewModel.GoHome(); Mvx.Resolve <IMvxSideMenu>().Close(); }; _contentConteiner.AddSubview(_home); _logOff = new UIButton(); _logOff.SetTitle("LogOff", UIControlState.Normal); _logOff.SetTitleColor(UIColor.Black, UIControlState.Normal); _logOff.TitleLabel.ShadowOffset = new CGSize(width: 0, height: 0.1); _logOff.TitleLabel.Layer.ShadowOpacity = 1; _logOff.TitleLabel.Layer.ShadowRadius = 8; _logOff.TitleLabel.Layer.MasksToBounds = false; _logOff.SetImage(UIImage.FromFile("Image/logoffIOS.png"), UIControlState.Normal); _logOff.TouchUpInside += delegate { File.Delete(_filePath); ViewModel.DoLogOff(); Mvx.Resolve <IMvxSideMenu>().Close(); }; _contentConteiner.AddSubview(_logOff); var set = this.CreateBindingSet <LeftPanelView, LeftPanelViewModel>(); set.Bind(_userImage).For(v => v.Image).To(vm => vm.UserImage).WithConversion("ByteToUIImage"); set.Bind(_userLogin).To(vm => vm.UserLogin); set.Apply(); //conastraint _scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _scrollView.AddConstraints(_contentConteiner.FullWidthOf(_scrollView)); _scrollView.AddConstraints(_contentConteiner.FullHeightOf(_scrollView)); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints(_scrollView.FullWidthOf(View)); View.AddConstraints(_scrollView.FullHeightOf(View)); View.AddConstraints( _contentConteiner.WithSameWidth(View), _contentConteiner.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow) ); _contentConteiner.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _contentConteiner.AddConstraints( _titleView.WithSameCenterX(_contentConteiner), _titleView.AtTopOf(_contentConteiner).Plus(20), _titleView.Height().EqualTo(250), _titleView.WithSameWidth(_contentConteiner).Minus(10), _userImage.WithSameCenterX(_titleView), _userImage.WithSameCenterY(_titleView), _userImage.Height().EqualTo(120), _userImage.Width().EqualTo(120), _imageButton.Height().EqualTo(120), _imageButton.Width().EqualTo(120), _imageButton.WithSameCenterX(_userImage), _imageButton.WithSameCenterY(_userImage), _userLogin.Below(_userImage, 10), _userLogin.WithSameCenterX(_userImage), _home.Below(_userLogin, 50), _home.AtLeftOf(_contentConteiner, 5), _logOff.Below(_home, 5), _logOff.AtLeftOf(_contentConteiner, 5) ); // very important to make scrolling work var bottomViewConstraint = _contentConteiner.Subviews.Last() .AtBottomOf(_contentConteiner).Minus(20); _contentConteiner.AddConstraints(bottomViewConstraint); }
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 (); }
// ----------------------------------------------------------------------------- // Lifecycle public override void ViewDidLoad() { base.ViewDidLoad(); // Init View.BackgroundColor = BackgroundColor; _titleLabel = new UILabel { Text = TitleText, TextAlignment = UITextAlignment.Center, Font = UIFont.PreferredTitle2, TextColor = UIColor.Black, }; _nextViewButton = UIButton.FromType(UIButtonType.System); _nextViewButton.SetTitle("Next View", UIControlState.Normal); _nextViewButton.TouchUpInside += (s, e) => ViewModel?.NextViewCommand?.Execute(); _nextSubViewButton = UIButton.FromType(UIButtonType.System); _nextSubViewButton.SetTitle("Next SubView", UIControlState.Normal); _nextSubViewButton.TouchUpInside += (s, e) => ViewModel?.NextSubViewCommand?.Execute(); _prevViewButton = UIButton.FromType(UIButtonType.System); _prevViewButton.SetTitle("Prev View", UIControlState.Normal); _prevViewButton.TouchUpInside += (s, e) => ViewModel?.PrevViewCommand?.Execute(); _backButton = UIButton.FromType(UIButtonType.System); _backButton.SetTitle("Back", UIControlState.Normal); _backButton.TouchUpInside += (s, e) => ViewModel?.BackCommand?.Execute(); _homeButton = UIButton.FromType(UIButtonType.System); _homeButton.SetTitle("Home", UIControlState.Normal); _homeButton.TouchUpInside += (s, e) => ViewModel?.HomeCommand?.Execute(); View.AddSubviews(_titleLabel, _nextViewButton, _nextSubViewButton, _prevViewButton, _backButton, _homeButton); // Add Constraints View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints( _titleLabel.AtTopOf(View, 100f), _titleLabel.AtLeftOf(View, 8f), _titleLabel.WithSameWidth(View).Minus(16f)); //_titleLabel.Height().EqualTo(40f)); View.AddConstraints( _nextViewButton.Below(_titleLabel, 32f), _nextViewButton.AtLeftOf(View, 8f), _nextViewButton.WithSameWidth(View).Minus(16f), _nextViewButton.Height().EqualTo(40f)); View.AddConstraints( _nextSubViewButton.Below(_nextViewButton, 16f), _nextSubViewButton.AtLeftOf(View, 8f), _nextSubViewButton.WithSameWidth(View).Minus(16f), _nextSubViewButton.Height().EqualTo(40f)); View.AddConstraints( _prevViewButton.Below(_nextSubViewButton, 16f), _prevViewButton.AtLeftOf(View, 8f), _prevViewButton.WithSameWidth(View).Minus(16f), _prevViewButton.Height().EqualTo(40f)); View.AddConstraints( _backButton.Below(_prevViewButton, 16f), _backButton.AtLeftOf(View, 8f), _backButton.WithSameWidth(View).Minus(16f), _backButton.Height().EqualTo(40f)); View.AddConstraints( _homeButton.Below(_backButton, 16f), _homeButton.AtLeftOf(View, 8f), _homeButton.WithSameWidth(View).Minus(16f), _homeButton.Height().EqualTo(40f)); }
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) ); }
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) ); }
protected override void InitializeObjects() { base.InitializeObjects(); View.BackgroundColor = UIColor.LightGray; var topView = new UIView(); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); backToPayHistoryViewButton = UIButton.FromType(UIButtonType.Custom); backToPayHistoryViewButton.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); openInButton = UIButton.FromType(UIButtonType.Custom); openInButton.SetImage(UIImage.FromFile(@"Images/PayHistoryView/ic_openIn.png"), UIControlState.Normal); informationLabel = new UILabel(); informationLabel.TextColor = UIColor.White; informationLabel.Text = "Payment History"; informationLabel.Font = UIFont.BoldSystemFontOfSize(16f); informationLabel.TextAlignment = UITextAlignment.Center; urlLabel = new UILabel(); pdfWebView = new UIWebView(View.Bounds); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size)); topView.AddIfNotNull(profileNavigationBarBackground, backToPayHistoryViewButton, informationLabel, openInButton); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backToPayHistoryViewButton.WithSameCenterY(topView), backToPayHistoryViewButton.AtLeftOf(topView, 20), backToPayHistoryViewButton.WithRelativeWidth(topView, 0.1f), backToPayHistoryViewButton.WithRelativeHeight(topView, 0.2f), informationLabel.WithSameCenterY(topView), informationLabel.WithSameCenterX(topView), informationLabel.WithSameWidth(topView), informationLabel.WithRelativeHeight(topView, 0.3f), openInButton.WithSameCenterY(topView), openInButton.AtRightOf(topView, 20), openInButton.WithRelativeWidth(topView, 0.1f), openInButton.WithRelativeHeight(topView, 0.2f) ); View.AddIfNotNull(topView, pdfWebView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), pdfWebView.Below(topView, 10), pdfWebView.AtLeftOf(View, 30), pdfWebView.AtRightOf(View, 30), pdfWebView.WithRelativeHeight(View, 0.8f) ); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); scrollView = new UIView(); var bottomView = new UIView(); payHistoryTableView = new UITableView(); informationLabel = new UILabel(); informationLabel.TextColor = UIColor.White; informationLabel.Text = "Payment History"; informationLabel.Font = UIFont.BoldSystemFontOfSize(16f); informationLabel.TextAlignment = UITextAlignment.Center; backHomeView = UIButton.FromType(UIButtonType.Custom); backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));//EnvironmentInfo.CheckDevice().Scale(View.Frame.Size)); profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, informationLabel); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backHomeView.WithSameCenterY(topView), backHomeView.AtLeftOf(topView, 20), backHomeView.WithRelativeWidth(topView, 0.1f), backHomeView.WithRelativeHeight(topView, 0.2f), informationLabel.WithSameCenterY(topView), informationLabel.WithSameCenterX(topView), informationLabel.WithSameWidth(topView), informationLabel.WithRelativeHeight(topView, 0.3f) ); dowloadHistoryButton = ProfileButtonManager.ButtonInitiaziler("Download History", UIImage.FromFile(@"Images/ProfileView/ic_license.png")); payHistoryViewSource = new MvxSimpleTableViewSource(payHistoryTableView, NotPayedTripsTableViewCell.Key, NotPayedTripsTableViewCell.Key); payHistoryTableView.Source = payHistoryViewSource; payHistoryTableView.BackgroundColor = UIColor.Clear; payHistoryTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; payHistoryTableView.EstimatedRowHeight = 90f; payHistoryTableView.RowHeight = UITableView.AutomaticDimension; bottomView.AddIfNotNull(dowloadHistoryButton, payHistoryTableView); bottomView.AddConstraints( dowloadHistoryButton.AtTopOf(bottomView), dowloadHistoryButton.WithSameCenterX(bottomView), dowloadHistoryButton.WithSameWidth(bottomView), dowloadHistoryButton.WithRelativeHeight(bottomView, 0.1f), payHistoryTableView.Below(dowloadHistoryButton), payHistoryTableView.WithSameCenterX(bottomView), payHistoryTableView.WithSameWidth(bottomView), payHistoryTableView.WithRelativeHeight(bottomView, 1) ); scrollView.AddIfNotNull(bottomView); scrollView.AddConstraints( bottomView.AtTopOf(scrollView), bottomView.WithSameWidth(scrollView), bottomView.AtLeftOf(scrollView), bottomView.AtRightOf(scrollView), bottomView.AtBottomOf(scrollView), bottomView.WithRelativeHeight(scrollView, 0.9f) ); View.AddIfNotNull(topView, scrollView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), scrollView.Below(topView, 1), scrollView.AtLeftOf(View, 30), scrollView.AtRightOf(View, 30), scrollView.WithRelativeHeight(View, 0.8f) ); AddLoader(); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var centerView = new UIView(); var bottomView = new UIView(); var socialNetworksView = new UIView(); var applicationLogo = new UIImageView(UIImage.FromBundle(@"Images/logo.png")); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/main_background.png").Scale(View.Frame.Size)); applicationLogo.Frame = new CGRect(10, 10, applicationLogo.Image.CGImage.Width, applicationLogo.Image.CGImage.Height); topView.AddIfNotNull(applicationLogo); topView.AddConstraints( applicationLogo.WithRelativeWidth(topView, 0.5f), applicationLogo.WithRelativeHeight(topView, 0.25f), applicationLogo.WithSameCenterX(topView), applicationLogo.WithSameCenterY(topView) ); _loginTextField = TextFieldInitializer("Login"); _loginTextField.TextFieldWithValidator.TextField.KeyboardType = UIKeyboardType.EmailAddress; socialNetworkLabel = LabelInitializer("Login With:", UIColor.LightGray); registrationLabel = LabelInitializer("Don't have an account?", UIColor.LightGray); _passwordTextField = TextFieldInitializer("Password"); _loginButton = ButtonInitializer("Login", UIControlState.Normal, Theme.BlueDark.ToUIColor(), UIColor.White, UIControlState.Normal, null, UIControlState.Disabled); _googlePlusLoginButton = CreateGoogleButton(); var sloginView = new LoginButton(new CGRect(51, 0, 218, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray() }; _facebookLoginButton = ButtonInitializer(sloginView.CurrentTitle, UIControlState.Normal, null, sloginView.CurrentTitleColor, UIControlState.Normal, sloginView.CurrentImage, UIControlState.Normal); _facebookLoginButton.SetBackgroundImage(sloginView.CurrentBackgroundImage, UIControlState.Normal); _facebookLoginButton.Font = UIFont.FromName("Helvetica", 14f); _facebookLoginButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 40); forgotPasswordButton = ButtonInitializer("Forgot your password?", UIControlState.Normal, null, UIColor.LightGray, UIControlState.Normal, null, UIControlState.Normal); forgotPasswordButton.TitleLabel.Font = UIFont.FromName("Helvetica", 12f); registrationButton = ButtonInitializer("Get Started!", UIControlState.Normal, null, UIColor.Cyan, UIControlState.Normal, null, UIControlState.Normal); registrationButton.TitleLabel.Font = UIFont.FromName("Helvetica", 12f); socialNetworksView.AddIfNotNull(socialNetworkLabel, _facebookLoginButton, _googlePlusLoginButton); socialNetworksView.AddConstraints( socialNetworkLabel.AtTopOf(socialNetworksView), socialNetworkLabel.AtLeftOf(socialNetworksView), socialNetworkLabel.WithSameWidth(socialNetworksView), socialNetworkLabel.WithRelativeHeight(socialNetworksView, 0.2f), socialNetworkLabel.AtBottomOf(socialNetworksView, 10), _facebookLoginButton.Below(socialNetworkLabel), _facebookLoginButton.AtLeftOf(socialNetworksView), _facebookLoginButton.WithRelativeWidth(socialNetworksView, 0.48f), _facebookLoginButton.WithRelativeHeight(socialNetworksView, 0.4f), _googlePlusLoginButton.Below(socialNetworkLabel), _googlePlusLoginButton.WithRelativeWidth(socialNetworksView, 0.48f), _googlePlusLoginButton.WithRelativeHeight(socialNetworksView, 0.4f), _googlePlusLoginButton.AtRightOf(socialNetworksView) ); // Central block with text fields and login buttons centerView.Layer.CornerRadius = 10; centerView.AddIfNotNull(_loginTextField, _passwordTextField, forgotPasswordButton, _loginButton, socialNetworksView, registrationLabel, registrationButton); centerView.BackgroundColor = UIColor.White; centerView.AddConstraints( _loginTextField.AtTopOf(centerView, 10), _loginTextField.WithSameCenterX(centerView), _loginTextField.WithSameWidth(centerView), _loginTextField.WithRelativeHeight(centerView, 0.2f), _passwordTextField.Below(_loginTextField), _passwordTextField.WithSameCenterX(centerView), _passwordTextField.WithSameWidth(centerView), _passwordTextField.WithRelativeHeight(centerView, 0.2f), forgotPasswordButton.Below(_passwordTextField, -10), forgotPasswordButton.AtLeftOf(centerView, 20), forgotPasswordButton.WithRelativeWidth(centerView, 0.5f), forgotPasswordButton.WithRelativeHeight(centerView, 0.07f), _loginButton.Below(forgotPasswordButton, 10), _loginButton.AtLeftOf(centerView, 20), _loginButton.AtRightOf(centerView, 20), // make a fat login button _loginButton.WithRelativeHeight(centerView, 0.15f), socialNetworksView.Below(_loginButton, 20), socialNetworksView.AtLeftOf(centerView, 20), socialNetworksView.AtRightOf(centerView, 20), socialNetworksView.WithRelativeHeight(centerView, 0.2f), registrationLabel.Below(socialNetworksView), registrationLabel.AtLeftOf(centerView, 25), registrationLabel.WithRelativeWidth(centerView, 0.5f), registrationLabel.WithRelativeHeight(centerView, 0.07f), registrationButton.Below(socialNetworksView), registrationButton.AtRightOf(centerView, 10), registrationButton.WithRelativeWidth(centerView, 0.5f), registrationButton.WithRelativeHeight(centerView, 0.07f) ); // Main view View.AddIfNotNull(topView, centerView, bottomView); View.AddConstraints( topView.AtTopOf(View, 10), topView.AtLeftOf(View), topView.AtRightOf(View), topView.WithRelativeHeight(View, 0.15f), centerView.AtLeftOf(View, 30), centerView.AtRightOf(View, 30), centerView.Below(topView), centerView.AtBottomOf(View, 70), bottomView.AtBottomOf(View), bottomView.AtLeftOf(View), bottomView.AtRightOf(View), bottomView.Below(centerView), bottomView.WithRelativeHeight(View, 0f) ); SignIn.SharedInstance.UIDelegate = this; EnableNextKeyForTextFields(_loginTextField.TextFieldWithValidator.TextField, _passwordTextField.TextFieldWithValidator.TextField); }
protected override void SetupUserInterface() { EdgesForExtendedLayout = UIRectEdge.None; View = scrollView = new UIScrollView(RectangleF.Empty) { BackgroundColor = MobileCore.Values.Colors.LightGray.ToNative(), ShowsHorizontalScrollIndicator = false, AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth, TranslatesAutoresizingMaskIntoConstraints = true }; passwordManagement = new UIButton(UIButtonType.DetailDisclosure); passwordManagement.SetTitle(MobileCore.Values.Strings.Settings_PasswordManagement, UIControlState.Normal); scrollView.Add(passwordManagement); myProfile = new UIButton(UIButtonType.DetailDisclosure); myProfile.SetTitle(MobileCore.Values.Strings.Settings_MyProfile, UIControlState.Normal); scrollView.Add(myProfile); myRates = new UIButton(UIButtonType.DetailDisclosure); myRates.SetTitle(MobileCore.Values.Strings.Settings_Rates, UIControlState.Normal); scrollView.Add(myRates); billing = new UIButton(UIButtonType.DetailDisclosure); billing.SetTitle(MobileCore.Values.Strings.Settings_Billing, UIControlState.Normal); scrollView.Add(billing); inviteUsers = new UIButton(UIButtonType.DetailDisclosure); inviteUsers.SetTitle(MobileCore.Values.Strings.Settings_AddUsers, UIControlState.Normal); scrollView.Add(inviteUsers); scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints( passwordManagement.AtTopOf(scrollView, Constants.Layout.VerticalPadding), passwordManagement.AtLeftOf(scrollView, Constants.Layout.HorizontalPadding), passwordManagement.WithSameWidth(scrollView) .Minus(Constants.Layout.HorizontalPadding * 2), myProfile.WithSameWidth(scrollView) .Minus(Constants.Layout.HorizontalPadding * 2), myProfile.Below(passwordManagement, Constants.Layout.VerticalPadding), myProfile.AtLeftOf(scrollView, Constants.Layout.HorizontalPadding), myRates.WithSameWidth(scrollView) .Minus(Constants.Layout.HorizontalPadding * 2), myRates.Below(myProfile, Constants.Layout.VerticalPadding), myRates.AtLeftOf(scrollView, Constants.Layout.HorizontalPadding), billing.WithSameWidth(scrollView) .Minus(Constants.Layout.HorizontalPadding * 2), billing.Below(myRates, Constants.Layout.VerticalPadding), billing.AtLeftOf(scrollView, Constants.Layout.HorizontalPadding), inviteUsers.WithSameWidth(scrollView) .Minus(Constants.Layout.HorizontalPadding * 2), inviteUsers.Below(billing, Constants.Layout.VerticalPadding), inviteUsers.AtLeftOf(scrollView, Constants.Layout.HorizontalPadding), inviteUsers.Bottom() .EqualTo() .BottomOf(scrollView) .Minus(Constants.Layout.VerticalPadding) ); }
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(); }
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); }
private void SetupView() { NavigationController.SetNavigationBarHidden(true, true); View.BackgroundColor = UIColor.White; _logoImage = new UIImageView(); _logoImage.Image = UIImage.FromBundle("login_logo"); _logoImage.Frame = new CGRect(0, 0, _logoImage.Image.CGImage.Width, _logoImage.Image.CGImage.Height); _logoImage.ContentMode = UIViewContentMode.ScaleAspectFill; var firstAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(36, 183, 128), Font = UIFont.FromName("ArialMT", 15f) }; _loginTextField = new UITextField(new CGRect()) { AttributedPlaceholder = new NSAttributedString("Username..."), }; _loginTextField.TextColor = UIColor.FromRGB(36, 183, 128); _loginTextField.Font = UIFont.FromName("ArialMT", 15f); _passwordTextField = new UITextField(new CGRect()) { AttributedPlaceholder = new NSAttributedString("Password...", firstAttributes), SecureTextEntry = true }; _passwordTextField.TextColor = UIColor.FromRGB(36, 183, 128); _passwordTextField.Font = UIFont.FromName("ArialMT", 15f); _loginButton = new UIButton(UIButtonType.System); _loginButton.SetTitle("Login", UIControlState.Normal); _loginButton.Font = UIFont.FromName("ArialMT", 15f); _loginButton.SetTitleColor(UIColor.White, UIControlState.Normal); _loginButton.Layer.BorderWidth = 1; _loginButton.Layer.CornerRadius = 10; _loginButton.Layer.BorderColor = UIColor.Black.CGColor; Add(_logoImage); Add(_loginTextField); Add(_passwordTextField); Add(_loginButton); View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); View.AddConstraints(_logoImage.AtTopOf(View, 80), _logoImage.Height().EqualTo(90), _logoImage.Width().EqualTo(90), _logoImage.WithSameCenterX(View), _loginTextField.WithSameCenterX(View), _loginTextField.Below(_logoImage, 40), _loginTextField.AtLeftOf(View, 40), _loginTextField.AtRightOf(View, 40), _passwordTextField.WithSameCenterX(_loginTextField), _passwordTextField.Below(_loginTextField, 20), _passwordTextField.AtLeftOf(View, 40), _passwordTextField.AtRightOf(View, 40), _loginButton.WithSameCenterX(_passwordTextField), _loginButton.Below(_passwordTextField, 40), _loginButton.AtLeftOf(View, 40), _loginButton.AtRightOf(View, 40) ); }
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) ); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var scrollView = new UIScrollView(); var topTextRowView = new UIView(); backHomeView = UIButton.FromType(UIButtonType.Custom); backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); nameOfPageLabel = LabelInformationAboutPage(UIColor.White, "License Information", UIFont.BoldSystemFontOfSize(16f)); informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter the License Plate Number and Other Information for Your Vehicle.", UIFont.FromName("Helvetica", 14f)); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));//EnvironmentInfo.CheckDevice().Scale(View.Frame.Size)); profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); var labelView = new UIView(); labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel); labelView.AddConstraints( nameOfPageLabel.AtTopOf(labelView, 20), nameOfPageLabel.WithSameCenterX(labelView), nameOfPageLabel.WithSameCenterY(labelView), nameOfPageLabel.WithSameWidth(labelView), nameOfPageLabel.WithRelativeHeight(labelView, 0.3f), informationAboutPageLabel.Below(nameOfPageLabel, 5), informationAboutPageLabel.WithSameWidth(labelView), informationAboutPageLabel.WithSameCenterX(labelView), informationAboutPageLabel.WithRelativeHeight(labelView, 0.6f) ); topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backHomeView.WithSameCenterY(topView), backHomeView.AtLeftOf(topView, 20), backHomeView.WithRelativeWidth(topView, 0.1f), backHomeView.WithRelativeHeight(topView, 0.2f), labelView.WithSameCenterX(topView), labelView.WithSameCenterY(topView), labelView.WithRelativeWidth(topView, 0.8f), labelView.WithRelativeHeight(topView, 0.6f) ); licensePlateTextField = TextFieldInitializer("LicensePlate"); stateTextField = TextFieldInitializer("State"); statesPicker = PickerInitializer(); statesPickerViewModel = new MvxPickerViewModel(statesPicker); statesPicker.Model = statesPickerViewModel; vehicleClassTextField = TextFieldInitializer("Vehicle Class"); vehicleClassesPicker = PickerInitializer(); vehicleClassesPickerViewModel = new MvxPickerViewModel(vehicleClassesPicker); vehicleClassesPicker.Model = vehicleClassesPickerViewModel; topTextRowView.AddIfNotNull(licensePlateTextField, stateTextField, vehicleClassTextField); topTextRowView.AddConstraints( licensePlateTextField.AtTopOf(topTextRowView), licensePlateTextField.WithSameCenterX(topTextRowView), licensePlateTextField.WithSameWidth(topTextRowView), licensePlateTextField.WithRelativeHeight(topTextRowView, 0.3f), stateTextField.Below(licensePlateTextField, 10), stateTextField.WithSameCenterX(topTextRowView), stateTextField.WithSameWidth(topTextRowView), stateTextField.WithRelativeHeight(topTextRowView, 0.3f), vehicleClassTextField.Below(stateTextField, 10), vehicleClassTextField.WithSameCenterX(topTextRowView), vehicleClassTextField.WithSameWidth(topTextRowView), vehicleClassTextField.WithRelativeHeight(topTextRowView, 0.3f) ); scrollView.AddIfNotNull(topTextRowView); scrollView.AddConstraints( topTextRowView.AtTopOf(scrollView), topTextRowView.WithSameWidth(scrollView), topTextRowView.AtLeftOf(scrollView), topTextRowView.AtRightOf(scrollView), topTextRowView.WithRelativeHeight(scrollView, 0.4f) ); View.AddIfNotNull(topView, scrollView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), scrollView.Below(topView, 30), scrollView.AtLeftOf(View, 30), scrollView.AtRightOf(View, 30), scrollView.WithRelativeHeight(View, 0.8f) ); EnableNextKeyForTextFields(licensePlateTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField, vehicleClassTextField.TextFieldWithValidator.TextField); }
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 (); }
/// <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) ); } }