Exemplo n.º 1
0
        public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object child, View dependency)
        {
            // Move the fab vertically to place correctly wrt the info pane
            var fab = child.JavaCast <SwitchableFab> ();
            var currentInfoPaneY = ViewCompat.GetTranslationY(dependency);
            var newTransY        = (int)Math.Max(0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2);

            ViewCompat.SetTranslationY(fab, -newTransY);

            // If alternating between open/closed state, change the FAB face
            if (wasOpened ^ ((InfoPane)dependency).Opened)
            {
                fab.Switch();
                wasOpened = !wasOpened;
            }

            return(true);
        }
Exemplo n.º 2
0
        public override void EndAnimation(RecyclerView.ViewHolder item)
        {
            View view = item.itemView;

            ViewCompat.Animate(view).Cancel();
            if (mPendingMoves.Contains(item))
            {
                ViewCompat.SetTranslationY(view, 0);
                ViewCompat.SetTranslationX(view, 0);
                dispatchMoveFinished(item);
                mPendingMoves.remove(item);
            }
            if (mPendingRemovals.contains(item))
            {
                dispatchRemoveFinished(item);
                mPendingRemovals.remove(item);
            }
            if (mPendingAdditions.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchAddFinished(item);
                mPendingAdditions.remove(item);
            }
            if (mMoveAnimations.contains(item))
            {
                ViewCompat.setTranslationY(view, 0);
                ViewCompat.setTranslationX(view, 0);
                dispatchMoveFinished(item);
                mMoveAnimations.remove(item);
            }
            if (mRemoveAnimations.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchRemoveFinished(item);
                mRemoveAnimations.remove(item);
            }
            if (mAddAnimations.contains(item))
            {
                ViewCompat.setAlpha(view, 1);
                dispatchAddFinished(item);
                mAddAnimations.remove(item);
            }
            dispatchFinishedWhenDone();
        }
Exemplo n.º 3
0
        private void UpdateTranslation(CoordinatorLayout parent, View child, View dependency)
        {
            float translationY = this.GetTranslationY(parent, child);

            if (translationY != this.mTranslationY)
            {
                ViewCompat.Animate(child).Cancel();

                if (Math.Abs(translationY - this.mTranslationY) == (float)dependency.Height)
                {
                    ViewCompat.Animate(child)
                    .TranslationY(translationY)
                    .SetListener((IViewPropertyAnimatorListener)null);
                }
                else
                {
                    ViewCompat.SetTranslationY(child, translationY);
                }

                this.mTranslationY = translationY;
            }
        }
        private void UpdateTranslation(CoordinatorLayout parent, Android.Views.View child, Android.Views.View dependency)
        {
            var translationY = GetTranslationY(parent, child);

            if (Math.Abs(translationY - _mTranslationY) > double.Epsilon)
            {
                ViewCompat.Animate(child).Cancel();

                if (Math.Abs(Math.Abs(translationY - _mTranslationY) - dependency.Height) < double.Epsilon)
                {
                    ViewCompat.Animate(child)
                    .TranslationY(translationY)
                    .SetListener(null);
                }
                else
                {
                    ViewCompat.SetTranslationY(child, translationY);
                }

                _mTranslationY = translationY;
            }
        }