Пример #1
0
 /// <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);
 }
Пример #2
0
 /// <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);
 }