public void Left() { if (_currentIndex == _words.Count - 1) { Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.AnimLeftClamp); _activeCard.StartAnimation(anim); } else { _activeEditText.AfterTextChanged -= Save; SaveCard(); _currentIndex++; _activeCard.Animate().SetDuration(600).TranslationX(_clampLeft).Start(); _originalCard = new Card(_words[_currentIndex]); _currentCard = new Card(_originalCard); _isTranslate = false; _nonActiveEditText.Text = _currentCard.Word1; _nonActiveCard.TranslationX = _clampRight; _nonActiveCard.Animate().SetDuration(600).TranslationX(_zero).Start(); SwithCard(); _activeEditText.AfterTextChanged += Save; UpdateStatus(); } }
/// <summary> /// Switch to the next lesson /// </summary> private void NextLesson() { SoundPlayer.Stop(); var nextLesson = DataHolder.Current.CurrentModule.GetNextLesson(DataHolder.Current.CurrentLesson); if (nextLesson != null) { DataHolder.Current.CurrentLesson = nextLesson; DataHolder.Current.CurrentIteration = nextLesson.Iterations.First(); InitLesson(); } else { Finish(); } fragmentContainer.StartAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.SwipeInRight)); }
void IntroducereIntrebare_Click(object sender, EventArgs e) { ImageView CancelBtn = FindViewById <ImageView>(Resource.Id.imageView1); if (!CancelBtn.Visibility.Equals(ViewStates.Visible)) { Window.SetFlags(WindowManagerFlags.NotTouchable, WindowManagerFlags.NotTouchable); ShowFragment(IntroducereIntrebare_Fragment); int[] Position = new int[2]; IntroducereIntrebare.GetLocationOnScreen(Position); AlphaAnimation alphaAnim = new AlphaAnimation(0.0f, 1.0f); alphaAnim.Duration = 1000; alphaAnim.AnimationEnd += ((object sender1, Animation.AnimationEndEventArgs e1) => { RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); parameters.AddRule(LayoutRules.Below, Resource.Id.relativeLayout2); parameters.SetMargins(40, 0, 40, 40); Container.LayoutParameters = parameters; Animation ScaleAnim = AnimationUtils.LoadAnimation(this, Resource.Animation.ScaleOutAnim); ScaleAnim.AnimationEnd += ((object sender2, Animation.AnimationEndEventArgs e2) => { Window.ClearFlags(WindowManagerFlags.NotTouchable); }); Container.StartAnimation(ScaleAnim); }); SetareDurata.Visibility = ViewStates.Gone; SetareVariante.Visibility = ViewStates.Gone; CancelBtn.StartAnimation(alphaAnim); CancelBtn.Visibility = ViewStates.Visible; } if (!CancelBtn.HasOnClickListeners) { CancelBtn.Click += ((object sender1, EventArgs e1) => { Window.SetFlags(WindowManagerFlags.NotTouchable, WindowManagerFlags.NotTouchable); Animation ScaleAnim = AnimationUtils.LoadAnimation(this, Resource.Animation.ScaleInAnim); ScaleAnim.FillAfter = true; Container.StartAnimation(ScaleAnim); ScaleAnim.AnimationEnd += ((object sender2, Animation.AnimationEndEventArgs e2) => { SetareDurata.Visibility = ViewStates.Visible; SetareVariante.Visibility = ViewStates.Visible; RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(0, 0); Container.LayoutParameters = parameters; CancelBtn.Visibility = ViewStates.Gone; Window.ClearFlags(WindowManagerFlags.NotTouchable); }); }); } }
private void AnimateTopLayer(float percent, bool force = false) { if (!canAnimate) { return; } if (height <= 0) { height = (float)topLayer.MeasuredHeight; if (height <= 0) { return; } } canAnimate = false; var start = animation == null ? -height : lastY; var time = 300; IInterpolator interpolator; if (percent < 0) { percent = 0; } else if (percent > 100) { percent = 100; } lastY = -height * (percent / 100F); if ((int)lastY == (int)start && !force) { canAnimate = true; return; } //is new so do bound, else linear if (fullAnimation || !Utils.IsSameDay) { interpolator = new BounceInterpolator(); time = 3000; fullAnimation = false; } else { interpolator = new LinearInterpolator(); } animation = new TranslateAnimation(Dimension.Absolute, 0, Dimension.Absolute, 0, Dimension.Absolute, start, Dimension.Absolute, lastY); animation.Duration = time; animation.Interpolator = interpolator; animation.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => { canAnimate = true; }; animation.FillAfter = true; topLayer.StartAnimation(animation); if (topLayer.Visibility != Android.Views.ViewStates.Visible) { topLayer.Visibility = Android.Views.ViewStates.Visible; } }
private void SetAnimToTellmeView() { Animation myAnim = AnimationUtils.LoadAnimation(this, Resource.Animation.bounce); tellmeLayout.StartAnimation(myAnim); }