/// <param name="animate"> whether to animate the change </param> /// <returns> this, to allow builder pattern </returns> public virtual BadgeItem Show(bool animate) { mIsHidden = false; if (WeakReferenceValid) { TextView textView = (TextView)mTextViewRef.Get(); if (animate) { textView.ScaleX = 0; textView.ScaleY = 0; textView.Visibility = ViewStates.Visible; ViewPropertyAnimatorCompat animatorCompat = ViewCompat.Animate(textView); animatorCompat.Cancel(); animatorCompat.SetDuration(mAnimationDuration); animatorCompat.ScaleX(1).ScaleY(1); animatorCompat.SetListener(null); animatorCompat.Start(); } else { textView.ScaleX = 1; textView.ScaleY = 1; textView.Visibility = ViewStates.Visible; } } return(this); }
// public void setmFabBehaviour(int mFabBehaviour) { // this.mFabBehaviour = mFabBehaviour; // } /////////////////////////////////////////////////////////////////////////// // Animator Initializer /////////////////////////////////////////////////////////////////////////// private void ensureOrCancelAnimator(FloatingActionButton fab) { if (mFabTranslationYAnimator == null) { mFabTranslationYAnimator = ViewCompat.Animate(fab); mFabTranslationYAnimator.SetDuration(400); mFabTranslationYAnimator.SetInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); } else { mFabTranslationYAnimator.Cancel(); } }
/// <summary> /// Internal Method /// <para> /// used to set animation and /// takes care of cancelling current animation /// and sets duration and interpolator for animation /// /// </para> /// </summary> /// <param name="offset"> translation offset that needs to set with animation </param> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void animateOffset(final int offset) private void animateOffset(int offset) { if (mTranslationAnimator == null) { mTranslationAnimator = ViewCompat.Animate(this); mTranslationAnimator.SetDuration(mRippleAnimationDuration); mTranslationAnimator.SetInterpolator(INTERPOLATOR); } else { mTranslationAnimator.Cancel(); } mTranslationAnimator.TranslationY(offset).Start(); }
/// <param name="animate"> whether to animate the change </param> /// <returns> this, to allow builder pattern </returns> public virtual BadgeItem Hide(bool animate) { mIsHidden = true; if (WeakReferenceValid) { TextView textView = (TextView)mTextViewRef.Get(); if (animate) { ViewPropertyAnimatorCompat animatorCompat = ViewCompat.Animate(textView); animatorCompat.Cancel(); animatorCompat.SetDuration(mAnimationDuration); animatorCompat.ScaleX(0).ScaleY(0); animatorCompat.SetListener(new ViewPropertyAnimatorListenerAnonymousInnerClass(this)); animatorCompat.Start(); } else { textView.Visibility = ViewStates.Gone; } } return(this); }