Example #1
0
 //public override bool LayoutDependsOn(CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 //{
 //    var s = dependency is AppBarLayout;
 //    return base.LayoutDependsOn(parent, child, dependency);
 //}
 //public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 //{
 //    //float scaleY = System.Math.Abs(dependency.GetY());
 //    //View _child = child as View;
 //    ////child.TranslationY
 //    //AnimateOffset(_child);
 //    return true;
 //    // return base.OnDependentViewChanged(parent, child, dependency);
 //}
 void AnimateOffset(View child, ScrollDirection scrollDirection)
 {
     if (translationAnimator == null)
     {
         translationAnimator = ViewCompat.Animate(child);
         translationAnimator.SetDuration(300);
         translationAnimator.SetInterpolator(InInterpolator);
     }
     else
     {
         translationAnimator.Cancel();
     }
     if (scrollDirection == ScrollDirection.Up)
     {
         translationAnimator.TranslationY(child.Height).Start();
     }
     else if (scrollDirection == ScrollDirection.Down)
     {
         translationAnimator.TranslationY(0).Start();
     }
 }
Example #2
0
 /**
  * Animate offset
  *
  * @param child
  * @param offset
  */
 private void animateOffset(T child, int offset, bool forceAnimation, bool withAnimation)
 {
     if (!behaviorTranslationEnabled && !forceAnimation)
     {
         return;
     }
     if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat)
     {
         ensureOrCancelObjectAnimation(child, offset, withAnimation);
         translationObjectAnimator.Start();
     }
     else
     {
         ensureOrCancelAnimator(child, withAnimation);
         translationAnimator.TranslationY(offset).Start();
     }
 }
Example #3
0
 private void AnimateOffset(View child, int offset)
 {
     EnsureOrCancelAnimator(child);
     translationAnimator.TranslationY(offset).Start();
 }