public override void AnimateOpen(bool becomeFirstResponder) { if (TextView.Animating == false && TextView.Hidden == true) { // unhide and flag it as animating TextView.Hidden = false; TextView.Animating = true; // and force it to a 0 size so it grows correctly TextView.Bounds = RectangleF.Empty; SimpleAnimator_SizeF animator = new SimpleAnimator_SizeF(TextView.Bounds.Size.ToSizeF( ), TextView.NaturalSize.ToSizeF( ), SCALE_TIME_SECONDS, delegate(float percent, object value) { SizeF currSize = (SizeF)value; TextView.Bounds = new RectangleF(0, 0, currSize.Width, currSize.Height); }, delegate { TextView.Animating = false; if (becomeFirstResponder == true) { BecomeFirstResponder( ); } }); animator.Start( ); } }
public void PerformStartup( ) { // Fade OUT the logo SimpleAnimator_Float imageAlphaAnim = new SimpleAnimator_Float(ImageLogo.Opacity, 0.00f, .13f, delegate(float percent, object value) { ImageLogo.Opacity = (float)value; }, null); imageAlphaAnim.Start( ); // Scale UP the logo SimpleAnimator_SizeF imageSizeAnim = new SimpleAnimator_SizeF(ImageLogo.Frame.Size, new SizeF(View.Frame.Width, View.Frame.Height), .25f, delegate(float percent, object value) { SizeF imageSize = (SizeF)value; ImageLogo.Frame = new RectangleF((View.Frame.Width - imageSize.Width) / 2, (View.Frame.Height - imageSize.Height) / 2, imageSize.Width, imageSize.Height); }, delegate { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { OnCompletionCallback( ); }); }); imageSizeAnim.Start( ); }
public void PerformStartup(bool networkSuccess) { // Fade in the background image SimpleAnimator_Float imageBGAlphaAnim = new SimpleAnimator_Float(0.00f, 1.00f, .25f, delegate(float percent, object value) { ImageBG.Opacity = (float)value; }, null); imageBGAlphaAnim.Start( ); // Fade OUT the logo SimpleAnimator_Float imageAlphaAnim = new SimpleAnimator_Float(ImageLogo.Opacity, 0.00f, .13f, delegate(float percent, object value) { ImageLogo.Opacity = (float)value; }, null); imageAlphaAnim.Start( ); // Scale UP the logo SimpleAnimator_SizeF imageSizeAnim = new SimpleAnimator_SizeF(ImageLogo.Frame.Size, new SizeF(View.Frame.Width, View.Frame.Height), .25f, delegate(float percent, object value) { SizeF imageSize = (SizeF)value; ImageLogo.Frame = new RectangleF((View.Frame.Width - imageSize.Width) / 2, (View.Frame.Height - imageSize.Height) / 2, imageSize.Width, imageSize.Height); }, delegate { // when finished, wait, then go to the next state System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 500; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { View.BackgroundColor = ControlStylingConfig.BackgroundColor; // if the network is ok, continue. if (networkSuccess == true) { EnterNextState(OOBE_State.Welcome); } else { // if not, let them know they need a network connection for their first run. EnterNextState(OOBE_State.NetworkError); } }); }; timer.Start( ); }); imageSizeAnim.Start( ); }
void AnimateUtilityView(bool open) { SizeF startSize = UtilityLayer.Bounds.Size; SizeF endSize; float animTime = .2f; // setup the target values based on whether we're opening or closing if (open == true) { UtilityLayer.Hidden = false; endSize = new SizeF(MinNoteWidth, Rock.Mobile.Graphics.Util.UnitToPx(UtilityLayerHeight)); } else { DeleteButton.Hidden = true; CloseButton.Hidden = true; endSize = new SizeF(MinNoteWidth, 0); } // size... SimpleAnimator_SizeF sizeAnimator = new SimpleAnimator_SizeF(startSize, endSize, animTime, delegate(float percent, object value) { SizeF currSize = (SizeF)value; UtilityLayer.Bounds = new RectangleF(0, 0, currSize.Width, currSize.Height); }, delegate { // if we CLOSED, hide the utility layer if (open == false) { UtilityLayer.Hidden = true; } // and if we OPENED, unhide the DELETE button else { // DeleteButton.Hidden = false; CloseButton.Hidden = false; } Animating = false; }); sizeAnimator.Start( ); }
public override void AnimateOpen(bool becomeFirstResponder) { if (Animating == false && Hidden == true) { // unhide and flag it as animating Hidden = false; Animating = true; // measure so we know the height Measure( ); // start the size at 0 TextView.LayoutParameters.Width = 0; TextView.LayoutParameters.Height = 0; SimpleAnimator_SizeF animator = new SimpleAnimator_SizeF(System.Drawing.SizeF.Empty, new System.Drawing.SizeF(NaturalSize.Width, TextView.MeasuredHeight), .2f, delegate(float percent, object value) { System.Drawing.SizeF currSize = (System.Drawing.SizeF)value; Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { TextView.LayoutParameters.Width = (int)currSize.Width; TextView.LayoutParameters.Height = (int)currSize.Height; // redundantly set the min width so it redraws TextView.SetMinWidth((int)currSize.Width); }); }, delegate { Animating = false; // restore the original settings for dimensions TextView.LayoutParameters.Width = RelativeLayout.LayoutParams.WrapContent; TextView.LayoutParameters.Height = RelativeLayout.LayoutParams.WrapContent; if (becomeFirstResponder == true) { BecomeFirstResponder( ); } }); animator.Start( ); } }
public override void AnimateClosed( ) { if (TextView.Animating == false && TextView.Hidden == false) { TextView.Animating = true; SimpleAnimator_SizeF animator = new SimpleAnimator_SizeF(TextView.Bounds.Size.ToSizeF( ), new SizeF(0, 0), SCALE_TIME_SECONDS, delegate(float percent, object value) { SizeF currSize = (SizeF)value; TextView.Bounds = new RectangleF(0, 0, currSize.Width, currSize.Height); }, delegate { TextView.Hidden = true; TextView.Animating = false; }); animator.Start( ); } }
public override void AnimateClosed( ) { if (Animating == false && Hidden == false) { // unhide and flag it as animating Animating = true; // get the measurements so we know how tall it currently is Measure( ); SimpleAnimator_SizeF animator = new SimpleAnimator_SizeF(new System.Drawing.SizeF(NaturalSize.Width, TextView.MeasuredHeight), System.Drawing.SizeF.Empty, .2f, delegate(float percent, object value) { // animate it to 0 System.Drawing.SizeF currSize = (System.Drawing.SizeF)value; Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { TextView.LayoutParameters.Width = (int)currSize.Width; TextView.LayoutParameters.Height = (int)currSize.Height; // redundantly set the min width so it redraws TextView.SetMinWidth(TextView.MeasuredWidth); }); }, delegate { Hidden = true; Animating = false; // restore the original settings for dimensions TextView.LayoutParameters.Width = RelativeLayout.LayoutParams.WrapContent; TextView.LayoutParameters.Height = RelativeLayout.LayoutParams.WrapContent; }); animator.Start( ); } }
public void PerformStartup( ) { // Fade in the background image SimpleAnimator_Float imageBGAlphaAnim = new SimpleAnimator_Float( 0.00f, 1.00f, .25f, delegate(float percent, object value ) { ImageBG.Opacity = (float)value; }, null ); imageBGAlphaAnim.Start( ); // Fade OUT the logo SimpleAnimator_Float imageAlphaAnim = new SimpleAnimator_Float( ImageLogo.Opacity, 0.00f, .13f, delegate(float percent, object value ) { ImageLogo.Opacity = (float)value; }, null ); imageAlphaAnim.Start( ); // Scale UP the logo SimpleAnimator_SizeF imageSizeAnim = new SimpleAnimator_SizeF( ImageLogo.Frame.Size, new SizeF( View.Frame.Width, View.Frame.Height ), .25f, delegate(float percent, object value ) { SizeF imageSize = (SizeF)value; ImageLogo.Frame = new RectangleF( ( View.Frame.Width - imageSize.Width ) / 2, ( View.Frame.Height - imageSize.Height ) / 2, imageSize.Width, imageSize.Height ); }, delegate { // when finished, wait, then go to the next state System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 500; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) => { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { View.BackgroundColor = ControlStylingConfig.BackgroundColor; EnterNextState( OOBE_State.Welcome ); }); }; timer.Start( ); } ); imageSizeAnim.Start( ); }
public void PerformStartup( ) { // Fade OUT the logo SimpleAnimator_Float imageAlphaAnim = new SimpleAnimator_Float( ImageLogo.Opacity, 0.00f, .13f, delegate(float percent, object value ) { ImageLogo.Opacity = (float)value; }, null ); imageAlphaAnim.Start( ); // Scale UP the logo SimpleAnimator_SizeF imageSizeAnim = new SimpleAnimator_SizeF( ImageLogo.Frame.Size, new SizeF( View.Frame.Width, View.Frame.Height ), .25f, delegate(float percent, object value ) { SizeF imageSize = (SizeF)value; ImageLogo.Frame = new RectangleF( ( View.Frame.Width - imageSize.Width ) / 2, ( View.Frame.Height - imageSize.Height ) / 2, imageSize.Width, imageSize.Height ); }, delegate { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { OnCompletionCallback( ); }); } ); imageSizeAnim.Start( ); }
void AnimateUtilityView( bool open ) { if ( AnimatingUtilityView == false ) { AnimatingUtilityView = true; SizeF startSize = UtilityLayer.Bounds.Size; SizeF endSize; float animTime = .2f; // setup the target values based on whether we're opening or closing if ( open == true ) { UtilityLayer.Hidden = false; endSize = new SizeF( MinNoteWidth, Rock.Mobile.Graphics.Util.UnitToPx( UtilityLayerHeight ) ); } else { DeleteButton.Hidden = true; CloseButton.Hidden = true; endSize = new SizeF( MinNoteWidth, 0 ); } // size... SimpleAnimator_SizeF sizeAnimator = new SimpleAnimator_SizeF( startSize, endSize, animTime, delegate(float percent, object value ) { SizeF currSize = (SizeF)value; UtilityLayer.Bounds = new RectangleF( 0, 0, currSize.Width, currSize.Height ); }, delegate { // if we CLOSED, hide the utility layer if ( open == false ) { UtilityLayer.Hidden = true; } // and if we OPENED, unhide the DELETE button else { // DeleteButton.Hidden = false; CloseButton.Hidden = false; } AnimatingUtilityView = false; } ); sizeAnimator.Start( ); } }
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( ); }