예제 #1
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();
         }
     }
 }
예제 #2
0
 internal virtual void show(bool markHiddenBeforeMode)
 {
     if (mCurrentShowAnim != null)
     {
         mCurrentShowAnim.end();
     }
     if (mContainerView.getVisibility() == android.view.View.VISIBLE)
     {
         if (markHiddenBeforeMode)
         {
             mWasHiddenBeforeMode = false;
         }
         return;
     }
     mContainerView.setVisibility(android.view.View.VISIBLE);
     if (mShowHideAnimationEnabled)
     {
         mContainerView.setAlpha(0);
         android.animation.AnimatorSet         anim = new android.animation.AnimatorSet();
         android.animation.AnimatorSet.Builder b    = anim.play(android.animation.ObjectAnimator
                                                                .ofFloat(mContainerView, "alpha", 1));
         if (mContentView != null)
         {
             b.with(android.animation.ObjectAnimator.ofFloat(mContentView, "translationY", -mContainerView
                                                             .getHeight(), 0));
             mContainerView.setTranslationY(-mContainerView.getHeight());
             b.with(android.animation.ObjectAnimator.ofFloat(mContainerView, "translationY", 0
                                                             ));
         }
         if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT)
         {
             mSplitView.setAlpha(0);
             mSplitView.setVisibility(android.view.View.VISIBLE);
             b.with(android.animation.ObjectAnimator.ofFloat(mSplitView, "alpha", 1));
         }
         anim.addListener(mShowListener);
         mCurrentShowAnim = anim;
         anim.start();
     }
     else
     {
         mContainerView.setAlpha(1);
         mContainerView.setTranslationY(0);
         mShowListener.onAnimationEnd(null);
     }
 }
예제 #3
0
 public override void hide()
 {
     if (mCurrentShowAnim != null)
     {
         mCurrentShowAnim.end();
     }
     if (mContainerView.getVisibility() == android.view.View.GONE)
     {
         return;
     }
     if (mShowHideAnimationEnabled)
     {
         mContainerView.setAlpha(1);
         mContainerView.setTransitioning(true);
         android.animation.AnimatorSet         anim = new android.animation.AnimatorSet();
         android.animation.AnimatorSet.Builder b    = anim.play(android.animation.ObjectAnimator
                                                                .ofFloat(mContainerView, "alpha", 0));
         if (mContentView != null)
         {
             b.with(android.animation.ObjectAnimator.ofFloat(mContentView, "translationY", 0,
                                                             -mContainerView.getHeight()));
             b.with(android.animation.ObjectAnimator.ofFloat(mContainerView, "translationY", -
                                                             mContainerView.getHeight()));
         }
         if (mSplitView != null && mSplitView.getVisibility() == android.view.View.VISIBLE)
         {
             mSplitView.setAlpha(1);
             b.with(android.animation.ObjectAnimator.ofFloat(mSplitView, "alpha", 0));
         }
         anim.addListener(mHideListener);
         mCurrentShowAnim = anim;
         anim.start();
     }
     else
     {
         mHideListener.onAnimationEnd(null);
     }
 }
예제 #4
0
		public override void hide()
		{
			if (mCurrentShowAnim != null)
			{
				mCurrentShowAnim.end();
			}
			if (mContainerView.getVisibility() == android.view.View.GONE)
			{
				return;
			}
			if (mShowHideAnimationEnabled)
			{
				mContainerView.setAlpha(1);
				mContainerView.setTransitioning(true);
				android.animation.AnimatorSet anim = new android.animation.AnimatorSet();
				android.animation.AnimatorSet.Builder b = anim.play(android.animation.ObjectAnimator
					.ofFloat(mContainerView, "alpha", 0));
				if (mContentView != null)
				{
					b.with(android.animation.ObjectAnimator.ofFloat(mContentView, "translationY", 0, 
						-mContainerView.getHeight()));
					b.with(android.animation.ObjectAnimator.ofFloat(mContainerView, "translationY", -
						mContainerView.getHeight()));
				}
				if (mSplitView != null && mSplitView.getVisibility() == android.view.View.VISIBLE)
				{
					mSplitView.setAlpha(1);
					b.with(android.animation.ObjectAnimator.ofFloat(mSplitView, "alpha", 0));
				}
				anim.addListener(mHideListener);
				mCurrentShowAnim = anim;
				anim.start();
			}
			else
			{
				mHideListener.onAnimationEnd(null);
			}
		}
예제 #5
0
		internal virtual void show(bool markHiddenBeforeMode)
		{
			if (mCurrentShowAnim != null)
			{
				mCurrentShowAnim.end();
			}
			if (mContainerView.getVisibility() == android.view.View.VISIBLE)
			{
				if (markHiddenBeforeMode)
				{
					mWasHiddenBeforeMode = false;
				}
				return;
			}
			mContainerView.setVisibility(android.view.View.VISIBLE);
			if (mShowHideAnimationEnabled)
			{
				mContainerView.setAlpha(0);
				android.animation.AnimatorSet anim = new android.animation.AnimatorSet();
				android.animation.AnimatorSet.Builder b = anim.play(android.animation.ObjectAnimator
					.ofFloat(mContainerView, "alpha", 1));
				if (mContentView != null)
				{
					b.with(android.animation.ObjectAnimator.ofFloat(mContentView, "translationY", -mContainerView
						.getHeight(), 0));
					mContainerView.setTranslationY(-mContainerView.getHeight());
					b.with(android.animation.ObjectAnimator.ofFloat(mContainerView, "translationY", 0
						));
				}
				if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT)
				{
					mSplitView.setAlpha(0);
					mSplitView.setVisibility(android.view.View.VISIBLE);
					b.with(android.animation.ObjectAnimator.ofFloat(mSplitView, "alpha", 1));
				}
				anim.addListener(mShowListener);
				mCurrentShowAnim = anim;
				anim.start();
			}
			else
			{
				mContainerView.setAlpha(1);
				mContainerView.setTranslationY(0);
				mShowListener.onAnimationEnd(null);
			}
		}
예제 #6
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();
				}
			}
		}