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 StartAnimation( ) { if (Animating == false) { Animating = true; float startingYPos = PonyImage.Position.Y; SimpleAnimator_Float animJump = new SimpleAnimator_Float(startingYPos, 50, 1.00f, delegate(float percent, object value) { PonyImage.Position = new PointF(PonyImage.Position.X, (float)value); }, delegate { SimpleAnimator_Float animFall = new SimpleAnimator_Float(PonyImage.Position.Y, startingYPos, 1.00f, delegate(float percent, object value) { PonyImage.Position = new PointF(PonyImage.Position.X, (float)value); }, delegate { Animating = false; StartAnimation( ); }); animFall.Start(SimpleAnimator.Style.CurveEaseIn); }); animJump.Start(SimpleAnimator.Style.CurveEaseOut); } }
public void Hide(bool animated) { if (animated) { SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(View.Opacity, 0.00f, .33f, delegate(float percent, object value) { View.Opacity = (float)value; Backer.Opacity = Math.Min((float)value, sBackerOpacity); }, delegate { View.Hidden = true; Backer.Hidden = true; }); alphaAnim.Start( ); } else { View.Hidden = true; View.Opacity = 0.00f; Backer.Hidden = true; Backer.Opacity = 0.00f; } }
void AnimateForSafeBounds(float xDist, bool becomeFirstResponder) { // setup an animator that will move the Anchor & icon to the max allowed open distance. float animTime = .2f; // stamp the last X pos so that we can track the delta change as the animation ticks float lastXPos = 0; SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(0, xDist, animTime, delegate(float percent, object value) { // take the current animated x value float currXPos = (float)value; // get the delta from last tick to now float xDelta = currXPos - lastXPos; // stamp the new last position (for next tick) lastXPos = currXPos; // update both the anchor and icon by the xDelta Anchor.Position = new PointF(Anchor.Position.X + xDelta, Anchor.Position.Y); NoteIcon.Position = new PointF(NoteIcon.Position.X + xDelta, NoteIcon.Position.Y); }, // On Animation Complete delegate { // run the normal open animation AnimateNoteOpen(becomeFirstResponder); }); floatAnimator.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 HandleNetworkFixed( ) { // this is called if the app retried connecting and it worked. // fade out the "error" and then we can continue! SimpleAnimator_Float anim = new SimpleAnimator_Float(1.00f, 0.00f, .50f, delegate(float percent, object value) { NetworkErrorLabel.Opacity = (float)value; NetworkRetryButton.Opacity = (float)value; }, delegate { // when finished, wait, then go to the next state 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 { //AnimateRegSeperator( ); EnterNextState(OOBE_State.Welcome); }); }; timer.Start( ); }); anim.Start( ); }
void PerformWelcome( ) { //CreateCampusButtons( ); SimpleAnimator_Float anim = new SimpleAnimator_Float(0.00f, 1.00f, .50f, delegate(float percent, object value) { WelcomeLabel.Opacity = (float)value; }, delegate { // when finished, wait, then go to the next state 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 { //EnterNextState( OOBE_State.CampusIntro ); // HACK: Force Peoria Campus, and they can change it later. OnClick(1, true); EnterNextState(OOBE_State.AccountChoice); }); }; timer.Start( ); }); anim.Start( ); }
public override void OnResume() { base.OnResume(); System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 750; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) => { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { SplashView.PerformStartup( ); SimpleAnimator_Float viewAlphaAnim = new SimpleAnimator_Float(ContainerView.Alpha, 0.00f, .25f, delegate(float percent, object value) { ContainerView.Alpha = (float)value; }, null); viewAlphaAnim.Start( ); }); }; timer.Start( ); SpringboardParent.ModalFragmentOpened(this); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); SplashView.LayoutChanged(new System.Drawing.RectangleF(0, 0, displaySize.X, displaySize.Y)); }
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( ); }
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); }
public static void AnimateBackgroundOpacity(PlatformBaseUI view, float targetOpacity, SimpleAnimator.AnimationComplete onCompletion = null) { SimpleAnimator_Float animator = new SimpleAnimator_Float(view.Opacity, targetOpacity, .15f, delegate(float percent, object value) { view.Opacity = (float)value; } , onCompletion); animator.Start( ); }
void FadeLoginResult(bool fadeIn) { SimpleAnimator_Float fader = new SimpleAnimator_Float(LoginResultLayer.Alpha, fadeIn == true ? 1.00f : 0.00f, .33f, delegate(float percent, object value) { LoginResultLayer.Alpha = (float)value; }, delegate { }); fader.Start( ); }
void PerformNetworkError( ) { SimpleAnimator_Float anim = new SimpleAnimator_Float(0.00f, 1.00f, .50f, delegate(float percent, object value) { NetworkErrorLabel.Opacity = (float)value; NetworkRetryButton.Opacity = (float)value; }, delegate { // when finished, wait }); anim.Start( ); }
public void Show( ) { Backer.Hidden = false; View.Hidden = false; SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float(View.Opacity, 1.00f, .33f, delegate(float percent, object value) { Backer.Opacity = Math.Min((float)value, sBackerOpacity); View.Opacity = (float)value; }, null); alphaAnim.Start( ); }
void AnimateTutorialScreen(bool fadeIn) { // handles fading in / out the tutorial screen float startVal = fadeIn ? 0.00f : 1.00f; float endVal = fadeIn ? 1.00f : 0.00f; // dont do it if the tutorial screen is already in the state we're requesting if (endVal != TutorialOverlay.Alpha) { if (AnimatingTutorial == false) { AnimatingTutorial = true; // animate the backer SimpleAnimator_Float backerAnim = new SimpleAnimator_Float(startVal, Math.Min(PrivateNoteConfig.MaxTutorialAlpha, endVal), .33f, delegate(float percent, object value) { TutorialBacker.Alpha = (float)value; }, delegate { if (fadeIn == false) { TutorialBacker.Visibility = ViewStates.Gone; } }); backerAnim.Start( ); // animate the tutorial SimpleAnimator_Float tutorialAnim = new SimpleAnimator_Float(startVal, endVal, .33f, delegate(float percent, object value) { TutorialOverlay.Alpha = (float)value; }, delegate { AnimatingTutorial = false; if (fadeIn == false) { ScrollView.ScrollEnabled = true; } }); tutorialAnim.Start( ); } } }
public override void AnimateToFade(float fadeAmount) { fadeAmount = System.Math.Max(ZeroScale, fadeAmount * MaxScale); SimpleAnimator_Float animator = new SimpleAnimator_Float(Scale, fadeAmount, SCALE_TIME_SECONDS, delegate(float percent, object value) { Scale = (float)value; ApplyMaskScale(Scale); }, delegate { Scale = fadeAmount; ApplyMaskScale(Scale); }); animator.Start( ); }
public static void FadeView(View view, bool fadeIn, SimpleAnimator.AnimationComplete onComplete) { float startAlpha = fadeIn == true ? 0.00f : 1.00f; float endAlpha = fadeIn == true ? 1.00f : 0.00f; SimpleAnimator_Float floatAnim = new SimpleAnimator_Float(startAlpha, endAlpha, .15f, delegate(float percent, object value) { view.Alpha = (float)value; }, delegate { if (onComplete != null) { onComplete( ); } }); floatAnim.Start( ); }
public void AnimateMaskScale(float targetScale, float duration) { if (Animating == false) { float clampedValue = System.Math.Max(targetScale, .01f); SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(_MaskScale, clampedValue, duration, delegate(float percent, object value) { _MaskScale = (float)value; Invalidate( ); }, delegate { Animating = false; }); floatAnimator.Start( ); Animating = true; } }
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 AnimateImageView(View imageView, PointF startPos, PointF endPos, System.Drawing.SizeF startSize, System.Drawing.SizeF endSize, float duration, SimpleAnimator.AnimationComplete completeDelegate) { // calculate the deltas once before we start float xDelta = endPos.X - startPos.X; float yDelta = endPos.Y - startPos.Y; float deltaWidth = endSize.Width - startSize.Width; float deltaHeight = endSize.Height - startSize.Height; // create an animator SimpleAnimator_Float imageAnimator = new SimpleAnimator_Float(0.00f, 1.00f, duration, delegate(float percent, object value) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { // each update, interpolate the deltas and apply imageView.SetX(startPos.X + (xDelta * percent)); imageView.SetY(startPos.Y + (yDelta * percent)); imageView.LayoutParameters.Width = (int)(startSize.Width + (deltaWidth * percent)); imageView.LayoutParameters.Height = (int)(startSize.Height + (deltaHeight * percent)); // force the image to re-evaluate its size imageView.RequestLayout( ); }); }, //ANIMATION COMPLETE delegate { if (completeDelegate != null) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { completeDelegate( ); }); } }); imageAnimator.Start( ); }
public void Hide( ) { // if we're not animating and ARE visible if (Animating == false && Visibility == ViewStates.Visible) { Animating = true; // create a simple animator and animate the banner out of view SimpleAnimator_Float revealer = new SimpleAnimator_Float(0, ScreenWidth, AnimationTime, delegate(float percent, object value) { SetX((float)value); }, delegate { // when complete, hide the banner, since there's no need to render it Animating = false; Visibility = ViewStates.Gone; }); revealer.Start( ); } }
public void Reveal( ) { // if we're not animating and AREN'T visible if (Animating == false && Visibility == ViewStates.Gone) { // reveal the banner and flag that we're animating Visibility = ViewStates.Visible; Animating = true; BringToFront( ); // create an animator and animate us into view SimpleAnimator_Float revealer = new SimpleAnimator_Float(ScreenWidth, 0, AnimationTime, delegate(float percent, object value) { SetX((float)value); }, delegate { Animating = false; }); revealer.Start( ); } }
void AnimateImageView( View imageView, PointF startPos, PointF endPos, System.Drawing.SizeF startSize, System.Drawing.SizeF endSize, float duration, SimpleAnimator.AnimationComplete completeDelegate ) { // calculate the deltas once before we start float xDelta = endPos.X - startPos.X; float yDelta = endPos.Y - startPos.Y; float deltaWidth = endSize.Width - startSize.Width; float deltaHeight = endSize.Height - startSize.Height; // create an animator SimpleAnimator_Float imageAnimator = new SimpleAnimator_Float( 0.00f, 1.00f, duration, delegate( float percent, object value ) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { // each update, interpolate the deltas and apply imageView.SetX( startPos.X + ( xDelta * percent ) ); imageView.SetY( startPos.Y + ( yDelta * percent ) ); imageView.LayoutParameters.Width = (int)( startSize.Width + ( deltaWidth * percent ) ); imageView.LayoutParameters.Height = (int)( startSize.Height + ( deltaHeight * percent ) ); // force the image to re-evaluate its size imageView.RequestLayout( ); } ); }, //ANIMATION COMPLETE delegate { if ( completeDelegate != null ) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { completeDelegate( ); } ); } } ); imageAnimator.Start( ); }
public void Show( ) { Backer.Hidden = false; View.Hidden = false; SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float( View.Opacity, 1.00f, .33f, delegate(float percent, object value ) { Backer.Opacity = Math.Min( (float)value, sBackerOpacity ); View.Opacity = (float)value; }, null ); alphaAnim.Start( ); }
public void Hide( bool animated ) { if ( animated ) { SimpleAnimator_Float alphaAnim = new SimpleAnimator_Float( View.Opacity, 0.00f, .33f, delegate(float percent, object value ) { View.Opacity = (float)value; Backer.Opacity = Math.Min( (float)value, sBackerOpacity ); }, delegate { View.Hidden = true; Backer.Hidden = true; } ); alphaAnim.Start( ); } else { View.Hidden = true; View.Opacity = 0.00f; Backer.Hidden = true; Backer.Opacity = 0.00f; } }
void PerformWelcome( ) { SimpleAnimator_Float anim = new SimpleAnimator_Float( 0.00f, 1.00f, .50f, delegate(float percent, object value ) { WelcomeLabel.Opacity = (float)value; }, delegate { // when finished, wait, then go to the next state 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 { //AnimateRegSeperator( ); EnterNextState( OOBE_State.CampusIntro ); }); }; timer.Start( ); } ); anim.Start( ); }
//static bool RanOOBE = false; public void OOBEOnClick( int index, bool isCampusSelection ) { if ( isCampusSelection ) { App.Shared.Network.RockMobileUser.Instance.ViewingCampus = index; } else { // fade out the OOBE SimpleAnimator_Float oobeFadeOutAnim = new SimpleAnimator_Float( 1.00f, 0.00f, .33f, delegate(float percent, object value ) { OOBEViewController.View.Layer.Opacity = (float)value; }, delegate { // if they chose register, present it if ( index == 0 ) { PresentModalViewController( RegisterViewController ); } // if they chose login, present it! else if ( index == 1 ) { PresentModalViewController( LoginViewController ); } else { // don't present anything. Instead, just wrap up the OOBE. CompleteOOBE( ); } OOBEViewController.RemoveFromParentViewController( ); OOBEViewController.View.RemoveFromSuperview( ); } ); oobeFadeOutAnim.Start( ); } }
void SetMode(CropMode mode) { if (mode == Mode) { throw new Exception(string.Format("Crop Mode {0} requested, but already in that mode.", mode)); } switch (mode) { case CropMode.Editing: { // If we're entering edit mode for the first time if (Mode == CropMode.None) { // Animate in the mask SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime, delegate(float percent, object value) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { MaskLayer.Opacity = (float)value; }); }, null); floatAnimator.Start( ); // turn on our cropper CropView.Visibility = ViewStates.Visible; // and set the source image to the scaled source. ImageView.SetImageBitmap(ScaledSourceImage); } // else we're coming FROM Preview Mode, so we need to animate else { Animating = true; // setup the dimension changes System.Drawing.SizeF startSize = new System.Drawing.SizeF(ImageView.Width, ImageView.Height); System.Drawing.SizeF endSize = new System.Drawing.SizeF(CropView.Width, CropView.Height); PointF startPos = new PointF(ImageView.GetX( ), ImageView.GetY( )); PointF endPos = new PointF(CropView.GetX( ), CropView.GetY( )); // now animate the cropped image up to its full size AnimateImageView(ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime, delegate { ImageView.SetImageBitmap(null); // release any cropped image we had. if (CroppedImage != null) { CroppedImage.Dispose( ); CroppedImage = null; } // release the scaled version if we had it if (ScaledCroppedImage != null) { ScaledCroppedImage.Dispose( ); ScaledCroppedImage = null; } ImageView.SetImageBitmap(ScaledSourceImage); ImageView.LayoutParameters.Width = ScaledSourceImage.Width; ImageView.LayoutParameters.Height = ScaledSourceImage.Height; // center the image ImageView.SetX((ScreenSize.Width - ImageView.LayoutParameters.Width) / 2); ImageView.SetY((ScreenSize.Height - ImageView.LayoutParameters.Height) / 2); MaskLayer.Visibility = ViewStates.Visible; CropView.Visibility = ViewStates.Visible; SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime, delegate(float percent, object value) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { MaskLayer.Opacity = (float)value; CropView.Alpha = percent; }); }, // FINISHED MASK FADE-OUT delegate { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { Animating = false; }); }); floatAnimator.Start( ); }); } break; } case CropMode.Previewing: { // don't allow a state change while we're animating Animating = true; SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, 1.00f, MaskFadeTime, delegate(float percent, object value) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { MaskLayer.Opacity = (float)value; CropView.Alpha = 1.0f - percent; }); }, // FINISHED MASK FADE-IN delegate { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { // hide the mask and cropper MaskLayer.Visibility = ViewStates.Gone; CropView.Visibility = ViewStates.Gone; // create the cropped image CroppedImage = CropImage(SourceImage, new System.Drawing.RectangleF(CropView.GetX( ) - CropViewMinPos.X, CropView.GetY( ) - CropViewMinPos.Y, CropView.LayoutParameters.Width, CropView.LayoutParameters.Height)); // create a scaled version of the cropped image float scaledWidth = (float)CroppedImage.Width * (1.0f / ScreenToImageScalar); float scaledHeight = (float)CroppedImage.Height * (1.0f / ScreenToImageScalar); ScaledCroppedImage = Bitmap.CreateScaledBitmap(CroppedImage, (int)scaledWidth, (int)scaledHeight, false); // set the scaled cropped image ImageView.SetImageBitmap(null); ImageView.SetImageBitmap(ScaledCroppedImage); // start the scaled cropped image scaled down further to match its size within the full image. ImageView.SetX(CropView.GetX( )); ImageView.SetY(CropView.GetY( )); ImageView.LayoutParameters.Width = CropView.Width; ImageView.LayoutParameters.Height = CropView.Height; // setup the dimension changes System.Drawing.SizeF startSize = new System.Drawing.SizeF(ScaledCroppedImage.Width, ScaledCroppedImage.Height); System.Drawing.SizeF endSize; if (ScreenSize.Width < ScreenSize.Height) { endSize = new System.Drawing.SizeF(ScreenSize.Width, (float)System.Math.Ceiling(ScreenSize.Width * (startSize.Width / startSize.Height))); } else { endSize = new System.Drawing.SizeF((float)System.Math.Ceiling(ScreenSize.Height * (startSize.Height / startSize.Width)), ScreenSize.Height); } PointF startPos = new PointF(CropView.GetX( ), CropView.GetY( )); PointF endPos = new PointF((ScreenSize.Width - endSize.Width) / 2, (ScreenSize.Height - endSize.Height) / 2); // now animate the cropped image up to its full size AnimateImageView(ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime, delegate { Animating = false; }); }); }); floatAnimator.Start( ); break; } } Mode = mode; }
/*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 );*/ }
public void TryFacebookBind( ) { SetUIState( LoginState.Trying ); // have our rock mobile user begin the facebook bind process RockMobileUser.Instance.BindFacebookAccount( delegate(string fromUri, Facebook.FacebookClient session) { // it's ready, so create a webView that will take them to the FBLogin page WebLayout = new WebLayout( View.Frame ); WebLayout.DeleteCacheAndCookies( ); View.AddSubview( WebLayout.ContainerView ); // set it totally transparent so we can fade it in WebLayout.ContainerView.BackgroundColor = UIColor.Black; WebLayout.ContainerView.Layer.Opacity = 0.00f; WebLayout.SetCancelButtonColor( ControlStylingConfig.TextField_PlaceholderTextColor ); // do a nice fade-in SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float( 0.00f, 1.00f, .25f, delegate(float percent, object value) { WebLayout.ContainerView.Layer.Opacity = (float)value; }, delegate { // once faded in, begin loading the page WebLayout.ContainerView.Layer.Opacity = 1.00f; WebLayout.LoadUrl( fromUri, delegate(WebLayout.Result result, string url) { BlockerView.Hide( ); // if fail/success comes in if( result != WebLayout.Result.Cancel ) { // see if it's a valid facebook response // if an empty url was returned, it's NOT. Fail. if( string.IsNullOrEmpty( url ) == true ) { WebLayout.ContainerView.RemoveFromSuperview( ); BindComplete( false ); } // otherwise, try to parse the response and move forward else if ( RockMobileUser.Instance.HasFacebookResponse( url, session ) ) { // it is, continue the bind process WebLayout.ContainerView.RemoveFromSuperview( ); RockMobileUser.Instance.FacebookCredentialResult( url, session, BindComplete ); ProfileAnalytic.Instance.Trigger( ProfileAnalytic.Login, "Facebook" ); } } else { // they pressed cancel, so simply cancel the attempt WebLayout.ContainerView.RemoveFromSuperview( ); LoginComplete( System.Net.HttpStatusCode.ResetContent, "" ); } } ); }); floatAnimator.Start( ); }); }
void AnimateTutorialScreen( bool fadeIn ) { // handles fading in / out the tutorial screen float startVal = fadeIn ? 0.00f : 1.00f; float endVal = fadeIn ? 1.00f : 0.00f; // dont do it if the tutorial screen is already in the state we're requesting if ( endVal != TutorialOverlay.Alpha ) { if ( AnimatingTutorial == false ) { AnimatingTutorial = true; // animate the backer SimpleAnimator_Float backerAnim = new SimpleAnimator_Float( startVal, Math.Min( .80f, endVal ), .33f, delegate(float percent, object value ) { TutorialBacker.Alpha = (float)value; }, delegate { if( fadeIn == false ) { TutorialBacker.Visibility = ViewStates.Gone; } } ); backerAnim.Start( ); // animate the tutorial SimpleAnimator_Float tutorialAnim = new SimpleAnimator_Float( startVal, endVal, .33f, delegate(float percent, object value ) { TutorialOverlay.Alpha = (float)value; }, delegate { AnimatingTutorial = false; if( fadeIn == false ) { ScrollView.ScrollEnabled = true; } } ); tutorialAnim.Start( ); } } }
void StartAnimation( ) { if ( Animating == false ) { Animating = true; float startingYPos = PonyImage.Position.Y; SimpleAnimator_Float animJump = new SimpleAnimator_Float( startingYPos, 50, 1.00f, delegate(float percent, object value ) { PonyImage.Position = new PointF( PonyImage.Position.X, (float)value ); }, delegate { SimpleAnimator_Float animFall = new SimpleAnimator_Float( PonyImage.Position.Y, startingYPos, 1.00f, delegate(float percent, object value ) { PonyImage.Position = new PointF( PonyImage.Position.X, (float)value ); }, delegate { Animating = false; StartAnimation( ); }); animFall.Start( SimpleAnimator.Style.CurveEaseIn ); } ); animJump.Start( SimpleAnimator.Style.CurveEaseOut ); } }
void FadeLoginResult( bool fadeIn ) { SimpleAnimator_Float fader = new SimpleAnimator_Float( LoginResultLayer.Alpha, fadeIn == true ? 1.00f : 0.00f, .33f, delegate(float percent, object value ) { LoginResultLayer.Alpha = (float)value; }, delegate { } ); fader.Start( ); }
void ToggleDatePickerVisible( bool shouldDisplay ) { // we are HIDING nfloat targetYPos = 0; if( shouldDisplay == false ) { targetYPos = ParentView.Bounds.Height; } // we are UNHIDING else { // setup the initial date time to display. (As a default value, use 1 year ago) DateTime initialDate = DateTime.Now.AddYears( -1 ); // if there's already a value, use that. if( string.IsNullOrWhiteSpace( ValueLabel.Text ) == false ) { initialDate = DateTime.Parse( ValueLabel.Text ); } DatePicker.Date = initialDate.DateTimeToNSDate( ); // make sure we update the label too UpdateDateLabel( DatePicker.Date ); ParentView.AddSubview( ContainerButton ); ContainerButton.AddSubview( DatePicker ); targetYPos = ParentView.Bounds.Height - DatePicker.Bounds.Height; IsActive = true; } SimpleAnimator_Float floatAnim = new SimpleAnimator_Float( (float)DatePicker.Layer.Position.Y, (float)targetYPos, .18f, delegate(float percent, object value) { DatePicker.Layer.Position = new CGPoint( DatePicker.Layer.Position.X, (float)value ); }, delegate { if( shouldDisplay == false ) { IsActive = false; DatePicker.RemoveFromSuperview( ); ContainerButton.RemoveFromSuperview( ); } }); floatAnim.Start( ); }
public void Display( string symbolText, string resultText, UIView parentView ) { // don't allow multiple display calls. Causes the animations to get weird. if ( IsDisplaying == false ) { IsDisplaying = true; // set the text values and update positioning ResultSymbol.Text = symbolText; ResultText.Text = resultText; ResultSymbol.SizeToFit( ); ResultText.SizeToFit( ); Bounds = new CGRect( 0, 0, ResultText.Bounds.Width + 40, ResultText.Bounds.Height + ResultSymbol.Bounds.Height + 80 ); nfloat vertSpacing = 20; nfloat elementTotalHeight = ResultSymbol.Bounds.Height + ResultText.Bounds.Height + vertSpacing; ResultSymbol.Layer.Position = new CGPoint( ( Bounds.Width - ResultSymbol.Bounds.Width ) / 2, ( Bounds.Height - elementTotalHeight ) / 2 ); ResultText.Layer.Position = new CGPoint( ( Bounds.Width - ResultText.Bounds.Width ) / 2, ResultSymbol.Frame.Bottom + vertSpacing ); // position the view Layer.Position = new CGPoint( ( parentView.Bounds.Width - Bounds.Width ) / 2, ( parentView.Bounds.Height / 2 ) - Bounds.Height ); // kick off the animations float viewOpacity = .80f; float animTime = .45f; SimpleAnimator_Float fadeInAnim = new SimpleAnimator_Float( 0.00f, viewOpacity, animTime, delegate( float perc, object value ) { Layer.Opacity = (float)value; }, delegate { // when finished, wait, then fade it out System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 2000; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) => { // do this ON the UI thread Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { SimpleAnimator_Float fadeOutAnim = new SimpleAnimator_Float( viewOpacity, 0.00f, animTime, delegate( float perc, object value ) { Layer.Opacity = (float)value; }, delegate { IsDisplaying = false; }); fadeOutAnim.Start( SimpleAnimator.Style.CurveEaseOut ); } ); }; timer.Start( ); } ); fadeInAnim.Start( SimpleAnimator.Style.CurveEaseIn ); } }
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 SetMode( CropMode mode ) { if( mode == Mode ) { throw new Exception( string.Format( "Crop Mode {0} requested, but already in that mode.", mode ) ); } switch( mode ) { case CropMode.Editing: { // If we're entering edit mode for the first time if ( Mode == CropMode.None ) { // Animate in the mask SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float( MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime, delegate( float percent, object value ) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { MaskLayer.Opacity = (float)value; } ); }, null ); floatAnimator.Start( ); // turn on our cropper CropView.Visibility = ViewStates.Visible; // and set the source image to the scaled source. ImageView.SetImageBitmap( ScaledSourceImage ); } // else we're coming FROM Preview Mode, so we need to animate else { Animating = true; // setup the dimension changes System.Drawing.SizeF startSize = new System.Drawing.SizeF( ImageView.Width, ImageView.Height ); System.Drawing.SizeF endSize = new System.Drawing.SizeF( CropView.Width, CropView.Height ); PointF startPos = new PointF( ImageView.GetX( ), ImageView.GetY( ) ); PointF endPos = new PointF( CropView.GetX( ), CropView.GetY( ) ); // now animate the cropped image up to its full size AnimateImageView( ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime, delegate { ImageView.SetImageBitmap( null ); // release any cropped image we had. if ( CroppedImage != null ) { CroppedImage.Dispose( ); CroppedImage = null; } // release the scaled version if we had it if ( ScaledCroppedImage != null ) { ScaledCroppedImage.Dispose( ); ScaledCroppedImage = null; } ImageView.SetImageBitmap( ScaledSourceImage ); ImageView.LayoutParameters.Width = ScaledSourceImage.Width; ImageView.LayoutParameters.Height = ScaledSourceImage.Height; // center the image ImageView.SetX( (ScreenSize.Width - ImageView.LayoutParameters.Width ) / 2 ); ImageView.SetY( (ScreenSize.Height - ImageView.LayoutParameters.Height ) / 2 ); MaskLayer.Visibility = ViewStates.Visible; CropView.Visibility = ViewStates.Visible; SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float( MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime, delegate( float percent, object value ) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { MaskLayer.Opacity = (float)value; CropView.Alpha = percent; } ); }, // FINISHED MASK FADE-OUT delegate { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { Animating = false; }); }); floatAnimator.Start( ); } ); } break; } case CropMode.Previewing: { // don't allow a state change while we're animating Animating = true; SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float( MaskLayer.Opacity, 1.00f, MaskFadeTime, delegate( float percent, object value ) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { MaskLayer.Opacity = (float)value; CropView.Alpha = 1.0f - percent; } ); }, // FINISHED MASK FADE-IN delegate { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { // hide the mask and cropper MaskLayer.Visibility = ViewStates.Gone; CropView.Visibility = ViewStates.Gone; // create the cropped image CroppedImage = CropImage( SourceImage, new System.Drawing.RectangleF( CropView.GetX( ) - CropViewMinPos.X, CropView.GetY( ) - CropViewMinPos.Y, CropView.LayoutParameters.Width, CropView.LayoutParameters.Height ) ); // create a scaled version of the cropped image float scaledWidth = (float)CroppedImage.Width * (1.0f / ScreenToImageScalar); float scaledHeight = (float)CroppedImage.Height * (1.0f / ScreenToImageScalar); ScaledCroppedImage = Bitmap.CreateScaledBitmap( CroppedImage, (int)scaledWidth, (int)scaledHeight, false ); // set the scaled cropped image ImageView.SetImageBitmap( null ); ImageView.SetImageBitmap( ScaledCroppedImage ); // start the scaled cropped image scaled down further to match its size within the full image. ImageView.SetX( CropView.GetX( ) ); ImageView.SetY( CropView.GetY( ) ); ImageView.LayoutParameters.Width = CropView.Width; ImageView.LayoutParameters.Height = CropView.Height; // setup the dimension changes System.Drawing.SizeF startSize = new System.Drawing.SizeF( ScaledCroppedImage.Width, ScaledCroppedImage.Height ); System.Drawing.SizeF endSize; if( ScreenSize.Width < ScreenSize.Height ) { endSize = new System.Drawing.SizeF( ScreenSize.Width, (float)System.Math.Ceiling( ScreenSize.Width * ( startSize.Width / startSize.Height ) ) ); } else { endSize = new System.Drawing.SizeF( (float)System.Math.Ceiling( ScreenSize.Height * ( startSize.Height / startSize.Width ) ), ScreenSize.Height ); } PointF startPos = new PointF( CropView.GetX( ), CropView.GetY( ) ); PointF endPos = new PointF( (ScreenSize.Width - endSize.Width) / 2, (ScreenSize.Height - endSize.Height) / 2 ); // now animate the cropped image up to its full size AnimateImageView( ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime, delegate { Animating = false; } ); } ); } ); floatAnimator.Start( ); break; } } Mode = mode; }
public void TryFacebookBind( ) { SetUIState(LoginState.Trying); // have our rock mobile user begin the facebook bind process RockMobileUser.Instance.BindFacebookAccount(delegate(string fromUri) { // it's ready, so create a webView that will take them to the FBLogin page WebLayout = new WebLayout(ScrollView.Frame); WebLayout.DeleteCacheAndCookies( ); ScrollView.AddSubview(WebLayout.ContainerView); // set it totally transparent so we can fade it in //WebLayout.ContainerView.BackgroundColor = UIColor.Green; WebLayout.ContainerView.Layer.Opacity = 0.00f; //WebLayout.SetCancelButtonColor( ControlStylingConfig.TextField_PlaceholderTextColor ); WebLayout.LayoutChanged(new CGRect(0, 0, ScrollView.Frame.Width, ScrollView.Frame.Height)); View.SetNeedsLayout( ); // do a nice fade-in SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(0.00f, 1.00f, .25f, delegate(float percent, object value) { WebLayout.ContainerView.Layer.Opacity = (float)value; }, delegate { // once faded in, begin loading the page WebLayout.ContainerView.Layer.Opacity = 1.00f; WebLayout.LoadUrl(fromUri, delegate(WebLayout.Result result, string url) { BlockerView.Hide( ); // if fail/success comes in if (result != WebLayout.Result.Cancel) { // see if it's a valid facebook response // if an empty url was returned, it's NOT. Fail. if (string.IsNullOrEmpty(url) == true) { WebLayout.ContainerView.RemoveFromSuperview( ); BindComplete(false); } // otherwise, try to parse the response and move forward else if (RockMobileUser.Instance.HasFacebookResponse(url)) { // it is, continue the bind process BlockerView.Show(); WebLayout.ContainerView.RemoveFromSuperview( ); RockMobileUser.Instance.FacebookCredentialResult(url, BindComplete); ProfileAnalytic.Instance.Trigger(ProfileAnalytic.Login, "Facebook"); } } else { // they pressed cancel, so simply cancel the attempt WebLayout.ContainerView.RemoveFromSuperview( ); LoginComplete(System.Net.HttpStatusCode.ResetContent, ""); } }); }); floatAnimator.Start( ); }); }
public void OOBEUserClick( int index, bool isCampusSelection ) { // if they picked their campus, update their viewing campus immediately. if ( isCampusSelection ) { App.Shared.Network.RockMobileUser.Instance.ViewingCampus = index; } else { if ( index == 0 ) { StartModalFragment( RegisterFragment, true ); } else if ( index == 1 ) { StartModalFragment( LoginFragment, true ); } else { // fade the OOBE out SimpleAnimator_Float viewAlphaAnim = new SimpleAnimator_Float( FullScreenLayout.Alpha, 0.00f, .13f, delegate(float percent, object value ) { FullScreenLayout.Alpha = (float)value; }, delegate { // and launch the appropriate screen ModalFragmentDone( null ); } ); viewAlphaAnim.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( ); }
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 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( ); }
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 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 OOBEUserClick( int index ) { if ( index == 0 ) { StartModalFragment( RegisterFragment, true ); } else if ( index == 1 ) { StartModalFragment( LoginFragment, true ); } else { // fade the OOBE out SimpleAnimator_Float viewAlphaAnim = new SimpleAnimator_Float( FullScreenLayout.Alpha, 0.00f, .13f, delegate(float percent, object value ) { FullScreenLayout.Alpha = (float)value; }, delegate { // and launch the appropriate screen ModalFragmentDone( null ); FullScreenLayout.Alpha = 1.0f; CompleteOOBE( ); } ); viewAlphaAnim.Start( ); } }
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 ); }
public void SplashComplete( ) { SimpleAnimator_Float splashFadeOutAnim = new SimpleAnimator_Float( 1.00f, 0.00f, .33f, delegate(float percent, object value ) { SplashViewController.View.Layer.Opacity = (float)value; }, delegate { // remove the splash screen SplashViewController.RemoveFromParentViewController( ); SplashViewController.View.RemoveFromSuperview( ); } ); splashFadeOutAnim.Start( ); }
void PerformAccountChoice( ) { // fade out the campus choices and header. bool accountFadeInBegan = false; 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 ); }
public override void OnResume() { base.OnResume(); System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 750; timer.AutoReset = false; timer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e ) => { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { SplashView.PerformStartup( ); SimpleAnimator_Float viewAlphaAnim = new SimpleAnimator_Float( ContainerView.Alpha, 0.00f, .25f, delegate(float percent, object value ) { ContainerView.Alpha = (float)value; }, null ); viewAlphaAnim.Start( ); } ); }; timer.Start( ); SpringboardParent.ModalFragmentOpened( this ); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize( displaySize ); SplashView.LayoutChanged( new System.Drawing.RectangleF( 0, 0, displaySize.X, displaySize.Y ) ); }