Esempio n. 1
0
 /**
  * Creates a new ViewAnimator, using the given {@link com.nhaarman.listviewanimations.util.ListViewWrapper}.
  *
  * @param listViewWrapper the {@code ListViewWrapper} which wraps the implementation of the ListView used.
  */
 ////@NonNull readonly
 public ViewAnimator(IListViewWrapper listViewWrapper)
 {
     mListViewWrapper       = listViewWrapper;
     mAnimationStartMillis  = -1;
     mFirstAnimatedPosition = -1;
     mLastAnimatedPosition  = -1;
 }
    public SwipeUndoTouchListener( IListViewWrapper listViewWrapper,   IUndoCallback callback) 
		:base(listViewWrapper, callback)

    {
        
        mCallback = callback;
    }
Esempio n. 3
0
            public static void animateExpanding(View view, IListViewWrapper listViewWrapper)
            {
                view.Visibility = ViewStates.Visible;

                View parent     = (View)view.Parent;
                int  widthSpec  = View.MeasureSpec.MakeMeasureSpec(parent.MeasuredWidth - parent.PaddingLeft - parent.PaddingRight, MeasureSpecMode.AtMost);
                int  heightSpec = View.MeasureSpec.MakeMeasureSpec(0, MeasureSpecMode.Unspecified);

                view.Measure(widthSpec, heightSpec);

                ValueAnimator animator = createHeightAnimator(view, 0, view.MeasuredHeight);

                //animator.addUpdateListener(
                //        new ValueAnimator.AnimatorUpdateListener() {
                //            int listViewHeight = listViewWrapper.getListView().getHeight();
                //            int listViewBottomPadding = listViewWrapper.getListView().getPaddingBottom();
                //            View v = findDirectChild(view, listViewWrapper.getListView());

                //            @Override
                //            public void onAnimationUpdate( ValueAnimator animation) {
                //                int bottom = v.getBottom();
                //                if (bottom > listViewHeight) {
                //                    int top = v.getTop();
                //                    if (top > 0) {
                //                        listViewWrapper.smoothScrollBy(Math.min(bottom - listViewHeight + listViewBottomPadding, top), 0);
                //                    }
                //                }
                //            }
                //        }
                //);

                animator.AddUpdateListener(new animateExpandingInnerClass(view, listViewWrapper));
                animator.Start();
            }
Esempio n. 4
0
 public animateExpandingInnerClass(View view, IListViewWrapper listViewWrapper)
 {
     mlist                 = listViewWrapper;
     mview                 = view;
     listViewHeight        = listViewWrapper.getListView().Height;
     listViewBottomPadding = listViewWrapper.getListView().PaddingBottom;
     v = ExpandCollapseHelper.findDirectChild(view, listViewWrapper.getListView());
 }
        /**
         * Alternative to {@link #setAbsListView(android.widget.AbsListView)}. Sets the {@link com.nhaarman.listviewanimations.util.ListViewWrapper} which contains the ListView
         * this adapter will be bound to. Call this method before setting this adapter to the ListView. Also propagates to the decorated {@code BaseAdapter} if applicable.
         */
        //@Override
        public virtual void setListViewWrapper(IListViewWrapper listViewWrapper)
        {
            mListViewWrapper = listViewWrapper;

            if (mDecoratedBaseAdapter is IListViewWrapperSetter)
            {
                ((IListViewWrapperSetter)mDecoratedBaseAdapter).setListViewWrapper(listViewWrapper);
            }
        }
        //@Override
        public override void setListViewWrapper(IListViewWrapper listViewWrapper)
        {
            base.setListViewWrapper(listViewWrapper);
            mSwipeUndoTouchListener = new SwipeUndoTouchListener(listViewWrapper, mUndoCallback);

            if (!(listViewWrapper.getListView() is DynamicListView))
            {
                listViewWrapper.getListView().SetOnTouchListener(mSwipeUndoTouchListener);
            }
        }
        /**
         * Constructs a new {@code SwipeTouchListener} for the given {@link android.widget.AbsListView}.
         */
        //@SuppressWarnings("UnnecessaryFullyQualifiedName")
        protected SwipeTouchListener(IListViewWrapper listViewWrapper)
        {
            ViewConfiguration vc = ViewConfiguration.Get(listViewWrapper.getListView().Context);

            mSlop             = vc.ScaledTouchSlop;
            mMinFlingVelocity = vc.ScaledMinimumFlingVelocity * MIN_FLING_VELOCITY_FACTOR;
            mMaxFlingVelocity = vc.ScaledMaximumFlingVelocity;
            mAnimationTime    = listViewWrapper.getListView().Context.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime);
            mListViewWrapper  = listViewWrapper;
        }
        //@Override
        public override void setListViewWrapper(IListViewWrapper listViewWrapper)
        {

            base.setListViewWrapper(listViewWrapper);
            mSwipeUndoTouchListener = new SwipeUndoTouchListener(listViewWrapper, mUndoCallback);

            if (!(listViewWrapper.getListView() is DynamicListView))
            {
                listViewWrapper.getListView().SetOnTouchListener(mSwipeUndoTouchListener);
            }
        }
 /**
  * Returns the {@link View} that represents the item for given position.
  *
  * @param listViewWrapper the {@link ListViewWrapper} wrapping the ListView that should be examined
  * @param position        the position for which the {@code View} should be returned.
  *
  * @return the {@code View}, or {@code null} if the position is not currently visible.
  */
 //@Nullable
 public static View getViewForPosition(IListViewWrapper listViewWrapper, int position)
 {
     int childCount = listViewWrapper.getChildCount();
     View downView = null;
     for (int i = 0; i < childCount && downView == null; i++)
     {
         View child = listViewWrapper.getChildAt(i);
         if (child != null && getPositionForView(listViewWrapper, child) == position)
         {
             downView = child;
         }
     }
     return downView;
 }
