void AnimateToPanel(IMemberPanel fromPanel, CGPoint fromPanelEndPos, IMemberPanel toPanel) { ScrollView.SetContentOffset(CGPoint.Empty, true); // animate OUT the from panel (sending it to its endPos) SimpleAnimator_PointF fromPanelAnim = new SimpleAnimator_PointF(fromPanel.GetRootView( ).Layer.Position.ToPointF( ), fromPanelEndPos.ToPointF( ), .33f, delegate(float percent, object value) { fromPanel.GetRootView( ).Layer.Position = (PointF)value; }, null); fromPanelAnim.Start(SimpleAnimator.Style.CurveEaseOut); // animate IN the toPanel (which we know goes to 0,0 ) SimpleAnimator_PointF toPanelAnim = new SimpleAnimator_PointF(toPanel.GetRootView( ).Layer.Position.ToPointF( ), CGPoint.Empty.ToPointF( ), .33f, delegate(float percent, object value) { toPanel.GetRootView( ).Layer.Position = (PointF)value; }, delegate { ActivePanel = toPanel; ViewDidLayoutSubviews( ); }); toPanelAnim.Start(SimpleAnimator.Style.CurveEaseOut); }
public void PresentAnimated(int workingFamilyId, bool browsingPeople, FamilyInfoViewController.OnBrowsePeopleCompleteDelegate onComplete) { KeyboardAdjustManager.Activate( ); WorkingFamilyId = workingFamilyId; OnCompleteDelegate = onComplete; // default to false RemoveFromOtherFamilies = false; // always begin at the SearchPanel SearchPanel.GetRootView( ).Layer.Position = CGPoint.Empty; PeoplePanel.GetRootView( ).Layer.Position = new CGPoint(MainPanel.Bounds.Width, 0); // use the provided bool to set the correct panel visible PeoplePanel.GetRootView( ).Hidden = !browsingPeople; ActivePanel = SearchPanel; View.Hidden = false; // animate the background to dark BackgroundPanel.Layer.Opacity = 0; SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(BackgroundPanel.Layer.Opacity, Settings.DarkenOpacity, .33f, delegate(float percent, object value) { BackgroundPanel.Layer.Opacity = (float)value; }, null); alphaAnim.Start(SimpleAnimator.Style.CurveEaseOut); // animate in the main panel MainPanel.Layer.Position = new CoreGraphics.CGPoint((View.Bounds.Width - MainPanel.Bounds.Width) / 2, View.Bounds.Height); // animate UP the main panel nfloat visibleHeight = Parent.GetVisibleHeight( ); PointF endPos = new PointF((float)(View.Bounds.Width - MainPanel.Bounds.Width) / 2, (float)(visibleHeight - MainPanel.Bounds.Height) / 2); SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF(MainPanel.Layer.Position.ToPointF( ), endPos, .33f, delegate(float percent, object value) { MainPanel.Layer.Position = (PointF)value; }, delegate { SearchPanel.PerformSearch( ); }); posAnim.Start(SimpleAnimator.Style.CurveEaseOut); }
void DismissAnimated(bool didSave, object returnContext) { // guard against multiple dismiss requests if (IsDismissing == false) { IsDismissing = true; // run an animation that will dismiss our view, and then remove // ourselves from the hierarchy SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(BackgroundPanel.Layer.Opacity, .00f, .33f, delegate(float percent, object value) { BackgroundPanel.Layer.Opacity = (float)value; }, null); alphaAnim.Start(SimpleAnimator.Style.CurveEaseOut); // animate OUT the main panel PointF endPos = new PointF((float)(View.Bounds.Width - MainPanel.Bounds.Width) / 2, (float)View.Bounds.Height); SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF(MainPanel.Layer.Position.ToPointF( ), endPos, .33f, delegate(float percent, object value) { MainPanel.Layer.Position = (PointF)value; }, delegate { // hide ourselves View.Hidden = true; IsDismissing = false; KeyboardAdjustManager.Deactivate( ); OnCompleteDelegate(didSave, WorkingFamilyId, returnContext); }); posAnim.Start(SimpleAnimator.Style.CurveEaseOut); } }
void PerformCampusIntro( ) { LayoutChanged( View.Frame ); // Fade OUT the welcome SimpleAnimator_Float animDown = new SimpleAnimator_Float( 1.00f, .15f, 2.00f, delegate(float percent, object value ) { WelcomeLabel.Opacity = (float)value; }, null ); animDown.Start( ); // Move UP the welcome SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF( WelcomeLabel.Position, new PointF( WelcomeLabel.Position.X, View.Frame.Height * WelcomeHeightPerc ), 1.75f, delegate(float posPercent, object posValue ) { WelcomeLabel.Position = (PointF) posValue; }, delegate { // once moving up the welcome is done, kick off a timer that will fade in the // campus header. System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 1000; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) => { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { // now fade in the campuses intro. SimpleAnimator_Float campusAnim = new SimpleAnimator_Float( 0.00f, 1.00f, 1.50f, delegate(float percent, object value ) { CampusHeader.Opacity = (float)value; }, delegate { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { EnterNextState( OOBE_State.SelectCampus ); }); } ); campusAnim.Start( ); }); }; timer.Start( ); }); posAnim.Start( SimpleAnimator.Style.CurveEaseOut ); }
/*void PerformCampusIntro( ) * { * LayoutChanged( View.Frame ); * * // Fade OUT the welcome * SimpleAnimator_Float animDown = new SimpleAnimator_Float( 1.00f, .15f, 2.00f, delegate(float percent, object value ) * { * WelcomeLabel.Opacity = (float)value; * }, null ); * animDown.Start( ); * * // Move UP the welcome * SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF( WelcomeLabel.Position, new PointF( WelcomeLabel.Position.X, View.Frame.Height * WelcomeHeightPerc ), 1.75f, * delegate(float posPercent, object posValue ) * { * WelcomeLabel.Position = (PointF) posValue; * }, * delegate * { * // once moving up the welcome is done, kick off a timer that will fade in the * // campus header. * System.Timers.Timer timer = new System.Timers.Timer(); * timer.Interval = 1000; * timer.AutoReset = false; * timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) => * { * // do this ON the UI thread * Rock.Mobile.Threading.Util.PerformOnUIThread( delegate * { * // now fade in the campuses intro. * SimpleAnimator_Float campusAnim = new SimpleAnimator_Float( 0.00f, 1.00f, 1.50f, delegate(float percent, object value ) * { * CampusHeader.Opacity = (float)value; * }, * delegate * { * // do this ON the UI thread * Rock.Mobile.Threading.Util.PerformOnUIThread( delegate * { * EnterNextState( OOBE_State.SelectCampus ); * }); * } ); * campusAnim.Start( ); * }); * }; * timer.Start( ); * * }); * posAnim.Start( SimpleAnimator.Style.CurveEaseOut ); * } * * void PerformSelectCampus( ) * { * // IF THERE IS A COLLISION (i.e. no room) between the CampusHeader and CampusButtons, * // we will fade OUT the header and leave it up for longer. * bool fadeOutHeader = false; * float animTime = 2.00f; * if ( CampusButtons[ 0 ].Frame.Top <= CampusHeader.Frame.Bottom ) * { * fadeOutHeader = true; * animTime = 5.00f; * } * * // fade down the campus header and fade up the campuses. * SimpleAnimator_Float animDown = new SimpleAnimator_Float( 1.00f, .00f, animTime, delegate(float percent, object value ) * { * // IF THERE IS A COLLISION (i.e. no room) between the CampusHeader and CampusButtons, * // fade down the campus header and fade up the campuses. * if ( fadeOutHeader ) * { * CampusHeader.Opacity = (float)value; * } * }, * delegate * { * // now fade in the campuses * foreach( PlatformButton campusButton in CampusButtons ) * { * SimpleAnimator_Float campusAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) * { * campusButton.Opacity = (float)value; * }, * null ); * campusAnim.Start( ); * } * * // do this ON the UI thread * Rock.Mobile.Threading.Util.PerformOnUIThread( delegate * { * // immediately move to the next state (while the campuses are fading in) * EnterNextState( OOBE_State.WaitForCampus ); * }); * } ); * animDown.Start( SimpleAnimator.Style.CurveEaseIn ); * }*/ void PerformAccountChoice( ) { LayoutChanged(View.Frame); // Fade OUT the welcome SimpleAnimator_Float animDown = new SimpleAnimator_Float(1.00f, .15f, 2.00f, delegate(float percent, object value) { WelcomeLabel.Opacity = ( float )value; }, null); animDown.Start( ); // Move UP the welcome SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF(WelcomeLabel.Position, new PointF(WelcomeLabel.Position.X, View.Frame.Height * WelcomeHeightPerc), 1.75f, delegate(float posPercent, object posValue) { WelcomeLabel.Position = ( PointF )posValue; }, delegate { // once moving up the welcome is done, kick off a timer that will fade in the // campus header. System.Timers.Timer timer = new System.Timers.Timer( ); timer.Interval = 1000; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { // make sure we only begin fading in the account stuff ONCE, and not // for each button animating. Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { LayoutChanged(View.Frame); }); // now fade in Register SimpleAnimator_Float regAnim = new SimpleAnimator_Float(0.00f, 1.00f, .50f, delegate(float percent, object value) { RegisterButton.Opacity = ( float )value; }, delegate { // now Login SimpleAnimator_Float loginAnim = new SimpleAnimator_Float(0.00f, 1.00f, .50f, delegate(float percent, object value) { LoginButton.Opacity = ( float )value; }, delegate { // finally skip SimpleAnimator_Float skipAnim = new SimpleAnimator_Float(0.00f, 1.00f, .50f, delegate(float percent, object value) { SkipButton.Opacity = ( float )value; }, delegate { EnterNextState(OOBE_State.WaitForAccountChoice); AnimateRegSeperator( ); }); skipAnim.Start( ); }); loginAnim.Start( ); }); regAnim.Start( ); }); }; timer.Start( ); }); posAnim.Start(SimpleAnimator.Style.CurveEaseOut); /*SimpleAnimator_Float animDown = new SimpleAnimator_Float( 1.00f, 0.00f, 1.10f, delegate(float percent, object value ) * { * // take either the lowered alpha value OR the current opacity. That way if * // the header is already faded out we won't do anything. * CampusHeader.Opacity = Math.Min( (float)value, CampusHeader.Opacity ); * * foreach ( PlatformButton campusButton in CampusButtons ) * { * campusButton.Opacity = (float)value; * } * }, * delegate * { * // make sure we only begin fading in the account stuff ONCE, and not * // for each button animating. * if( accountFadeInBegan == false ) * { * Rock.Mobile.Threading.Util.PerformOnUIThread( delegate * { * LayoutChanged( View.Frame ); * } ); * * accountFadeInBegan = true; * * // now fade in Register * SimpleAnimator_Float regAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) * { * RegisterButton.Opacity = (float)value; * }, * delegate * { * // now Login * SimpleAnimator_Float loginAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) * { * LoginButton.Opacity = (float)value; * }, * delegate * { * // finally skip * SimpleAnimator_Float skipAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) * { * SkipButton.Opacity = (float)value; * }, * delegate * { * EnterNextState( OOBE_State.WaitForAccountChoice ); * AnimateRegSeperator( ); * }); * skipAnim.Start( ); * }); * loginAnim.Start( ); * } ); * regAnim.Start( ); * } * * } ); * animDown.Start( SimpleAnimator.Style.CurveEaseIn );*/ }
void SwitchActiveMemberView( BaseMemberPanel memberPanel ) { // don't change if the panel is already active if ( ActivePanel != memberPanel ) { // and don't do it if we're animating if ( Animating == false ) { // disable the toggle button until we're done animating AdultChildToggle.Enabled = false; Animating = true; // animate out the current, bring in the new SimpleAnimator_PointF activeOutAnim = new SimpleAnimator_PointF( ScrollView.Layer.Position.ToPointF( ), new PointF( (float)ScrollView.Layer.Position.X, (float)ScrollView.Bounds.Height * .95f ), .33f, delegate(float percent, object value ) { ScrollView.Layer.Position = (PointF)value; }, delegate { // set the new panel as active, and position it off screen. ActivePanel.GetRootView( ).Hidden = true; // copy the data from the currently active panel to the new one memberPanel.Copy( ActivePanel ); // now switch it ActivePanel = memberPanel; ActivePanel.GetRootView( ).Hidden = false; ViewDidLayoutSubviews( ); // now kick off the animate IN for the new panel SimpleAnimator_PointF activeInAnim = new SimpleAnimator_PointF( ScrollView.Layer.Position.ToPointF( ), new PointF( (float)ScrollView.Layer.Position.X, 0 ), .33f, delegate(float percent, object value ) { ScrollView.Layer.Position = (PointF)value; }, delegate { // and finally we're done animating. // re-enable the toggle button, and flag that we're no longer animating AdultChildToggle.Enabled = true; Animating = false; }); activeInAnim.Start( SimpleAnimator.Style.CurveEaseIn ); } ); activeOutAnim.Start( SimpleAnimator.Style.CurveEaseOut ); } } }
void DismissAnimated( bool didSave ) { // guard against multiple dismiss requests if ( IsDismissing == false ) { IsDismissing = true; // run an animation that will dismiss our view, and then remove // ourselves from the hierarchy SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float( BackgroundPanel.Layer.Opacity, .00f, .33f, delegate(float percent, object value ) { BackgroundPanel.Layer.Opacity = (float)value; }, null ); alphaAnim.Start( SimpleAnimator.Style.CurveEaseOut ); // animate OUT the main panel PointF endPos = new PointF( (float)( View.Bounds.Width - MainPanel.Bounds.Width ) / 2, (float)View.Bounds.Height ); SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF( MainPanel.Layer.Position.ToPointF( ), endPos, .33f, delegate(float percent, object value ) { MainPanel.Layer.Position = (PointF)value; }, delegate { // hide ourselves View.Hidden = true; // give the panels a chance to clean up any resources they need to ChildPanel.ViewWillDisappear( ); AdultPanel.ViewWillDisappear( ); IsDismissing = false; KeyboardAdjustManager.Deactivate( ); // if the active panel is the Child, then yes, they should be set as a child. bool isChild = ActivePanel == ChildPanel ? true : false; OnCompleteDelegate( didSave, WorkingFamilyId, isChild, WorkingPerson ); } ); posAnim.Start( SimpleAnimator.Style.CurveEaseOut ); } }
public void PresentAnimated( int workingFamilyId, string workingFamilyLastName, Rock.Client.Person workingPerson, bool isChild, Dictionary<string, Rock.Client.AttributeValue> attributeValues, NSData profilePicBuffer, List<Rock.Client.Family> allowedCheckinList, FamilyInfoViewController.OnPersonInfoCompleteDelegate onComplete ) { OnCompleteDelegate = onComplete; WorkingFamilyId = workingFamilyId; KeyboardAdjustManager.Activate( ); // take the provided person as our working person if ( workingPerson == null ) { IsNewPerson = true; WorkingPerson = new Rock.Client.Person( ); // since it's a new person, put the last name of the family in there. WorkingPerson.LastName = workingFamilyLastName; } else { IsNewPerson = false; WorkingPerson = workingPerson; } // we need to know now what values AREN'T set, so we don't inadvertantly set them to defaults. WorkingPhoneNumber = RockActions.TryGetPhoneNumber( WorkingPerson, RockActions.CellPhoneValueId ); if ( WorkingPhoneNumber == null ) { IsNewPhoneNumber = true; WorkingPhoneNumber = new Rock.Client.PhoneNumber(); } else { IsNewPhoneNumber = false; } PersonInfoToUI( WorkingPerson, WorkingPhoneNumber, isChild, attributeValues, allowedCheckinList ); // set their profile picture UpdateProfilePic( profilePicBuffer ); View.Hidden = false; // animate the background to dark BackgroundPanel.Layer.Opacity = 0; SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float( BackgroundPanel.Layer.Opacity, Settings.DarkenOpacity, .33f, delegate(float percent, object value ) { BackgroundPanel.Layer.Opacity = (float)value; }, null ); alphaAnim.Start( SimpleAnimator.Style.CurveEaseOut ); // update the main panel MainPanel.Layer.Position = new CoreGraphics.CGPoint( ( View.Bounds.Width - MainPanel.Bounds.Width ) / 2, View.Bounds.Height ); // animate UP the main panel nfloat visibleHeight = Parent.GetVisibleHeight( ); PointF endPos = new PointF( (float)( View.Bounds.Width - MainPanel.Bounds.Width ) / 2, (float)( visibleHeight - MainPanel.Bounds.Height ) / 2 ); SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF( MainPanel.Layer.Position.ToPointF( ), endPos, .33f, delegate(float percent, object value ) { MainPanel.Layer.Position = (PointF)value; }, null); posAnim.Start( SimpleAnimator.Style.CurveEaseOut ); ViewDidLayoutSubviews( ); }
void AnimateNoteIcon( bool open ) { if ( Animating == false ) { Animating = true; SizeF startSize = NoteIcon.Bounds.Size; SizeF endSize; PointF startPos = NoteIcon.Position; PointF endPos = GetNoteIconPos( open ); float startTypeSize; float endTypeSize; float animTime = .2f; // the text must always be smaller than the bounding box, // so we'll scale the typeSize anim time to be FASTER when opening // and SLOWER when closing. float sizeAnimTimeScalar; // setup the target values based on whether we're opening or closing if ( open == true ) { endSize = NoteIconOpenSize; startTypeSize = PrivateNoteConfig.UserNote_IconClosedSize; endTypeSize = PrivateNoteConfig.UserNote_IconOpenSize; sizeAnimTimeScalar = .95f; } else { endSize = NoteIconClosedSize; startTypeSize = PrivateNoteConfig.UserNote_IconOpenSize; endTypeSize = PrivateNoteConfig.UserNote_IconClosedSize; sizeAnimTimeScalar = 1.05f; } // size... SimpleAnimator_SizeF sizeAnimator = new SimpleAnimator_SizeF( startSize, endSize, animTime, delegate(float percent, object value ) { SizeF currSize = (SizeF)value; NoteIcon.Bounds = new RectangleF( 0, 0, currSize.Width, currSize.Height ); }, null ); sizeAnimator.Start( ); // pos... SimpleAnimator_PointF posAnimator = new SimpleAnimator_PointF( startPos, endPos, animTime, delegate(float percent, object value ) { NoteIcon.Position = (PointF)value; }, null ); posAnimator.Start( ); // font typesize... SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float( startTypeSize, endTypeSize, animTime * sizeAnimTimeScalar, delegate(float percent, object value ) { NoteIcon.SetFont( PrivateControlStylingConfig.Icon_Font_Secondary, (float)value ); }, delegate { Animating = false; } ); floatAnimator.Start( ); } }
void AnimateNoteIcon(bool open) { SizeF startSize = NoteIcon.Bounds.Size; SizeF endSize; PointF startPos = NoteIcon.Position; PointF endPos = GetNoteIconPos(open); float startTypeSize; float endTypeSize; float animTime = .2f; // the text must always be smaller than the bounding box, // so we'll scale the typeSize anim time to be FASTER when opening // and SLOWER when closing. float sizeAnimTimeScalar; // setup the target values based on whether we're opening or closing if (open == true) { endSize = NoteIconOpenSize; startTypeSize = PrivateNoteConfig.UserNote_IconClosedSize; endTypeSize = PrivateNoteConfig.UserNote_IconOpenSize; sizeAnimTimeScalar = .95f; } else { endSize = NoteIconClosedSize; startTypeSize = PrivateNoteConfig.UserNote_IconOpenSize; endTypeSize = PrivateNoteConfig.UserNote_IconClosedSize; sizeAnimTimeScalar = 1.05f; } // size... SimpleAnimator_SizeF sizeAnimator = new SimpleAnimator_SizeF(startSize, endSize, animTime, delegate(float percent, object value) { SizeF currSize = (SizeF)value; NoteIcon.Bounds = new RectangleF(0, 0, currSize.Width, currSize.Height); }, null); sizeAnimator.Start( ); // pos... SimpleAnimator_PointF posAnimator = new SimpleAnimator_PointF(startPos, endPos, animTime, delegate(float percent, object value) { NoteIcon.Position = (PointF)value; }, null); posAnimator.Start( ); // font typesize... SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(startTypeSize, endTypeSize, animTime * sizeAnimTimeScalar, delegate(float percent, object value) { NoteIcon.SetFont(PrivateControlStylingConfig.Icon_Font_Secondary, (float)value); }, null); floatAnimator.Start( ); }
void PerformRevealControls( ) { // this will be fun. Chain the animations so they go serially. Start with moving up Welcome // now animate it down to a lighter color SimpleAnimator_Float animDown = new SimpleAnimator_Float( 1.00f, .15f, 1.10f, delegate(float percent, object value ) { WelcomeLabel.Opacity = (float)value; }, null ); animDown.Start( ); SimpleAnimator_PointF posAnim = new SimpleAnimator_PointF( WelcomeLabel.Position, new PointF( WelcomeLabel.Position.X, View.Frame.Height * .25f ), .55f, delegate(float posPercent, object posValue ) { WelcomeLabel.Position = (PointF) posValue; }, delegate { // now fade in Register SimpleAnimator_Float regAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) { RegisterButton.Opacity = (float)value; }, delegate { // now Login SimpleAnimator_Float loginAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) { LoginButton.Opacity = (float)value; }, delegate { // finally skip SimpleAnimator_Float skipAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) { SkipButton.Opacity = (float)value; }, delegate { EnterNextState( OOBE_State.Done ); AnimateRegSeperator( ); }); skipAnim.Start( ); }); loginAnim.Start( ); } ); regAnim.Start( ); }); posAnim.Start( ); }