Esempio n. 1
0
 public void OnAnimationEnd(Animation animation)
 {
     _adapter.StopAnimation(_groupPosition);
     _listView.CollapseGroup(_groupPosition);
     _adapter.NotifyDataSetChanged();
     _info.DummyHeight = -1;
     _dummyView.Tag    = AnimatedExpandableListAdapter.STATE_IDLE;
 }
Esempio n. 2
0
        /**
         * Collapses the given group with an animation.
         * @param groupPos The position of the group to collapse
         * @return  Returns true if the group was collapsed. False if the group was
         *          already collapsed.
         */
        public bool CollapseGroupWithAnimation(int groupPosition)
        {
            int groupFlatPos = GetFlatListPosition(GetPackedPositionForGroup(groupPosition));

            if (groupFlatPos != -1)
            {
                int childIndex = groupFlatPos - FirstVisiblePosition;
                if (childIndex >= 0 && childIndex < ChildCount)
                {
                    // Get the view for the group is it is on screen...
                    View v = GetChildAt(childIndex);
                    if (v.Bottom >= Bottom)
                    {
                        // If the user is not going to be able to see the animation
                        // we just collapse the group without an animation.
                        // This resolves the case where getChildView will not be
                        // called if the children of the group is not on screen
                        return(CollapseGroup(groupPosition));
                    }
                }
                else
                {
                    // If the group is offscreen, we can just collapse it without an
                    // animation...
                    return(CollapseGroup(groupPosition));
                }
            }

            // Get the position of the firstChild visible from the top of the screen
            long packedPos          = GetExpandableListPosition(FirstVisiblePosition);
            int  firstChildPosition = GetPackedPositionChild(packedPos);
            int  firstGroupPosition = GetPackedPositionGroup(packedPos);

            // If the first visible view on the screen is a child view AND it's a
            // child of the group we are trying to collapse, then set that
            // as the first child position of the group... see
            // {@link #startCollapseAnimation(int, int)} for why this is necessary
            firstChildPosition = firstChildPosition == -1 || firstGroupPosition != groupPosition ? 0 : firstChildPosition;

            // Let the adapter know that we are going to start animating the
            // collapse animation.
            _adapter.StartCollapseAnimation(groupPosition, firstChildPosition);

            // Force the listview to refresh it's views
            _adapter.NotifyDataSetChanged();
            return(IsGroupExpanded(groupPosition));
        }
Esempio n. 3
0
 public void OnAnimationEnd(Animation animation)
 {
     _adapter.StopAnimation(_groupPosition);
     _adapter.NotifyDataSetChanged();
     _dummyView.Tag = AnimatedExpandableListAdapter.STATE_IDLE;
 }