Esempio n. 10
0
        /**
         * Returns the {@link View} that represents the item for given position.
         *
         * @param listViewWrapper the {@link ListViewWrapper} wrapping the ListView that should be examined
         * @param position        the position for which the {@code View} should be returned.
         *
         * @return the {@code View}, or {@code null} if the position is not currently visible.
         */
        //@Nullable
        public static View getViewForPosition(IListViewWrapper listViewWrapper, int position)
        {
            int  childCount = listViewWrapper.getChildCount();
            View downView   = null;

            for (int i = 0; i < childCount && downView == null; i++)
            {
                View child = listViewWrapper.getChildAt(i);
                if (child != null && getPositionForView(listViewWrapper, child) == position)
                {
                    downView = child;
                }
            }
            return(downView);
        }
Esempio n. 11
0
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     if (getDecoratedBaseAdapter() is ArrayAdapter)
     {
         ((Com.Nhaarman.ListviewAnimations.ArrayAdapter <object>)getDecoratedBaseAdapter()).propagateNotifyDataSetChanged(this);
     }
     mDismissTouchListener = new SwipeDismissTouchListener(listViewWrapper, mOnDismissCallback);
     if (mParentIsHorizontalScrollContainer)
     {
         mDismissTouchListener.setParentIsHorizontalScrollContainer();
     }
     if (mSwipeTouchChildResId != 0)
     {
         mDismissTouchListener.setTouchChild(mSwipeTouchChildResId);
     }
     listViewWrapper.getListView().SetOnTouchListener(mDismissTouchListener);
 }
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     if (getDecoratedBaseAdapter() is ArrayAdapter)
     {
          
         ((Com.Nhaarman.ListviewAnimations.ArrayAdapter<object>)getDecoratedBaseAdapter()).propagateNotifyDataSetChanged(this);                 
         
     }
     mDismissTouchListener = new SwipeDismissTouchListener(listViewWrapper, mOnDismissCallback);
     if (mParentIsHorizontalScrollContainer)
     {
         mDismissTouchListener.setParentIsHorizontalScrollContainer();
     }
     if (mSwipeTouchChildResId != 0)
     {
         mDismissTouchListener.setTouchChild(mSwipeTouchChildResId);
     }
     listViewWrapper.getListView().SetOnTouchListener(mDismissTouchListener);
 }
 /**
  * Constructs a new {@code SwipeTouchListener} for the given {@link android.widget.AbsListView}.
  */
 //@SuppressWarnings("UnnecessaryFullyQualifiedName")
 protected SwipeTouchListener(IListViewWrapper listViewWrapper)
 {
     ViewConfiguration vc = ViewConfiguration.Get(listViewWrapper.getListView().Context);
     mSlop = vc.ScaledTouchSlop;
     mMinFlingVelocity = vc.ScaledMinimumFlingVelocity * MIN_FLING_VELOCITY_FACTOR;
     mMaxFlingVelocity = vc.ScaledMaximumFlingVelocity;
     mAnimationTime = listViewWrapper.getListView().Context.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime);
     mListViewWrapper = listViewWrapper;
 }
        /**
         * Constructs a new {@code SwipeDismissTouchListener} for the given {@link android.widget.AbsListView}.
         *
         * @param listViewWrapper The {@code ListViewWrapper} containing the ListView whose items should be dismissable.
         * @param callback    The callback to trigger when the user has indicated that he
         */
        //@SuppressWarnings("UnnecessaryFullyQualifiedName")
        public SwipeDismissTouchListener(IListViewWrapper listViewWrapper, IOnDismissCallback callback)
            : base(listViewWrapper)
        {

            mCallback = callback;
            mDismissAnimationTime = listViewWrapper.getListView().Context.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime);
        }
 /**
  * Returns the position within the adapter's dataset for the view, where view is an adapter item or a descendant of an adapter item.
  * Unlike {@link AdapterView#getPositionForView(android.view.View)}, returned position will reflect the position of the item given view is representing,
  * by subtracting the header views count.
  *
  * @param listViewWrapper the IListViewWrapper wrapping the ListView containing the view.
  * @param view            an adapter item or a descendant of an adapter item. This must be visible in given AdapterView at the time of the call.
  *
  * @return the position of the item in the AdapterView represented by given view, or {@link AdapterView#INVALID_POSITION} if the view does not
  * correspond to a list item (or it is not visible).
  */
 public static int getPositionForView(IListViewWrapper listViewWrapper, View view)
 {
     return listViewWrapper.getPositionForView(view) - listViewWrapper.getHeaderViewsCount();
 }
        public SwipeUndoTouchListener(IListViewWrapper listViewWrapper, IUndoCallback callback)
            : base(listViewWrapper, callback)

        {
            mCallback = callback;
        }
