public override void ViewDidLoad( ) { OrientationState = -1; //Instantiate the Bible Web View first. BibleWebView = new UIWebView(new CGRect(10, 10, View.Bounds.Width - 20, View.Bounds.Height - 20)); BibleWebView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(0x1C1C1CFF); BibleWebView.ScrollView.ContentInset = new UIEdgeInsets(10, 0, 40, 0); BibleWebView.Opaque = false; View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); View.AddSubview(BibleWebView); //Then instantiate the blocker view. BlockerView = new UIBlockerView(View, View.Bounds.ToRectF( )); ResultView = new UIResultView(View, View.Bounds.ToRectF( ), delegate { if (RequestingBiblePassage == false) { RetrieveBiblePassage( ); } }); }
public override void ViewDidLoad() { base.ViewDidLoad(); BlockerView = new UIBlockerView(View, View.Frame.ToRectF( )); ResultView = new UIResultView(View, View.Frame.ToRectF( ), delegate { if (RequestingPrayers == false) { RetrievePrayerRequests( ); } }); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); float viewRealHeight = (float)(View.Bounds.Height - Task.NavToolbar.Frame.Height); float cardSizePerc = .83f; float cardWidth = (float)(View.Bounds.Width * cardSizePerc); float cardHeight = (float)(viewRealHeight * cardSizePerc); // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right float cardYOffset = (viewRealHeight * .03f); Carousel = PlatformCardCarousel.Create(View, cardWidth, cardHeight, new System.Drawing.RectangleF(0, cardYOffset, (float)View.Bounds.Width, viewRealHeight), PrivatePrayerConfig.Card_AnimationDuration); CardSize = new CGRect(0, 0, cardWidth, cardHeight); LastDownload = DateTime.MinValue; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Prayer_Post, container, false); view.SetOnTouchListener(this); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), delegate { if (Success == true) { // leave ParentTask.OnClick(this, 0); } else { // retry SubmitPrayerRequest( ); } }); BlockerView = new UIBlockerView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); return(view); }
public override void ViewDidLoad() { base.ViewDidLoad(); ResultView = new UIResultView(View, View.Frame.ToRectF( ), delegate { if (Success == true) { NavigationController.PopToRootViewController(true); } else { Task.NavToolbar.Reveal(false); SubmitPrayerRequest( ); } }); BlockerView = new UIBlockerView(View, View.Frame.ToRectF( )); //setup our appearance View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } RelativeLayout view = inflater.Inflate(Resource.Layout.BiblePassage, container, false) as RelativeLayout; view.SetOnTouchListener(this); PassageWebView = new WebView(Rock.Mobile.PlatformSpecific.Android.Core.Context); PassageWebView.SetBackgroundColor(Android.Graphics.Color.Rgb(28, 28, 28)); PassageWebView.SetPadding(10, 0, 40, 0); view.AddView(PassageWebView); view.SetBackgroundColor(Android.Graphics.Color.Rgb(28, 28, 28)); // get our power management control PowerManager pm = PowerManager.FromContext(Rock.Mobile.PlatformSpecific.Android.Core.Context); WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Bible Passage"); BlockerView = new UIBlockerView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), delegate { if (RequestingBiblePassage == false) { RetrieveBiblePassage( ); } }); return(view); }
public override void ViewDidLoad() { base.ViewDidLoad(); // setup the fake header HeaderView = new UIView( ); View.AddSubview(HeaderView); HeaderView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); // set the title image for the bar if there's no safe area defined. (A safe area is like, say, the notch for iPhone X) nfloat safeAreaTopInset = 0; // Make sure they're on iOS 11 before checking for insets. This is only needed for iPhone X anyways, which shipped with iOS 11. if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { safeAreaTopInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top; } if (safeAreaTopInset == 0) { string imagePath = NSBundle.MainBundle.BundlePath + "/" + PrivatePrimaryNavBarConfig.LogoFile_iOS; LogoView = new UIImageView(new UIImage(imagePath)); LogoView.Layer.AnchorPoint = CGPoint.Empty; LogoView.SizeToFit( ); HeaderView.AddSubview(LogoView); } ScrollView = new UIScrollViewWrapper(); ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height); View.AddSubview(ScrollView); ScrollView.Parent = this; // logged in sanity check. //if( RockMobileUser.Instance.LoggedIn == true ) throw new Exception("A user cannot be logged in when registering. How did you do this?" ); BlockerView = new UIBlockerView(View, View.Frame.ToRectF( )); //setup styles View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); UserNameText = new StyledTextField(); ScrollView.AddSubview(UserNameText.Background); UserNameText.Field.AutocapitalizationType = UITextAutocapitalizationType.None; UserNameText.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(UserNameText.Field, RegisterStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(UserNameText.Background); PasswordText = new StyledTextField(); ScrollView.AddSubview(PasswordText.Background); PasswordText.Field.AutocapitalizationType = UITextAutocapitalizationType.None; PasswordText.Field.AutocorrectionType = UITextAutocorrectionType.No; PasswordText.Field.SecureTextEntry = true; ControlStyling.StyleTextField(PasswordText.Field, RegisterStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(PasswordText.Background); ConfirmPasswordText = new StyledTextField(); ScrollView.AddSubview(ConfirmPasswordText.Background); ConfirmPasswordText.Field.SecureTextEntry = true; ControlStyling.StyleTextField(ConfirmPasswordText.Field, RegisterStrings.ConfirmPasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(ConfirmPasswordText.Background); NickNameText = new StyledTextField(); ScrollView.AddSubview(NickNameText.Background); NickNameText.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; NickNameText.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(NickNameText.Field, RegisterStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(NickNameText.Background); LastNameText = new StyledTextField(); ScrollView.AddSubview(LastNameText.Background); LastNameText.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; LastNameText.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(LastNameText.Field, RegisterStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(LastNameText.Background); EmailText = new StyledTextField(); ScrollView.AddSubview(EmailText.Background); EmailText.Field.AutocapitalizationType = UITextAutocapitalizationType.None; EmailText.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(EmailText.Field, RegisterStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(EmailText.Background); CellPhoneText = new StyledTextField(); ScrollView.AddSubview(CellPhoneText.Background); CellPhoneText.Field.AutocapitalizationType = UITextAutocapitalizationType.None; CellPhoneText.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(CellPhoneText.Field, RegisterStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(CellPhoneText.Background); DoneButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(DoneButton); ControlStyling.StyleButton(DoneButton, RegisterStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); DoneButton.SizeToFit( ); CancelButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(CancelButton); CancelButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal); CancelButton.SetTitle(GeneralStrings.Cancel, UIControlState.Normal); CancelButton.SizeToFit( ); // Allow the return on username and password to start // the login process NickNameText.Field.ShouldReturn += TextFieldShouldReturn; LastNameText.Field.ShouldReturn += TextFieldShouldReturn; EmailText.Field.ShouldReturn += TextFieldShouldReturn; // If submit is pressed with dirty changes, prompt the user to save them. DoneButton.TouchUpInside += (object sender, EventArgs e) => { RegisterUser( ); HideKeyboard( ); }; // On logout, make sure the user really wants to log out. CancelButton.TouchUpInside += (object sender, EventArgs e) => { // if there were changes, create an action sheet for them to confirm. UIAlertController actionSheet = UIAlertController.Create(RegisterStrings.ConfirmCancelReg, null, UIAlertControllerStyle.ActionSheet); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { actionSheet.PopoverPresentationController.SourceView = CancelButton; actionSheet.PopoverPresentationController.SourceRect = CancelButton.Bounds; } UIAlertAction yesAction = UIAlertAction.Create(GeneralStrings.Yes, UIAlertActionStyle.Destructive, delegate { Springboard.ResignModelViewController(this, null); }); actionSheet.AddAction(yesAction); // let them cancel, too UIAlertAction cancelAction = UIAlertAction.Create(GeneralStrings.Cancel, UIAlertActionStyle.Cancel, delegate { }); actionSheet.AddAction(cancelAction); PresentViewController(actionSheet, true, null); }; ResultView = new UIResultView(ScrollView, View.Frame.ToRectF( ), OnResultViewDone); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } GroupEntries = new List <MobileAppApi.GroupSearchResult>(); MarkerList = new List <Android.Gms.Maps.Model.Marker>(); SourceLocation = new MobileAppApi.GroupSearchResult(); // limit the address to 90% of the screen so it doesn't conflict with the progress bar. Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); //float fixedWidth = displaySize.X / 4.0f; // catch any exceptions thrown, as they'll be related to no map API key try { MapView = new Android.Gms.Maps.MapView(Rock.Mobile.PlatformSpecific.Android.Core.Context); MapView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f); MapView.GetMapAsync(this); MapView.SetBackgroundColor(Color.Black); MapView.OnCreate(savedInstanceState); } catch { MapView = null; Rock.Mobile.Util.Debug.WriteLine("GOOGLE MAPS: Unable to create. Verify you have a valid API KEY."); } NumRequestedGroups = 10; SearchAddressButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchAddressButton.Click += (object sender, EventArgs e) => { SearchPage.Show( ); }; // setup the linear layout containing the "Your Neighborhood is: Horizon" text SearchLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); SearchLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); SearchLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color)); SearchLayout.SetGravity(GravityFlags.Center); SearchResultPrefix = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); SearchResultPrefix.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal); SearchResultPrefix.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); SearchResultPrefix.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound; SearchResultNeighborhood = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); SearchResultNeighborhood.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal); SearchResultNeighborhood.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); SearchResultNeighborhood.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor)); SearchResultNeighborhood.Text = ""; Seperator = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context); Seperator.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0); Seperator.LayoutParameters.Height = 2; Seperator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); ListView = new ListView(Rock.Mobile.PlatformSpecific.Android.Core.Context); ListView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { OnClick(e.Position, 0); }; ListView.SetOnTouchListener(this); ListView.Adapter = new GroupArrayAdapter(this); View view = inflater.Inflate(Resource.Layout.Connect_GroupFinder, container, false); view.SetOnTouchListener(this); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color)); LinearLayout groupLayout = view.FindViewById <LinearLayout>(Resource.Id.groupFrame) as LinearLayout; // setup the address layout, which has the address text, padding, and finally the progress bar. if (MapView != null) { ((LinearLayout)groupLayout).AddView(MapView); } ((LinearLayout)groupLayout).AddView(SearchAddressButton); ((LinearLayout)groupLayout).AddView(SearchLayout); ((LinearLayout)SearchLayout).AddView(SearchResultPrefix); ((LinearLayout)SearchLayout).AddView(SearchResultNeighborhood); ((LinearLayout)groupLayout).AddView(Seperator); ((LinearLayout)groupLayout).AddView(ListView); BlockerView = new UIBlockerView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); SearchPage = new UIGroupFinderSearch(); SearchPage.Create(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), // Search Neighborhood Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); }, // Search Next Gen Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_NextGenGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); }, // Search Young Adult Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); }); SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails); SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); SearchPage.Hide(false); // if we should automatically show the search page... if (ShowSearchOnAppear == true) { // don't allow them to tap the address button until we reveal the search page. SearchAddressButton.Enabled = false; // wait a couple seconds before revealing the search page. System.Timers.Timer timer = new System.Timers.Timer(); timer.AutoReset = false; timer.Interval = 1000; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { SearchAddressButton.Enabled = true; SearchPage.Show( ); }); }; timer.Start( ); } else { // otherwise, just allow the seach button SearchAddressButton.Enabled = true; } // hook into the search page as its listener ((View)SearchPage.View.PlatformNativeObject).SetOnTouchListener(this); ((EditText)SearchPage.Street.PlatformNativeObject).SetOnEditorActionListener(this); ((EditText)SearchPage.City.PlatformNativeObject).SetOnEditorActionListener(this); ((EditText)SearchPage.State.PlatformNativeObject).SetOnEditorActionListener(this); ((EditText)SearchPage.ZipCode.PlatformNativeObject).SetOnEditorActionListener(this); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return null; } View view = inflater.Inflate(Resource.Layout.Prayer_Post, container, false); view.SetOnTouchListener( this ); view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); ResultView = new UIResultView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), delegate { if( Success == true ) { // leave ParentTask.OnClick( this, 0 ); } else { // retry SubmitPrayerRequest( ); } } ); BlockerView = new UIBlockerView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ) ); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Profile, container, false); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout); navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); // setup the name section NickNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.firstname_background); ControlStyling.StyleBGLayer(NickNameLayer); NickNameText = NickNameLayer.FindViewById <EditText>(Resource.Id.nickNameText); ControlStyling.StyleTextField(NickNameText, RegisterStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); NickNameBGColor = ControlStylingConfig.BG_Layer_Color; NickNameText.InputType |= InputTypes.TextFlagCapWords; NickNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; View borderView = NickNameLayer.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); LastNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.lastname_background); ControlStyling.StyleBGLayer(LastNameLayer); LastNameText = LastNameLayer.FindViewById <EditText>(Resource.Id.lastNameText); ControlStyling.StyleTextField(LastNameText, RegisterStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LastNameBGColor = ControlStylingConfig.BG_Layer_Color; LastNameText.InputType |= InputTypes.TextFlagCapWords; LastNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; // setup the contact section EmailLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background); ControlStyling.StyleBGLayer(EmailLayer); EmailBGColor = ControlStylingConfig.BG_Layer_Color; EmailField = EmailLayer.FindViewById <EditText>(Resource.Id.emailAddressText); ControlStyling.StyleTextField(EmailField, ProfileStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); EmailField.AfterTextChanged += (sender, e) => { Dirty = true; }; View backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.cellphone_background); ControlStyling.StyleBGLayer(backgroundView); borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CellPhoneField = backgroundView.FindViewById <EditText>(Resource.Id.cellPhoneText); ControlStyling.StyleTextField(CellPhoneField, ProfileStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CellPhoneField.AfterTextChanged += (sender, e) => { Dirty = true; }; CellPhoneField.AddTextChangedListener(new PhoneNumberFormattingTextWatcher()); // setup the address section backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.address_background); ControlStyling.StyleBGLayer(backgroundView); StreetField = backgroundView.FindViewById <EditText>(Resource.Id.streetAddressText); ControlStyling.StyleTextField(StreetField, ProfileStrings.StreetPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StreetField.AfterTextChanged += (sender, e) => { Dirty = true; }; StreetField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.street_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CityField = backgroundView.FindViewById <EditText>(Resource.Id.cityAddressText); ControlStyling.StyleTextField(CityField, ProfileStrings.CityPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CityField.AfterTextChanged += (sender, e) => { Dirty = true; }; CityField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.city_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); StateField = backgroundView.FindViewById <EditText>(Resource.Id.stateAddressText); ControlStyling.StyleTextField(StateField, ProfileStrings.StatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StateField.AfterTextChanged += (sender, e) => { Dirty = true; }; StateField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.state_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); ZipField = backgroundView.FindViewById <EditText>(Resource.Id.zipAddressText); ControlStyling.StyleTextField(ZipField, ProfileStrings.ZipPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ZipField.AfterTextChanged += (sender, e) => { Dirty = true; }; // personal backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.personal_background); ControlStyling.StyleBGLayer(backgroundView); BirthdateField = backgroundView.FindViewById <EditText>(Resource.Id.birthdateText); ControlStyling.StyleTextField(BirthdateField, ProfileStrings.BirthdatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); BirthdateField.FocusableInTouchMode = false; BirthdateField.Focusable = false; Button birthdateButton = backgroundView.FindViewById <Button>(Resource.Id.birthdateButton); birthdateButton.Click += (object sender, EventArgs e) => { // setup the initial date to use ( either now, or the date in the field ) DateTime initialDateTime = DateTime.Now; if (string.IsNullOrWhiteSpace(BirthdateField.Text) == false) { initialDateTime = DateTime.Parse(BirthdateField.Text); } // build our LayoutInflater dateInflate = LayoutInflater.From(Activity); DatePicker newPicker = (DatePicker)dateInflate.Inflate(Resource.Layout.DatePicker, null); newPicker.Init(initialDateTime.Year, initialDateTime.Month - 1, initialDateTime.Day, this); Dialog dialog = new Dialog(Activity); dialog.AddContentView(newPicker, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); dialog.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Gender GenderField = view.FindViewById <EditText>(Resource.Id.genderText); ControlStyling.StyleTextField(GenderField, ProfileStrings.GenderPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); GenderField.FocusableInTouchMode = false; GenderField.Focusable = false; Button genderButton = backgroundView.FindViewById <Button>(Resource.Id.genderButton); genderButton.Click += (object sender, EventArgs e) => { AlertDialog.Builder builder = new AlertDialog.Builder(Activity); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(RockLaunchData.Instance.Data.Genders[1]), new Java.Lang.String(RockLaunchData.Instance.Data.Genders[2]), }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { GenderField.Text = RockLaunchData.Instance.Data.Genders[clickArgs.Which + 1]; Dirty = true; }); }); builder.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.campus_middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Campus CampusField = view.FindViewById <EditText>(Resource.Id.campusText); ControlStyling.StyleTextField(CampusField, ProfileStrings.CampusPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CampusField.FocusableInTouchMode = false; CampusField.Focusable = false; Button campusButton = backgroundView.FindViewById <Button>(Resource.Id.campusButton); campusButton.Click += (object sender, EventArgs e) => { // build an alert dialog containing all the campus choices AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SelectCampus_SourceTitle); Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[RockLaunchData.Instance.Data.Campuses.Count]; for (int i = 0; i < RockLaunchData.Instance.Data.Campuses.Count; i++) { campusStrings[i] = new Java.Lang.String(RockLaunchData.Instance.Data.Campuses[i].Name); } // launch the dialog, and on selection, update the viewing campus text. builder.SetItems(campusStrings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { int campusIndex = clickArgs.Which; CampusField.Text = RockLaunchData.Instance.Data.Campuses[campusIndex].Name; Dirty = true; }); }); builder.Show( ); }; // Done buttons DoneButton = view.FindViewById <Button>(Resource.Id.doneButton); ControlStyling.StyleButton(DoneButton, ProfileStrings.DoneButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton = view.FindViewById <Button>(Resource.Id.logoutButton); ControlStyling.StyleButton(LogoutButton, ProfileStrings.LogoutButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton.Background = null; DoneButton.Click += (object sender, EventArgs e) => { if (Dirty == true) { if (ValidateInput( )) { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SubmitChangesTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No), new Java.Lang.String(GeneralStrings.Cancel) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: SubmitChanges( ); SpringboardParent.ModalFragmentDone(null); break; case 1: SpringboardParent.ModalFragmentDone(null); break; case 2: break; } }); }); builder.Show( ); } } else { SpringboardParent.ModalFragmentDone(null); } }; LogoutButton.Click += (object sender, EventArgs e) => { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.LogoutTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: RockMobileUser.Instance.LogoutAndUnbind( ); SpringboardParent.ModalFragmentDone(null); break; case 1: break; } }); }); builder.Show( ); }; // blocker and result views ScrollView = view.FindViewById <LockableScrollView>(Resource.Id.scroll_view); ScrollView.ScrollEnabled = false; // scroll to the top ScrollView.Post(new Action(delegate { ScrollView.ForceScrollTo(0, 0); })); RelativeLayout parentLayout = view.FindViewById <RelativeLayout>(Resource.Id.relative_layout); RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels); BlockerView = new UIBlockerView(parentLayout, bounds); BlockerView.Hide( ); ResultView = new UIResultView(parentLayout, bounds, delegate { SpringboardParent.ModalFragmentDone(null); }); ResultView.Hide( ); return(view); }
public override void ViewDidLoad() { base.ViewDidLoad(); RefreshProfileTimer = new System.Timers.Timer(); RefreshProfileTimer.AutoReset = true; RefreshProfileTimer.Interval = 300 * 1000; // every 5 minutes RefreshProfileTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { RefreshProfile( ); }); }; // setup the fake header HeaderView = new UIView( ); View.AddSubview(HeaderView); HeaderView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); // set the title image for the bar if there's no safe area defined. (A safe area is like, say, the notch for iPhone X) nfloat safeAreaTopInset = 0; // Make sure they're on iOS 11 before checking for insets. This is only needed for iPhone X anyways, which shipped with iOS 11. if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { safeAreaTopInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top; } if (safeAreaTopInset == 0) { string imagePath = NSBundle.MainBundle.BundlePath + "/" + PrivatePrimaryNavBarConfig.LogoFile_iOS; LogoView = new UIImageView(new UIImage(imagePath)); LogoView.SizeToFit( ); LogoView.Layer.AnchorPoint = CGPoint.Empty; HeaderView.AddSubview(LogoView); } ScrollView = new UIScrollViewWrapper(); View.AddSubview(ScrollView); ScrollView.Parent = this; BlockerView = new UIBlockerView(ScrollView, View.Bounds.ToRectF( )); //setup styles View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); NickName = new StyledTextField(); ScrollView.AddSubview(NickName.Background); ControlStyling.StyleTextField(NickName.Field, ProfileStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(NickName.Background); NickName.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; NickName.Field.AutocorrectionType = UITextAutocorrectionType.No; NickName.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; LastName = new StyledTextField(); LastName.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; LastName.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(LastName.Field, ProfileStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(LastName.Background); LastName.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; Email = new StyledTextField(); ScrollView.AddSubview(Email.Background); Email.Field.AutocapitalizationType = UITextAutocapitalizationType.None; Email.Field.AutocorrectionType = UITextAutocorrectionType.No; ScrollView.AddSubview(LastName.Background); ControlStyling.StyleTextField(Email.Field, ProfileStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(Email.Background); Email.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; CellPhone = new StyledTextField(); ScrollView.AddSubview(CellPhone.Background); CellPhone.Field.AutocapitalizationType = UITextAutocapitalizationType.None; CellPhone.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(CellPhone.Field, ProfileStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(CellPhone.Background); CellPhone.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; Street = new StyledTextField(); ScrollView.AddSubview(Street.Background); Street.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; Street.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(Street.Field, ProfileStrings.StreetPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(Street.Background); Street.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; City = new StyledTextField(); ScrollView.AddSubview(City.Background); City.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; City.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(City.Field, ProfileStrings.CityPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(City.Background); City.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; State = new StyledTextField(); ScrollView.AddSubview(State.Background); State.Field.AutocapitalizationType = UITextAutocapitalizationType.Words; State.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(State.Field, ProfileStrings.StatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(State.Background); State.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; Zip = new StyledTextField(); ScrollView.AddSubview(Zip.Background); Zip.Field.AutocapitalizationType = UITextAutocapitalizationType.None; Zip.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(Zip.Field, ProfileStrings.ZipPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(Zip.Background); Zip.Field.EditingDidBegin += (sender, e) => { Dirty = true; }; // Gender Gender = new StyledTextField(); ScrollView.AddSubview(Gender.Background); Gender.Field.UserInteractionEnabled = false; ControlStyling.StyleTextField(Gender.Field, ProfileStrings.GenderPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(Gender.Background); GenderButton = new UIButton( ); ScrollView.AddSubview(GenderButton); GenderButton.TouchUpInside += (object sender, EventArgs e) => { // don't allow multiple pickers if (GenderPicker.Revealed == false && BirthdatePicker.Revealed == false) { HideKeyboard( ); // if they have a gender selected, default to that. if (string.IsNullOrWhiteSpace(Gender.Field.Text) == false) { ((UIPickerView)GenderPicker.Picker).Select(RockLaunchData.Instance.Data.Genders.IndexOf(Gender.Field.Text) - 1, 0, false); } GenderPicker.TogglePicker(true); } }; // // Birthday Birthdate = new StyledTextField( ); ScrollView.AddSubview(Birthdate.Background); Birthdate.Field.UserInteractionEnabled = false; ControlStyling.StyleTextField(Birthdate.Field, ProfileStrings.BirthdatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(Birthdate.Background); BirthdayButton = new UIButton( ); ScrollView.AddSubview(BirthdayButton); BirthdayButton.TouchUpInside += (object sender, EventArgs e) => { // don't allow multiple pickers if (GenderPicker.Revealed == false && BirthdatePicker.Revealed == false) { HideKeyboard( ); // setup the default date time to display DateTime initialDate = DateTime.Now; if (string.IsNullOrWhiteSpace(Birthdate.Field.Text) == false) { initialDate = DateTime.Parse(Birthdate.Field.Text); } ((UIDatePicker)BirthdatePicker.Picker).Date = initialDate.DateTimeToNSDate( ); BirthdatePicker.TogglePicker(true); } }; // // setup the home campus chooser HomeCampus = new StyledTextField( ); ScrollView.AddSubview(HomeCampus.Background); HomeCampus.Field.UserInteractionEnabled = false; ControlStyling.StyleTextField(HomeCampus.Field, ProfileStrings.CampusPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(HomeCampus.Background); HomeCampusButton = new UIButton( ); ScrollView.AddSubview(HomeCampusButton); HomeCampusButton.TouchUpInside += (object sender, EventArgs e) => { UIAlertController actionSheet = UIAlertController.Create(ProfileStrings.SelectCampus_SourceTitle, ProfileStrings.SelectCampus_SourceDescription, UIAlertControllerStyle.ActionSheet); // if the device is a tablet, anchor the menu if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { actionSheet.PopoverPresentationController.SourceView = HomeCampusButton; actionSheet.PopoverPresentationController.SourceRect = HomeCampusButton.Bounds; } // for each campus, create an entry in the action sheet, and its callback will assign // that campus index to the user's viewing preference for (int i = 0; i < RockLaunchData.Instance.Data.Campuses.Count; i++) { UIAlertAction campusAction = UIAlertAction.Create(RockLaunchData.Instance.Data.Campuses[i].Name, UIAlertActionStyle.Default, delegate(UIAlertAction obj) { // update the home campus text and flag as dirty HomeCampus.Field.Text = obj.Title; Dirty = true; }); actionSheet.AddAction(campusAction); } // let them cancel, too UIAlertAction cancelAction = UIAlertAction.Create(GeneralStrings.Cancel, UIAlertActionStyle.Cancel, delegate { }); actionSheet.AddAction(cancelAction); PresentViewController(actionSheet, true, null); }; DoneButton = new UIButton( ); ScrollView.AddSubview(DoneButton); ControlStyling.StyleButton(DoneButton, ProfileStrings.DoneButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); DoneButton.SizeToFit( ); LogoutButton = new UIButton( ); ScrollView.AddSubview(LogoutButton); LogoutButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal); LogoutButton.SetTitle(ProfileStrings.LogoutButtonTitle, UIControlState.Normal); LogoutButton.SizeToFit( ); // setup the pickers UILabel genderPickerLabel = new UILabel( ); ControlStyling.StyleUILabel(genderPickerLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); genderPickerLabel.Text = ProfileStrings.SelectGenderLabel; GenderPicker = new PickerAdjustManager(View, ScrollView, genderPickerLabel, Gender.Background); UIPickerView genderPicker = new UIPickerView(); genderPicker.Model = new GenderPickerModel() { Parent = this }; GenderPicker.SetPicker(genderPicker); UILabel birthdatePickerLabel = new UILabel( ); ControlStyling.StyleUILabel(birthdatePickerLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); birthdatePickerLabel.Text = ProfileStrings.SelectBirthdateLabel; BirthdatePicker = new PickerAdjustManager(View, ScrollView, birthdatePickerLabel, Birthdate.Background); UIDatePicker datePicker = new UIDatePicker(); datePicker.SetValueForKey(UIColor.White, new NSString("textColor")); datePicker.Mode = UIDatePickerMode.Date; datePicker.MinimumDate = new DateTime(1900, 1, 1).DateTimeToNSDate( ); datePicker.MaximumDate = DateTime.Now.DateTimeToNSDate( ); datePicker.ValueChanged += (object sender, EventArgs e) => { NSDate pickerDate = ((UIDatePicker)sender).Date; Birthdate.Field.Text = string.Format("{0:MMMMM dd yyyy}", pickerDate.NSDateToDateTime( )); }; BirthdatePicker.SetPicker(datePicker); // Allow the return on username and password to start // the login process NickName.Field.ShouldReturn += TextFieldShouldReturn; LastName.Field.ShouldReturn += TextFieldShouldReturn; Email.Field.ShouldReturn += TextFieldShouldReturn; // If submit is pressed with dirty changes, prompt the user to save them. DoneButton.TouchUpInside += (object sender, EventArgs e) => { // dont' allow changes while the profile is refreshing. if (RefreshingProfile == false) { if (GenderPicker.Revealed == false && BirthdatePicker.Revealed == false) { if (Dirty == true) { // make sure the input is valid before asking them what they want to do. if (ValidateInput( )) { // if there were changes, create an action sheet for them to confirm. UIAlertController actionSheet = UIAlertController.Create(ProfileStrings.SubmitChangesTitle, null, UIAlertControllerStyle.ActionSheet); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { actionSheet.PopoverPresentationController.SourceView = DoneButton; actionSheet.PopoverPresentationController.SourceRect = DoneButton.Bounds; } UIAlertAction submitAction = UIAlertAction.Create(GeneralStrings.Yes, UIAlertActionStyle.Default, delegate { Dirty = false; SubmitChanges( ); Springboard.ResignModelViewController(this, null); }); actionSheet.AddAction(submitAction); UIAlertAction noSubmitAction = UIAlertAction.Create(GeneralStrings.No, UIAlertActionStyle.Destructive, delegate { Dirty = false; Springboard.ResignModelViewController(this, null); }); actionSheet.AddAction(noSubmitAction); // let them cancel, too UIAlertAction cancelAction = UIAlertAction.Create(GeneralStrings.Cancel, UIAlertActionStyle.Cancel, delegate { }); actionSheet.AddAction(cancelAction); PresentViewController(actionSheet, true, null); } } else { Springboard.ResignModelViewController(this, null); } } else { GenderPicker.TogglePicker(false); BirthdatePicker.TogglePicker(false); Dirty = true; } } }; // On logout, make sure the user really wants to log out. LogoutButton.TouchUpInside += (object sender, EventArgs e) => { // don't allow changes while the profile is refreshing if (RefreshingProfile == false) { if (GenderPicker.Revealed == false && BirthdatePicker.Revealed == false) { // if they tap logout, and confirm it UIAlertController actionSheet = UIAlertController.Create(ProfileStrings.LogoutTitle, null, UIAlertControllerStyle.ActionSheet); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { actionSheet.PopoverPresentationController.SourceView = LogoutButton; actionSheet.PopoverPresentationController.SourceRect = LogoutButton.Bounds; } UIAlertAction logoutAction = UIAlertAction.Create(GeneralStrings.Yes, UIAlertActionStyle.Destructive, delegate { // then log them out. RockMobileUser.Instance.LogoutAndUnbind( ); Springboard.ResignModelViewController(this, null); }); actionSheet.AddAction(logoutAction); // let them cancel, too UIAlertAction cancelAction = UIAlertAction.Create(GeneralStrings.Cancel, UIAlertActionStyle.Cancel, delegate { }); actionSheet.AddAction(cancelAction); PresentViewController(actionSheet, true, null); } else { GenderPicker.TogglePicker(false); BirthdatePicker.TogglePicker(false); Dirty = true; } } }; ResultView = new UIResultView(ScrollView, View.Bounds.ToRectF( ), delegate { Springboard.ResignModelViewController(this, null); }); Dirty = false; // logged in sanity check. if (RockMobileUser.Instance.LoggedIn == false) { throw new Exception("A user must be logged in before viewing a profile. How did you do this?"); } }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(MobileApp.Shared.Config.ControlStylingConfig.BackgroundColor); ScrollView = new UIScrollViewWrapper(); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; ScrollView.Bounds = View.Bounds; View.AddSubview(ScrollView); ScrollView.ScrollEnabled = false; // setup everything except positioning, which will happen in LayoutChanged() SourceLocation = null; GroupEntries = new List <MobileAppApi.GroupSearchResult>(); SearchAddressButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(SearchAddressButton); SearchAddressButton.Layer.AnchorPoint = CGPoint.Empty; ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchAddressButton.TouchUpInside += (object sender, EventArgs e) => { SearchPage.Show( ); Task.NavToolbar.Reveal(false); }; MapView = new MKMapView( ); ScrollView.AddSubview(MapView); CurrGroupIndex = 0; NumRequestedGroups = 10; // set the default position for the map to whatever specified area. MKCoordinateRegion region = MKCoordinateRegion.FromDistance(new CLLocationCoordinate2D( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude), ConnectConfig.GroupFinder_DefaultScale_iOS, ConnectConfig.GroupFinder_DefaultScale_iOS); MapView.SetRegion(region, true); MapView.Layer.AnchorPoint = new CGPoint(0, 0); MapView.Delegate = new MapViewDelegate() { Parent = this }; SearchResultsBGLayer = new UIView(); ScrollView.AddSubview(SearchResultsBGLayer); SearchResultsBGLayer.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsBGLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsPrefix = new UILabel( ); ScrollView.AddSubview(SearchResultsPrefix); SearchResultsPrefix.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsPrefix.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound; SearchResultsPrefix.SizeToFit( ); SearchResultsPrefix.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor); SearchResultsPrefix.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsPrefix.TextAlignment = UITextAlignment.Center; SearchResultsNeighborhood = new UILabel( ); ScrollView.AddSubview(SearchResultsNeighborhood); SearchResultsNeighborhood.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsNeighborhood.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchResultsNeighborhood.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor); SearchResultsNeighborhood.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsNeighborhood.TextAlignment = UITextAlignment.Center; Seperator = new UIView( ); ScrollView.AddSubview(Seperator); Seperator.Layer.BorderWidth = 1; Seperator.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor).CGColor; GroupFinderTableView = new UITableView(); ScrollView.AddSubview(GroupFinderTableView); GroupTableSource = new GroupFinderViewController.TableSource(this); // add the table view and source GroupFinderTableView.BackgroundColor = UIColor.Clear; GroupFinderTableView.Source = GroupTableSource; GroupFinderTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; BlockerView = new UIBlockerView(ScrollView, ScrollView.Frame.ToRectF( )); SearchPage = new UIGroupFinderSearch(); SearchPage.Create(ScrollView, ScrollView.Frame.ToRectF( ), // Search Neighborhood Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }, // Search Short Term Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_ShortTermGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }, // Search Young Adults Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }); SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails); SearchPage.Hide(false); KeyboardAdjustManager = new KeyboardAdjustManager(View); // don't allow them to tap the address button until we reveal the search page. SearchAddressButton.Enabled = false; // wait a couple seconds before revealing the search page. System.Timers.Timer timer = new System.Timers.Timer(); timer.AutoReset = false; timer.Interval = 1000; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { SearchAddressButton.Enabled = true; SearchPage.Show( ); }); }; timer.Start( ); // hook in delegates so we can handle return ((UITextField)SearchPage.Street.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.City.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.State.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.ZipCode.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; }
public override void ViewDidLoad() { base.ViewDidLoad(); BlockerView = new UIBlockerView(View, View.Frame.ToRectF( )); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); ScrollView = new UIScrollViewWrapper(); ScrollView.Parent = this; ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Bounds = View.Bounds; //ScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( 0x0000FFFF ); View.AddSubview(ScrollView); UserNameField = new StyledTextField(); ScrollView.AddSubview(UserNameField.Background); UserNameField.Field.AutocapitalizationType = UITextAutocapitalizationType.None; UserNameField.Field.AutocorrectionType = UITextAutocorrectionType.No; ControlStyling.StyleTextField(UserNameField.Field, LoginStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(UserNameField.Background); UserNameField.Field.ShouldReturn += (textField) => { textField.ResignFirstResponder(); TryRockBind(); return(true); }; PasswordField = new StyledTextField(); ScrollView.AddSubview(PasswordField.Background); PasswordField.Field.AutocorrectionType = UITextAutocorrectionType.No; PasswordField.Field.SecureTextEntry = true; ControlStyling.StyleTextField(PasswordField.Field, LoginStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ControlStyling.StyleBGLayer(PasswordField.Background); PasswordField.Field.ShouldReturn += (textField) => { textField.ResignFirstResponder(); TryRockBind(); return(true); }; // obviously attempt a login if login is pressed LoginButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(LoginButton); ControlStyling.StyleButton(LoginButton, LoginStrings.LoginButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LoginButton.SizeToFit( ); LoginButton.TouchUpInside += (object sender, EventArgs e) => { if (RockMobileUser.Instance.LoggedIn == true) { RockMobileUser.Instance.LogoutAndUnbind( ); SetUIState(LoginState.Out); } else { TryRockBind(); } }; // if they forgot their password, kick them out to the forgot password page ForgotPasswordButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(ForgotPasswordButton); ControlStyling.StyleButton(ForgotPasswordButton, LoginStrings.ForgotPasswordButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ForgotPasswordButton.SizeToFit( ); ForgotPasswordButton.TouchUpInside += (object sender, EventArgs e) => { TaskWebViewController.HandleUrl(true, true, LoginConfig.ForgotPassword_Url, null, null, false, false, false); }; AdditionalOptions = new UILabel( ); ScrollView.AddSubview(AdditionalOptions); ControlStyling.StyleUILabel(AdditionalOptions, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); AdditionalOptions.Text = LoginStrings.AdditionalOptions; AdditionalOptions.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor); AdditionalOptions.SizeToFit( ); OrSpacerLabel = new UILabel( ); ScrollView.AddSubview(OrSpacerLabel); ControlStyling.StyleUILabel(OrSpacerLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); OrSpacerLabel.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor); OrSpacerLabel.Text = LoginStrings.OrString; OrSpacerLabel.SizeToFit( ); RegisterButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(RegisterButton); ControlStyling.StyleButton(RegisterButton, LoginStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); //RegisterButton.BackgroundColor = UIColor.Clear; RegisterButton.SizeToFit( ); RegisterButton.TouchUpInside += (object sender, EventArgs e) => { Springboard.RegisterNewUser( ); }; // setup the result LoginResult = new StyledTextField( ); ScrollView.AddSubview(LoginResult.Background); ControlStyling.StyleTextField(LoginResult.Field, "", ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); ControlStyling.StyleBGLayer(LoginResult.Background); LoginResult.Field.UserInteractionEnabled = false; LoginResult.Field.TextAlignment = UITextAlignment.Center; // setup the facebook button FacebookLogin = new UIButton( ); ScrollView.AddSubview(FacebookLogin); string imagePath = NSBundle.MainBundle.BundlePath + "/" + "facebook_login.png"; FBImageView = new UIImageView(new UIImage(imagePath)); FacebookLogin.SetTitle("", UIControlState.Normal); FacebookLogin.AddSubview(FBImageView); FacebookLogin.Layer.CornerRadius = 4; FBImageView.Layer.CornerRadius = 4; FacebookLogin.TouchUpInside += (object sender, EventArgs e) => { TryFacebookBind(); }; // If cancel is pressed, notify the springboard we're done. CancelButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(CancelButton); CancelButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor), UIControlState.Normal); CancelButton.SetTitle(GeneralStrings.Cancel, UIControlState.Normal); CancelButton.SizeToFit( ); CancelButton.TouchUpInside += (object sender, EventArgs e) => { // don't allow canceling while we wait for a web request. if (LoginState.Trying != State) { Springboard.ResignModelViewController(this, null); } }; // set the title image for the bar if there's no safe area defined. (A safe area is like, say, the notch for iPhone X) nfloat safeAreaTopInset = 0; // Make sure they're on iOS 11 before checking for insets. This is only needed for iPhone X anyways, which shipped with iOS 11. if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { safeAreaTopInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Top; } // setup the fake header if they're not on a device with save zones (iphone x) if (safeAreaTopInset == 0) { HeaderView = new UIView( ); View.AddSubview(HeaderView); HeaderView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); imagePath = NSBundle.MainBundle.BundlePath + "/" + PrivatePrimaryNavBarConfig.LogoFile_iOS; LogoView = new UIImageView(new UIImage(imagePath)); LogoView.SizeToFit( ); LogoView.Layer.AnchorPoint = CGPoint.Empty; HeaderView.AddSubview(LogoView); HeaderView.SizeToFit( ); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Login, container, false); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); view.SetOnTouchListener(this); RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout); navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels); BlockerView = new UIBlockerView(view, bounds); LoginResultLayer = view.FindViewById <View>(Resource.Id.result_background); ControlStyling.StyleBGLayer(LoginResultLayer); LoginResultLayer.Alpha = 0.0f; LoginButton = view.FindViewById <Button>(Resource.Id.loginButton); ControlStyling.StyleButton(LoginButton, LoginStrings.LoginButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LoginButton.Click += (object sender, EventArgs e) => { TryRockBind( ); }; CancelButton = view.FindViewById <Button>(Resource.Id.cancelButton); ControlStyling.StyleButton(CancelButton, GeneralStrings.Cancel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); CancelButton.Background = null; CancelButton.Click += (object sender, EventArgs e) => { SpringboardParent.ModalFragmentDone(null); }; TextView additionalOptions = view.FindViewById <TextView>(Resource.Id.additionalOptions); ControlStyling.StyleUILabel(additionalOptions, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); additionalOptions.Text = LoginStrings.AdditionalOptions; TextView orTextView = view.FindViewById <TextView>(Resource.Id.orTextView); ControlStyling.StyleUILabel(orTextView, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); orTextView.Text = LoginStrings.OrString; RegisterButton = view.FindViewById <Button>(Resource.Id.registerButton); ControlStyling.StyleButton(RegisterButton, LoginStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); RegisterButton.Click += (object sender, EventArgs e) => { SpringboardParent.ModalFragmentDone(null); SpringboardParent.RegisterNewUser( ); }; ForgotPasswordButton = view.FindViewById <Button>(Resource.Id.forgotPasswordButton); ControlStyling.StyleButton(ForgotPasswordButton, LoginStrings.ForgotPasswordButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); ForgotPasswordButton.Click += (object sender, EventArgs e) => { TaskWebFragment.HandleUrl(true, true, LoginConfig.ForgotPassword_Url, null, null); }; // get the username field and background UsernameLayer = view.FindViewById <View>(Resource.Id.login_background); ControlStyling.StyleBGLayer(UsernameLayer); UsernameField = view.FindViewById <EditText>(Resource.Id.usernameText); UserNameBGColor = ControlStylingConfig.BG_Layer_Color; ControlStyling.StyleTextField(UsernameField, LoginStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); View borderView = UsernameLayer.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // get the password field and background PasswordLayer = view.FindViewById <View>(Resource.Id.password_background); ControlStyling.StyleBGLayer(PasswordLayer); PasswordField = view.FindViewById <EditText>(Resource.Id.passwordText); PasswordBGColor = ControlStylingConfig.BG_Layer_Color; ControlStyling.StyleTextField(PasswordField, LoginStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LoginResultLabel = view.FindViewById <TextView>(Resource.Id.loginResult); ControlStyling.StyleUILabel(LoginResultLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); // Setup the facebook button FacebookButton = view.FindViewById <ImageButton>(Resource.Id.facebookButton); FacebookButton.Background = null; FacebookButton.Click += (object sender, EventArgs e) => { TryFacebookBind( ); }; // invoke a webview WebLayout = new WebLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); WebLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); WebLayout.SetBackgroundColor(Android.Graphics.Color.Black); return(view); }