public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); ViewActive = true; Carousel.Hidden = false; // this will prevent double requests in the case that we leave and return to the prayer // page before the initial request completes if (RequestingPrayers == false) { TimeSpan deltaTime = DateTime.Now - LastDownload; if (deltaTime.TotalHours > PrivatePrayerConfig.PrayerDownloadFrequency.TotalHours) { BlockerView.BringToFront( ); Rock.Mobile.Util.Debug.WriteLine("Grabbing Prayers"); RetrievePrayerRequests( ); } else { Rock.Mobile.Util.Debug.WriteLine("Not getting prayers."); // add a read analytic PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Read); } } }
public override void LayoutChanged( ) { base.LayoutChanged( ); ScrollView.Bounds = View.Bounds; SearchPage.LayoutChanged(ScrollView.Frame.ToRectF( )); // Map MapView.Frame = new CGRect(0, 0, ScrollView.Frame.Width, ScrollView.Frame.Height * .40f); SearchAddressButton.Frame = new CGRect(0, MapView.Frame.Bottom, ScrollView.Frame.Width, 33); // Search Results Banner UpdateResultsBanner( ); // add the seperator to the bottom Seperator.Frame = new CGRect(0, SearchResultsPrefix.Frame.Bottom - 1, ScrollView.Bounds.Width, 1); // wait to layout the table view until all subviews have been laid out. Fixes an issue where the table gets more height than it should, // and the last row doesn't fit on screen. GroupFinderTableView.Frame = new CGRect(0, Seperator.Frame.Bottom, ScrollView.Bounds.Width, ScrollView.Bounds.Height - Seperator.Frame.Bottom); GroupFinderTableView.ReloadData( ); BlockerView.SetBounds(ScrollView.Frame.ToRectF( )); }
public override void LayoutChanged() { base.LayoutChanged(); ResultView.SetBounds(View.Bounds.ToRectF( )); BlockerView.SetBounds(View.Bounds.ToRectF( )); }
void GetAdditionalGroups( ) { if (RetrievingGroups == false) { RetrievingGroups = true; BlockerView.Show(delegate { GroupFinder.GetGroups(GroupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { RetrievingGroups = false; // for additional groups, only take action if we got something back. if (result) { // increment our index to the next set, or the end of the list, whichever is less // this will ensure when we hit the end of the list, CurrGroupIndex reflects that. CurrGroupIndex += Math.Min(groupEntries.Count, NumRequestedGroups); GroupEntries.AddRange(groupEntries); UpdateMap(true); } }); }); }); } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); }
void RetrieveBiblePassage( ) { ResultView.Hide( ); BlockerView.Show(delegate { RequestingBiblePassage = true; BibleRenderer.RetrieveBiblePassage(BibleAddress, delegate(string htmlStream) { // if it worked, take the html stream and store it if (string.IsNullOrWhiteSpace(htmlStream) == false) { PassageHTML = htmlStream; BibleWebView.LoadHtmlString(PassageHTML, NSBundle.MainBundle.BundleUrl); } else { // otherwise display an error ResultView.Show(GeneralStrings.Network_Status_FailedText, PrivateControlStylingConfig.Result_Symbol_Failed, GeneralStrings.Network_Result_FailedText, GeneralStrings.Retry); } RequestingBiblePassage = false; BlockerView.Hide(null); }); }); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); // set the search field and refresh button, cause those are known SearchField.Layer.Position = new CGPoint(10, 25); SearchField.ViewDidLayoutSubviews(new CGRect(0, 0, View.Bounds.Width * 0.3375f, View.Bounds.Height)); // position the clear button ClearButton.SizeToFit( ); ClearButton.Bounds = new CGRect(0, 0, ClearButton.Bounds.Width * 2, SearchButton.Bounds.Height); ClearButton.Layer.Position = new CGPoint(SearchField.Frame.Right - ClearButton.Bounds.Width, SearchField.Frame.Bottom + 10); // now set the search button, which will use remaining width SearchButton.Layer.Position = new CGPoint(10, SearchField.Frame.Bottom + 10); SearchButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, 0); SearchButton.SizeToFit( ); SearchButton.Frame = new CGRect(10, SearchField.Frame.Bottom + 10, SearchField.Bounds.Width - ClearButton.Bounds.Width - 2, SearchButton.Bounds.Height); // position the 'add family' button AddFamilyButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, SearchButton.Bounds.Height); AddFamilyButton.Layer.Position = new CGPoint(SearchButton.Frame.Left, SearchButton.Frame.Bottom + 10); // setup the table view nfloat tableXPos = SearchField.Frame.Right + 10; TableView.Frame = new CGRect(tableXPos, SearchField.Layer.Position.Y, View.Bounds.Width - tableXPos, View.Bounds.Height); TableView.SetNeedsLayout( ); BlockerView.SetBounds(View.Bounds.ToRectF( )); }
void SubmitPrayerRequest( ) { ResultView.Show(PrayerStrings.PostPrayer_Status_Submitting, "", "", ""); Success = false; Posting = true; // hide the toolbar while submitting if (Task != null) { Task.NavToolbar.Reveal(false); } // fade in our blocker, and when it's complete, send our request off BlockerView.Show(delegate { // sleep this thread for a second to give an appearance of submission System.Threading.Thread.Sleep(1000); // submit the request RockApi.Post_PrayerRequests(PrayerRequest, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { Posting = false; // if they left while posting, screw em. if (IsActive == true) { BlockerView.Hide(null); // show the toolbar for them. Task.NavToolbar.Reveal(true); if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { Success = true; ResultView.Show(PrayerStrings.PostPrayer_Status_SuccessText, PrivateControlStylingConfig.Result_Symbol_Success, PrayerStrings.PostPrayer_Result_SuccessText, GeneralStrings.Done); PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Create); } else { Success = false; ResultView.Show(PrayerStrings.PostPrayer_Status_FailedText, PrivateControlStylingConfig.Result_Symbol_Failed, PrayerStrings.PostPrayer_Result_FailedText, GeneralStrings.Retry); } } }); }); }
void PerformSearch( ) { // only let them submit if they have something beyond "http://" (or some other short crap) if (RockUrlField.Text.IsValidURL( )) { // hide the keyboard RockUrlField.ResignFirstResponder( ); // disable until we're done Submit.Enabled = false; BlockerView.BringToFront( ); BlockerView.Show(delegate { // see if Rock exists at this endpoint ApplicationApi.IsRockAtURL(RockUrlField.Text, delegate(HttpStatusCode statusCode, string statusDesc) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { // attempt to contact Rock and get all the required information. Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text, delegate(bool result) { // it worked, so Rock is valid. if (result == true) { // take these as our values. Config.Instance.CommitRockSync( ); Config.Instance.SetConfigurationDefinedValue(Config.Instance.ConfigurationTemplates[0], delegate(bool configResult) { if (configResult == true) { HandlePerformSearchResult(true, Strings.General_RockBindSuccess); } else { // ROCK DATA ERROR HandlePerformSearchResult(false, Strings.General_RockBindError_Data); } }); } else { // ROCK DATA ERROR HandlePerformSearchResult(false, Strings.General_RockBindError_Data); } }); } else { // Rock NOT FOUND HandlePerformSearchResult(false, Strings.General_RockBindError_NotFound); } }); }); } }
protected void SetUIState(LoginState state) { // reset the result label LoginResult.Field.Text = ""; switch (state) { case LoginState.Out: { UserNameField.Field.Enabled = true; PasswordField.Field.Enabled = true; LoginButton.Enabled = true; CancelButton.Enabled = true; RegisterButton.Hidden = false; RegisterButton.Enabled = true; LoginButton.SetTitle(LoginStrings.LoginButton, UIControlState.Normal); break; } case LoginState.Trying: { FadeLoginResult(false); BlockerView.Show(null); BlockerView.BringToFront( ); UserNameField.Field.Enabled = false; PasswordField.Field.Enabled = false; LoginButton.Enabled = false; CancelButton.Enabled = false; RegisterButton.Enabled = false; LoginButton.SetTitle(LoginStrings.LoginButton, UIControlState.Normal); break; } // Deprecated state case LoginState.In: { UserNameField.Field.Enabled = false; PasswordField.Field.Enabled = false; LoginButton.Enabled = true; CancelButton.Enabled = true; RegisterButton.Hidden = true; RegisterButton.Enabled = false; LoginButton.SetTitle("Logout", UIControlState.Normal); break; } } State = state; }
void DownloadRockValues( ) { // only let them submit if they have something beyond "http://" (or some other short crap) if (RockUrlField.Text.IsValidURL( ) == true) { // hide the keyboard RockUrlField.ResignFirstResponder( ); // disable until we're done Sync.Enabled = false; ToggleSaveButton(false); BlockerView.BringToFront( ); BlockerView.Show(delegate { // see if Rock is AT this server. ApplicationApi.IsRockAtURL(RockUrlField.Text, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { // attempt to contact Rock and get all the required information. Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text, delegate(bool result) { // it worked, so Rock is valid. if (result == true) { ConfigurationTemplates = Config.Instance.TempConfigurationTemplates; Campuses = Config.Instance.TempCampuses; HandleDownloadResult(Strings.General_RockBindSuccess); } else { // error - clear the lists ClearLists( ); HandleDownloadResult(Strings.General_RockBindError_Data); } }); } else { BlockerView.Hide( delegate { // error - clear the lists ClearLists( ); HandleDownloadResult(Strings.General_RockBindError_NotFound); }); } }); }); } }
void RegisterUser() { if (State == RegisterState.None) { // make sure they entered all required fields if (ValidateInput( )) { BlockerView.Show( delegate { // force the UI to scroll back up ScrollView.ContentOffset = CGPoint.Empty; ScrollView.ScrollEnabled = false; State = RegisterState.Trying; // create a new user and submit them Rock.Client.Person newPerson = new Rock.Client.Person(); // copy all the edited fields into the person object newPerson.Email = EmailText.Field.Text; // set both the nick name and first name to NickName newPerson.NickName = NickNameText.Field.Text; newPerson.FirstName = NickNameText.Field.Text; newPerson.LastName = LastNameText.Field.Text; MobileAppApi.RegisterNewUser(UserNameText.Field.Text, PasswordText.Field.Text, NickNameText.Field.Text, LastNameText.Field.Text, EmailText.Field.Text, CellPhoneText.Field.Text, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true) { ProfileAnalytic.Instance.Trigger(ProfileAnalytic.Register); State = RegisterState.Success; ResultView.Show(RegisterStrings.RegisterStatus_Success, PrivateControlStylingConfig.Result_Symbol_Success, RegisterStrings.RegisterResult_Success, GeneralStrings.Done); } else { State = RegisterState.Fail; ResultView.Show(RegisterStrings.RegisterStatus_Failed, PrivateControlStylingConfig.Result_Symbol_Failed, statusDescription, GeneralStrings.Done); } BlockerView.Hide(null); }); }); } } }
void HandlePerformSearchResult(bool result, string description) { // unhide the blocker BlockerView.Hide( delegate { Submit.Enabled = true; DisplayResult(result, description); }); }
void UIThread_LoginComplete(System.Net.HttpStatusCode code, string desc) { BlockerView.Hide(delegate { switch (code) { case System.Net.HttpStatusCode.OK: { // see if we should set their viewing campus if (RockMobileUser.Instance.PrimaryFamily.CampusId.HasValue == true) { RockMobileUser.Instance.ViewingCampus = RockMobileUser.Instance.PrimaryFamily.CampusId.Value; } // if they have a profile picture, grab it. RockMobileUser.Instance.TryDownloadProfilePicture(PrivateGeneralConfig.ProfileImageSize, ProfileImageComplete); // hide the activity indicator, because we are now logged in, // but leave the buttons all disabled. //LoginActivityIndicator.Visibility = ViewStates.Gone; BlockerView.Hide( ); // update the UI FadeLoginResult(true); LoginResultLabel.Text = string.Format(LoginStrings.Success, RockMobileUser.Instance.PreferredName( )); // start the timer, which will notify the springboard we're logged in when it ticks. LoginSuccessfulTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // when the timer fires, notify the springboard we're done. Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { SpringboardParent.ModalFragmentDone(null); }); }; LoginSuccessfulTimer.Start( ); break; } default: { // if we couldn't get their profile, that should still count as a failed login. SetUIState(LoginState.Out); FadeLoginResult(true); LoginResultLabel.Text = LoginStrings.Error_Unknown; RockMobileUser.Instance.LogoutAndUnbind( ); break; } } }); }
void GetInitialGroups(int groupTypeId, string streetValue, string cityValue, string stateValue, string zipValue) { if (RetrievingGroups == false) { // since this is the first search for the new address, get initial values // so that if they leave the page and return, we can re-populate them. StreetValue = SearchPage.Street.Text; CityValue = SearchPage.City.Text; StateValue = SearchPage.State.Text; ZipValue = SearchPage.ZipCode.Text; RetrievingGroups = true; BlockerView.Show(delegate { GroupTypeId = groupTypeId; CurrGroupIndex = 0; GroupFinder.GetGroups(groupTypeId, streetValue, cityValue, stateValue, zipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { RetrievingGroups = false; SourceLocation = sourceLocation; GroupEntries = groupEntries; UpdateMap(result); // if the result was valid string address = StreetValue + " " + CityValue + ", " + StateValue + ", " + ZipValue; if (result) { // take the lesser of the two. The number we requested, or the amount returned, because // it's possible there weren't as many as we requested. CurrGroupIndex = Math.Min(NumRequestedGroups, groupEntries.Count); // record an analytic that they searched GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.Location, address); //GroupFinderAnalytic.Instance.Trigger( GroupFinderAnalytic.Neighborhood, GroupEntries[ 0 ].NeighborhoodArea ); } else { // record an analytic that this address failed GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.OutOfBounds, address); } }); }); }); } }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight); ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height); NickName.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); LastName.SetFrame(new CGRect(-10, NickName.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Email.SetFrame(new CGRect(-10, LastName.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); CellPhone.SetFrame(new CGRect(-10, Email.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Street.SetFrame(new CGRect(-10, CellPhone.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); City.SetFrame(new CGRect(-10, Street.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); State.SetFrame(new CGRect(-10, City.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Zip.SetFrame(new CGRect(-10, State.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); Gender.SetFrame(new CGRect(-10, Zip.Background.Frame.Bottom + 20, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); GenderButton.Frame = Gender.Background.Frame; Birthdate.SetFrame(new CGRect(-10, Gender.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); BirthdayButton.Frame = Birthdate.Background.Frame; HomeCampus.SetFrame(new CGRect(-10, Birthdate.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); HomeCampusButton.Frame = HomeCampus.Background.Frame; DoneButton.Frame = new CGRect(View.Frame.Left + 10, HomeCampus.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight); LogoutButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight); nfloat controlBottom = LogoutButton.Frame.Bottom + (View.Bounds.Height * .25f); ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f)); // setup the header shadow UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds); HeaderView.Layer.MasksToBounds = false; HeaderView.Layer.ShadowColor = UIColor.Black.CGColor; HeaderView.Layer.ShadowOffset = new CGSize(0.0f, .0f); HeaderView.Layer.ShadowOpacity = .23f; HeaderView.Layer.ShadowPath = shadowPath.CGPath; if (LogoView != null) { LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0); } BirthdatePicker.LayoutChanged( ); GenderPicker.LayoutChanged( ); GenderPicker.TogglePicker(false, false); BirthdatePicker.TogglePicker(false, false); }
void UIThread_LoginComplete(System.Net.HttpStatusCode code, string desc) { BlockerView.Hide(delegate { switch (code) { case System.Net.HttpStatusCode.OK: { // see if we should set their viewing campus if (RockMobileUser.Instance.PrimaryFamily.CampusId.HasValue == true) { RockMobileUser.Instance.ViewingCampus = RockMobileUser.Instance.PrimaryFamily.CampusId.Value; } // if they have a profile picture, grab it. RockMobileUser.Instance.TryDownloadProfilePicture(PrivateGeneralConfig.ProfileImageSize, ProfileImageComplete); // update the UI FadeLoginResult(true); LoginResult.Field.Text = string.Format(LoginStrings.Success, RockMobileUser.Instance.PreferredName( )); // start the timer, which will notify the springboard we're logged in when it ticks. LoginSuccessfulTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // when the timer fires, notify the springboard we're done. Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { Springboard.ResignModelViewController(this, null); }); }; LoginSuccessfulTimer.Start( ); break; } default: { // if we couldn't get their profile, that should still count as a failed login. SetUIState(LoginState.Out); // failed to login for some reason FadeLoginResult(true); LoginResult.Field.Text = LoginStrings.Error_Unknown; RockMobileUser.Instance.LogoutAndUnbind( ); break; } } }); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); Logo.Layer.Position = new CGPoint((View.Bounds.Width - Logo.Bounds.Width) / 2, 25); // Title RockUrlTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, View.Bounds.Height * .25f); // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it. RockUrlField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0); CGSize size = RockUrlField.SizeThatFits(new CGSize(RockUrlField.Bounds.Width, RockUrlField.Bounds.Height)); RockUrlField.Bounds = new CGRect(RockUrlField.Bounds.X, RockUrlField.Bounds.Y, RockUrlField.Bounds.Width, (float)System.Math.Ceiling(size.Height)); // center the rock URL field and title RockUrlField.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlTitle.Frame.Bottom + 5); // Title RockAuthKeyTitle.Layer.Position = new CGPoint((View.Bounds.Width - RockUrlField.Bounds.Width) / 2, RockUrlField.Frame.Bottom + 20); // because there's no placeholder, we can't SizeToFit the URL Field, so we'll measure the font and then size it. RockAuthKeyField.Bounds = new CGRect(0, 0, View.Bounds.Width * .75f, 0); size = RockAuthKeyField.SizeThatFits(new CGSize(RockAuthKeyField.Bounds.Width, RockAuthKeyField.Bounds.Height)); RockAuthKeyField.Bounds = new CGRect(RockAuthKeyField.Bounds.X, RockAuthKeyField.Bounds.Y, RockAuthKeyField.Bounds.Width, (float)System.Math.Ceiling(size.Height)); RockAuthKeyField.Layer.Position = new CGPoint((View.Bounds.Width - RockAuthKeyField.Bounds.Width) / 2, RockAuthKeyTitle.Frame.Bottom + 5); // Description RockUrlDesc.Layer.Position = new CGPoint(RockUrlField.Frame.Left, RockAuthKeyField.Frame.Bottom + 5); // set the blocker BlockerView.SetBounds(View.Bounds.ToRectF( )); // set the submit bounds and position Submit.SizeToFit( ); Submit.Bounds = new CGRect(0, 0, RockUrlField.Bounds.Width * .35f, Submit.Bounds.Height * 1.25f); Submit.Layer.Position = new CGPoint(RockUrlField.Frame.Left + ((RockUrlField.Bounds.Width - Submit.Bounds.Width) / 2), RockUrlDesc.Frame.Bottom + 60); // let the label stretch the entire width ResultLabel.Bounds = new CGRect(0, 0, View.Bounds.Width, 0); ResultLabel.SizeToFit( ); ResultLabel.Frame = new CGRect(0, Submit.Frame.Bottom + 30, View.Bounds.Width, ResultLabel.Bounds.Height); }
void SubmitPrayerRequest( ) { ResultView.Show(PrayerStrings.PostPrayer_Status_Submitting, "", "", ""); Success = false; Posting = true; // fade in our blocker, and when it's complete, send our request off BlockerView.Show(delegate { // submit the request RockApi.Post_PrayerRequests(PrayerRequest, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { Posting = false; // if they left while posting, screw em. if (IsActive == true) { BlockerView.Hide(null); if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { Success = true; ResultView.Show(PrayerStrings.PostPrayer_Status_SuccessText, PrivateControlStylingConfig.Result_Symbol_Success, PrayerStrings.PostPrayer_Result_SuccessText, GeneralStrings.Done); PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Create); } else { Success = false; ResultView.Show(PrayerStrings.PostPrayer_Status_FailedText, PrivateControlStylingConfig.Result_Symbol_Failed, PrayerStrings.PostPrayer_Result_FailedText, GeneralStrings.Retry); } } }); }); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); if (MapView != null) { MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f); } BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight); ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height); UserNameText.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); PasswordText.SetFrame(new CGRect(-10, UserNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); ConfirmPasswordText.SetFrame(new CGRect(-10, PasswordText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); NickNameText.SetFrame(new CGRect(-10, ConfirmPasswordText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); LastNameText.SetFrame(new CGRect(-10, NickNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); EmailText.SetFrame(new CGRect(-10, LastNameText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); CellPhoneText.SetFrame(new CGRect(-10, EmailText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight)); DoneButton.Frame = new CGRect(View.Frame.Left + 10, CellPhoneText.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight); CancelButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight); // for the scroll size, if the content is larger than the screen, we'll take the bottom // of the content plus some padding. Otherwise, we'll just use the window height plus a tiny bit so there's // a subtle scroll effect nfloat controlBottom = CancelButton.Frame.Bottom + (View.Bounds.Height * .25f); ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f)); // setup the header shadow UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds); HeaderView.Layer.MasksToBounds = false; HeaderView.Layer.ShadowColor = UIColor.Black.CGColor; HeaderView.Layer.ShadowOffset = new CGSize(0.0f, .0f); HeaderView.Layer.ShadowOpacity = .23f; HeaderView.Layer.ShadowPath = shadowPath.CGPath; if (LogoView != null) { LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0); } ResultView.SetBounds(View.Frame.ToRectF( )); BlockerView.SetBounds(View.Frame.ToRectF( )); }
public override void OnResume() { base.OnResume(); // 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?"); } SpringboardParent.ModalFragmentOpened(this); ResultView.Hide( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { RockMobileUser.Instance.GetPersonData(delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true) { ScrollView.ScrollEnabled = true; // show the latest profile info ModelToUI( ); } else { // show failure prompt ResultView.Show(ProfileStrings.ProfileErrorTitle, PrivateControlStylingConfig.Result_Symbol_Failed, ProfileStrings.ProfileErrorDesc, GeneralStrings.Ok); // if the result is "Not Found", then that means their login is no longer valid. Force a logout. if (statusCode == System.Net.HttpStatusCode.NotFound) { // then log them out. RockMobileUser.Instance.LogoutAndUnbind( ); } } BlockerView.Hide(null); }); }); }
public override void LayoutChanged( ) { base.LayoutChanged( ); // get the orientation state. WE consider unknown- 1, profile 0, landscape 1, int orientationState = SpringboardViewController.IsDeviceLandscape( ) == true ? 1 : 0; // if the states are in disagreement, correct it if (OrientationState != orientationState) { OrientationState = orientationState; BibleWebView.Frame = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height); BibleWebView.Layer.Position = new CGPoint(BibleWebView.Layer.Position.X, BibleWebView.Layer.Position.Y); BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); } }
void RefreshProfile( ) { // don't allow a double refresh, obviously. if (RefreshingProfile == false) { RefreshingProfile = true; ResultView.Hide( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { RockMobileUser.Instance.GetPersonData(delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { RefreshingProfile = false; if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true) { // show the latest profile info ModelToUI( ); } else { // show failure prompt ResultView.Show(ProfileStrings.ProfileErrorTitle, PrivateControlStylingConfig.Result_Symbol_Failed, ProfileStrings.ProfileErrorDesc, GeneralStrings.Ok); // if the result is "Not Found", then that means their login is no longer valid. Force a logout. if (statusCode == System.Net.HttpStatusCode.NotFound) { // then log them out. RockMobileUser.Instance.LogoutAndUnbind( ); } } BlockerView.Hide(null); }); }); } }
protected void SetUIState(LoginState state) { // reset the result label LoginResultLabel.Text = ""; switch (state) { case LoginState.Out: { //LoginActivityIndicator.Visibility = ViewStates.Gone; UsernameField.Enabled = true; PasswordField.Enabled = true; LoginButton.Enabled = true; CancelButton.Enabled = true; RegisterButton.Visibility = ViewStates.Visible; RegisterButton.Enabled = true; FacebookButton.Enabled = true; break; } case LoginState.Trying: { FadeLoginResult(false); BlockerView.Show( ); UsernameField.Enabled = false; PasswordField.Enabled = false; LoginButton.Enabled = false; CancelButton.Enabled = false; RegisterButton.Enabled = false; FacebookButton.Enabled = false; break; } } State = state; }
void GetAdditionalGroups( ) { if (Searching == false) { Searching = true; BlockerView.Show(delegate { GroupFinder.GetGroups(GroupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { Searching = false; if (result) { // increment our index to the next set, or the end of the list, whichever is less // this will ensure when we hit the end of the list, CurrGroupIndex reflects that. CurrGroupIndex += Math.Min(groupEntries.Count, NumRequestedGroups); // add in the new results GroupEntries.AddRange(groupEntries); // update the map UpdateMap(result); // and reload the table GroupFinderTableView.ReloadData( ); // since we're only loading additional groups, don't flag the // list as updated. We don't want it to reset to the top. GroupListUpdated = false; } }); }); }); } }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews( ); BlockerView.SetBounds(MainPanel.Bounds.ToRectF( )); BackgroundPanel.Bounds = View.Bounds; BackgroundPanel.Layer.Position = View.Layer.Position; // setup the scroll view and contents ScrollView.Bounds = MainPanel.Bounds; // layout the active view SearchPanel.ViewDidLayoutSubviews(MainPanel.Bounds); PeoplePanel.ViewDidLayoutSubviews(MainPanel.Bounds); CloseButton.Layer.Position = new CGPoint(MainPanel.Bounds.Width - CloseButton.Bounds.Width - 10, 5); nfloat scrollSize = Math.Max((float)ActivePanel.GetRootView( ).Frame.Bottom, (float)MainPanel.Bounds.Height) * 1.05f; ScrollView.ContentSize = new CGSize(MainPanel.Bounds.Width, scrollSize); }
public void PerformSearch( ) { if (SearchField.GetCurrentValue( ).Length > Settings.General_MinSearchLength) { // put the list at the top, so that when we refresh it, it correctly resizes each row TableView.SetContentOffset(CGPoint.Empty, true); SearchField.ResignFirstResponder( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { // search for the family RockApi.Get_Groups_FamiliesByPersonNameSearch(SearchField.GetCurrentValue( ), delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.Family> model) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0) { Families = model; } else { // error (or no results) Families = new List <Rock.Client.Family>( ); DidSearchFail = true; } // reload data ((TableSource)TableView.Source).FamiliesUpdated(TableView); TableView.ReloadData( ); BlockerView.Hide( ); }); }); } }
public override void LayoutChanged() { base.LayoutChanged(); 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); float cardYOffset = (viewRealHeight * .03f); // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right Carousel.LayoutChanged(cardWidth, cardHeight, new System.Drawing.RectangleF(0, cardYOffset, (float)View.Bounds.Width, viewRealHeight)); CardSize = new CGRect(0, 0, cardWidth, cardHeight); for (int i = 0; i < PrayerRequests.Count; i++) { PrayerRequests[i].LayoutChanged(CardSize.ToRectF( )); } BlockerView.SetBounds(View.Bounds.ToRectF( )); ResultView.SetBounds(View.Bounds.ToRectF( )); }
void RetrievePrayerRequests( ) { ResultView.Hide( ); BlockerView.Show(delegate { RequestingPrayers = true; // request the prayers each time this appears RockApi.Get_PrayerRequests_Public(delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.PrayerRequest> prayerRequests) { // force this onto the main thread so that if there's a race condition in requesting prayers we won't hit it. InvokeOnMainThread(delegate { // only process this if the view is still active. It's possible this request came in after we left the view. if (ViewActive == true) { PrayerRequests.Clear( ); Carousel.Clear( ); RequestingPrayers = false; BlockerView.Hide(null); // somestimes our prayers can be received with errors in the xml, so ensure we have a valid model. if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) && prayerRequests != null) { if (prayerRequests.Count > 0) { // sort the prayers based on prayer count (least prayed for first) prayerRequests.Sort(delegate(Rock.Client.PrayerRequest x, Rock.Client.PrayerRequest y) { if (x.PrayerCount < y.PrayerCount) { return(-1); } if (x.PrayerCount > y.PrayerCount) { return(1); } return(0); }); // update our timestamp since this was successful LastDownload = DateTime.Now; // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right for (int i = 0; i < Math.Min(prayerRequests.Count, PrivatePrayerConfig.MaxPrayers); i++) { PrayerCard card = new PrayerCard(prayerRequests[i], CardSize); PrayerRequests.Add(card); Carousel.AddCard(card.View); } } else { ResultView.Show(PrayerStrings.ViewPrayer_StatusText_NoPrayers, null, PrayerStrings.ViewPrayer_Result_NoPrayersText, GeneralStrings.Retry); } // add a read analytic PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Read); } else { ResultView.Show(PrayerStrings.ViewPrayer_StatusText_Failed, PrivateControlStylingConfig.Result_Symbol_Failed, PrayerStrings.Error_Retrieve_Message, GeneralStrings.Retry); Task.NavToolbar.SetCreateButtonEnabled(false); } } }); }); }); }