Esempio n. 17
0
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     mViewAnimator = new Com.Nhaarman.ListviewAnimations.Appearance.ViewAnimator(listViewWrapper);
 }
Esempio n. 18
0
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     mViewAnimator = new ViewAnimator(listViewWrapper);
 }
Esempio n. 19
0
 /**
  * Returns the position within the adapter's dataset for the view, where view is an adapter item or a descendant of an adapter item.
  * Unlike {@link AdapterView#getPositionForView(android.view.View)}, returned position will reflect the position of the item given view is representing,
  * by subtracting the header views count.
  *
  * @param listViewWrapper the IListViewWrapper wrapping the ListView containing the view.
  * @param view            an adapter item or a descendant of an adapter item. This must be visible in given AdapterView at the time of the call.
  *
  * @return the position of the item in the AdapterView represented by given view, or {@link AdapterView#INVALID_POSITION} if the view does not
  * correspond to a list item (or it is not visible).
  */
 public static int getPositionForView(IListViewWrapper listViewWrapper, View view)
 {
     return(listViewWrapper.getPositionForView(view) - listViewWrapper.getHeaderViewsCount());
 }
        /**
         * Alternative to {@link #setAbsListView(android.widget.AbsListView)}. Sets the {@link com.nhaarman.listviewanimations.util.ListViewWrapper} which contains the ListView
         * this adapter will be bound to. Call this method before setting this adapter to the ListView. Also propagates to the decorated {@code BaseAdapter} if applicable.
         */
        //@Override
        public virtual void setListViewWrapper(IListViewWrapper listViewWrapper)
        {
            mListViewWrapper = listViewWrapper;

            if (mDecoratedBaseAdapter is IListViewWrapperSetter)
            {
                ((IListViewWrapperSetter)mDecoratedBaseAdapter).setListViewWrapper(listViewWrapper);
            }
        }
 /**
  * Creates a new ViewAnimator, using the given {@link com.nhaarman.listviewanimations.util.ListViewWrapper}.
  *
  * @param listViewWrapper the {@code ListViewWrapper} which wraps the implementation of the ListView used.
  */
 ////@NonNull readonly
 public ViewAnimator(IListViewWrapper listViewWrapper)
 {
     mListViewWrapper = listViewWrapper;
     mAnimationStartMillis = -1;
     mFirstAnimatedPosition = -1;
     mLastAnimatedPosition = -1;
 }
Esempio n. 22
0
 //@SuppressWarnings("NullableProblems")
 //@Override
 public void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     mListViewWrapper = listViewWrapper;
 }
 /**
  * Constructs a new {@code SwipeDismissTouchListener} for the given {@link android.widget.AbsListView}.
  *
  * @param listViewWrapper The {@code ListViewWrapper} containing the ListView whose items should be dismissable.
  * @param callback    The callback to trigger when the user has indicated that he
  */
 //@SuppressWarnings("UnnecessaryFullyQualifiedName")
 public SwipeDismissTouchListener(IListViewWrapper listViewWrapper, IOnDismissCallback callback)
     : base(listViewWrapper)
 {
     mCallback             = callback;
     mDismissAnimationTime = listViewWrapper.getListView().Context.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime);
 }
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     mViewAnimator = new Com.Nhaarman.ListviewAnimations.Appearance.ViewAnimator(listViewWrapper);
 }
 //@Override
 public override void setListViewWrapper(IListViewWrapper listViewWrapper)
 {
     base.setListViewWrapper(listViewWrapper);
     mViewAnimator = new ViewAnimator(listViewWrapper);
 }