public virtual void animateToVisibility(int visibility)
 {
     if (mVisibilityAnim != null)
     {
         mVisibilityAnim.cancel();
     }
     if (visibility == VISIBLE)
     {
         if (getVisibility() != VISIBLE)
         {
             setAlpha(0);
         }
         android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat(
             this, "alpha", 1);
         anim.setDuration(FADE_DURATION);
         anim.setInterpolator(sAlphaInterpolator);
         anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
         anim.start();
     }
     else
     {
         android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat(
             this, "alpha", 0);
         anim.setDuration(FADE_DURATION);
         anim.setInterpolator(sAlphaInterpolator);
         anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
         anim.start();
     }
 }
Пример #2
0
 public virtual void animateToVisibility(int visibility)
 {
     if (mVisibilityAnim != null)
     {
         mVisibilityAnim.cancel();
     }
     if (visibility == VISIBLE)
     {
         if (getVisibility() != VISIBLE)
         {
             setAlpha(0);
             if (mSplitView != null && mMenuView != null)
             {
                 mMenuView.setAlpha(0);
             }
         }
         android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat(
             this, "alpha", 1);
         anim.setDuration(FADE_DURATION);
         anim.setInterpolator(sAlphaInterpolator);
         if (mSplitView != null && mMenuView != null)
         {
             android.animation.AnimatorSet    set       = new android.animation.AnimatorSet();
             android.animation.ObjectAnimator splitAnim = android.animation.ObjectAnimator.ofFloat
                                                              (mMenuView, "alpha", 1);
             splitAnim.setDuration(FADE_DURATION);
             set.addListener(mVisAnimListener.withFinalVisibility(visibility));
             set.play(anim).with(splitAnim);
             set.start();
         }
         else
         {
             anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
             anim.start();
         }
     }
     else
     {
         android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat(
             this, "alpha", 0);
         anim.setDuration(FADE_DURATION);
         anim.setInterpolator(sAlphaInterpolator);
         if (mSplitView != null && mMenuView != null)
         {
             android.animation.AnimatorSet    set       = new android.animation.AnimatorSet();
             android.animation.ObjectAnimator splitAnim = android.animation.ObjectAnimator.ofFloat
                                                              (mMenuView, "alpha", 0);
             splitAnim.setDuration(FADE_DURATION);
             set.addListener(mVisAnimListener.withFinalVisibility(visibility));
             set.play(anim).with(splitAnim);
             set.start();
         }
         else
         {
             anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
             anim.start();
         }
     }
 }
Пример #3
0
 /// <summary>Starts all animations added since the last call to this function.</summary>
 /// <remarks>
 /// Starts all animations added since the last call to this function.  Used to synchronize
 /// animations.
 /// </remarks>
 /// <param name="listener">
 /// an optional listener to add to the animations. Typically used to know when
 /// to invalidate the surface these are being drawn to.
 /// </param>
 public virtual void startAnimations(android.animation.ValueAnimator.AnimatorUpdateListener
                                     listener)
 {
     {
         for (int i = 0; i < mNeedToStart.size(); i++)
         {
             android.animation.ObjectAnimator anim = mNeedToStart.get(i);
             anim.addUpdateListener(listener);
             anim.addListener(this);
             anim.start();
         }
     }
     mNeedToStart.clear();
 }