Example #1
0
 /// <summary>Shows only the specified child.</summary>
 /// <remarks>
 /// Shows only the specified child. The other displays Views exit the screen,
 /// optionally with the with the
 /// <see cref="getOutAnimation()">out animation</see>
 /// and
 /// the specified child enters the screen, optionally with the
 /// <see cref="getInAnimation()">in animation</see>
 /// .
 /// </remarks>
 /// <param name="childIndex">The index of the child to be shown.</param>
 /// <param name="animate">
 /// Whether or not to use the in and out animations, defaults
 /// to true.
 /// </param>
 internal virtual void showOnly(int childIndex, bool animate_1)
 {
     int count = getChildCount();
     {
         for (int i = 0; i < count; i++)
         {
             android.view.View child = getChildAt(i);
             if (i == childIndex)
             {
                 if (animate_1 && mInAnimation != null)
                 {
                     child.startAnimation(mInAnimation);
                 }
                 child.setVisibility(android.view.View.VISIBLE);
                 mFirstTime = false;
             }
             else
             {
                 if (animate_1 && mOutAnimation != null && child.getVisibility() == android.view.View
                     .VISIBLE)
                 {
                     child.startAnimation(mOutAnimation);
                 }
                 else
                 {
                     if (child.getAnimation() == mInAnimation)
                     {
                         child.clearAnimation();
                     }
                 }
                 child.setVisibility(android.view.View.GONE);
             }
         }
     }
 }
Example #2
0
 /// <summary>Control whether the list is being displayed.</summary>
 /// <remarks>
 /// Control whether the list is being displayed.  You can make it not
 /// displayed if you are waiting for the initial data to show in it.  During
 /// this time an indeterminant progress indicator will be shown instead.
 /// </remarks>
 /// <param name="shown">
 /// If true, the list view is shown; if false, the progress
 /// indicator.  The initial value is true.
 /// </param>
 /// <param name="animate">
 /// If true, an animation will be used to transition to the
 /// new state.
 /// </param>
 private void setListShown(bool shown, bool animate)
 {
     ensureList();
     if (mProgressContainer == null)
     {
         throw new System.InvalidOperationException("Can't be used with a custom content view"
                                                    );
     }
     if (mListShown == shown)
     {
         return;
     }
     mListShown = shown;
     if (shown)
     {
         if (animate)
         {
             mProgressContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                                   (getActivity(), android.R.anim.fade_out));
             mListContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                               (getActivity(), android.R.anim.fade_in));
         }
         else
         {
             mProgressContainer.clearAnimation();
             mListContainer.clearAnimation();
         }
         mProgressContainer.setVisibility(android.view.View.GONE);
         mListContainer.setVisibility(android.view.View.VISIBLE);
     }
     else
     {
         if (animate)
         {
             mProgressContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                                   (getActivity(), android.R.anim.fade_in));
             mListContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                               (getActivity(), android.R.anim.fade_out));
         }
         else
         {
             mProgressContainer.clearAnimation();
             mListContainer.clearAnimation();
         }
         mProgressContainer.setVisibility(android.view.View.VISIBLE);
         mListContainer.setVisibility(android.view.View.GONE);
     }
 }
        public static void playClickAnim(View targetView)
        {
            float              SCALE_FACTOR  = 0.3f;
            AnimationSet       animSet       = new AnimationSet(true);
            TranslateAnimation translateAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2);

            animSet.addAnimation(translateAnim);
            ScaleAnimation anim = new ScaleAnimation(1f, 1f + SCALE_FACTOR, 1f, 1f + SCALE_FACTOR);

            animSet.addAnimation(anim);
            animSet.Interpolator = new AccelerateDecelerateInterpolator();
            animSet.Duration     = 150;
            targetView.startAnimation(animSet);
        }
		public static void playClickAnim(View targetView)
		{
			float SCALE_FACTOR = 0.3f;
			AnimationSet animSet = new AnimationSet(true);
			TranslateAnimation translateAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2);
			animSet.addAnimation(translateAnim);
			ScaleAnimation anim = new ScaleAnimation(1f, 1f + SCALE_FACTOR, 1f, 1f + SCALE_FACTOR);

			animSet.addAnimation(anim);
			animSet.Interpolator = new AccelerateDecelerateInterpolator();
			animSet.Duration = 150;
			targetView.startAnimation(animSet);

		}