Beispiel #1
0
 public override android.view.View getView(int flatListPos, android.view.View convertView
                                           , android.view.ViewGroup parent)
 {
     android.widget.ExpandableListConnector.PositionMetadata posMetadata = getUnflattenedPos
                                                                               (flatListPos);
     android.view.View retValue;
     if (posMetadata.position.type == android.widget.ExpandableListPosition.GROUP)
     {
         retValue = mExpandableListAdapter.getGroupView(posMetadata.position.groupPos, posMetadata
                                                        .isExpanded(), convertView, parent);
     }
     else
     {
         if (posMetadata.position.type == android.widget.ExpandableListPosition.CHILD)
         {
             bool isLastChild = posMetadata.groupMetadata.lastChildFlPos == flatListPos;
             retValue = mExpandableListAdapter.getChildView(posMetadata.position.groupPos, posMetadata
                                                            .position.childPos, isLastChild, convertView, parent);
         }
         else
         {
             // TODO: clean exit
             throw new java.lang.RuntimeException("Flat list position is of unknown type");
         }
     }
     posMetadata.recycle();
     return(retValue);
 }
Beispiel #2
0
        public override long getItemId(int flatListPos)
        {
            android.widget.ExpandableListConnector.PositionMetadata posMetadata = getUnflattenedPos
                                                                                      (flatListPos);
            long groupId = mExpandableListAdapter.getGroupId(posMetadata.position.groupPos);
            long retValue;

            if (posMetadata.position.type == android.widget.ExpandableListPosition.GROUP)
            {
                retValue = mExpandableListAdapter.getCombinedGroupId(groupId);
            }
            else
            {
                if (posMetadata.position.type == android.widget.ExpandableListPosition.CHILD)
                {
                    long childId = mExpandableListAdapter.getChildId(posMetadata.position.groupPos, posMetadata
                                                                     .position.childPos);
                    retValue = mExpandableListAdapter.getCombinedChildId(groupId, childId);
                }
                else
                {
                    // TODO: clean exit
                    throw new java.lang.RuntimeException("Flat list position is of unknown type");
                }
            }
            posMetadata.recycle();
            return(retValue);
        }
Beispiel #3
0
        /// <summary>Expand a group in the grouped list view</summary>
        /// <param name="groupPos">the group to be expanded</param>
        internal virtual bool expandGroup(int groupPos)
        {
            android.widget.ExpandableListConnector.PositionMetadata pm = getFlattenedPos(android.widget.ExpandableListPosition
                                                                                         .obtain(android.widget.ExpandableListPosition.GROUP, groupPos, -1, -1));
            bool retValue = expandGroup(pm);

            pm.recycle();
            return(retValue);
        }
Beispiel #4
0
 internal static android.widget.ExpandableListConnector.PositionMetadata obtain(int
                                                                                flatListPos, int type, int groupPos, int childPos, android.widget.ExpandableListConnector
                                                                                .GroupMetadata groupMetadata, int groupInsertIndex)
 {
     android.widget.ExpandableListConnector.PositionMetadata pm = getRecycledOrCreate(
         );
     pm.position = android.widget.ExpandableListPosition.obtain(type, groupPos, childPos
                                                                , flatListPos);
     pm.groupMetadata    = groupMetadata;
     pm.groupInsertIndex = groupInsertIndex;
     return(pm);
 }
Beispiel #5
0
        /// <summary>Collapse a group in the grouped list view</summary>
        /// <param name="groupPos">position of the group to collapse</param>
        internal virtual bool collapseGroup(int groupPos)
        {
            android.widget.ExpandableListConnector.PositionMetadata pm = getFlattenedPos(android.widget.ExpandableListPosition
                                                                                         .obtain(android.widget.ExpandableListPosition.GROUP, groupPos, -1, -1));
            if (pm == null)
            {
                return(false);
            }
            bool retValue = collapseGroup(pm);

            pm.recycle();
            return(retValue);
        }
Beispiel #6
0
 internal virtual bool collapseGroup(android.widget.ExpandableListConnector.PositionMetadata
                                     posMetadata)
 {
     if (posMetadata.groupMetadata == null)
     {
         return(false);
     }
     // Remove the group from the list of expanded groups
     mExpGroupMetadataList.remove(posMetadata.groupMetadata);
     // Refresh the metadata
     refreshExpGroupMetadataList(false, false);
     // Notify of change
     notifyDataSetChanged();
     // Give the callback
     mExpandableListAdapter.onGroupCollapsed(posMetadata.groupMetadata.gPos);
     return(true);
 }
Beispiel #7
0
 internal virtual bool expandGroup(android.widget.ExpandableListConnector.PositionMetadata
                                   posMetadata)
 {
     if (posMetadata.position.groupPos < 0)
     {
         // TODO clean exit
         throw new java.lang.RuntimeException("Need group");
     }
     if (mMaxExpGroupCount == 0)
     {
         return(false);
     }
     // Check to see if it's already expanded
     if (posMetadata.groupMetadata != null)
     {
         return(false);
     }
     if (mExpGroupMetadataList.size() >= mMaxExpGroupCount)
     {
         // TODO: Collapse something not on the screen instead of the first one?
         // TODO: Could write overloaded function to take GroupMetadata to collapse
         android.widget.ExpandableListConnector.GroupMetadata collapsedGm = mExpGroupMetadataList
                                                                            .get(0);
         int collapsedIndex = mExpGroupMetadataList.indexOf(collapsedGm);
         collapseGroup(collapsedGm.gPos);
         if (posMetadata.groupInsertIndex > collapsedIndex)
         {
             posMetadata.groupInsertIndex--;
         }
     }
     android.widget.ExpandableListConnector.GroupMetadata expandedGm = android.widget.ExpandableListConnector
                                                                       .GroupMetadata.obtain(android.widget.ExpandableListConnector.GroupMetadata.REFRESH
                                                                                             , android.widget.ExpandableListConnector.GroupMetadata.REFRESH, posMetadata.position
                                                                                             .groupPos, mExpandableListAdapter.getGroupId(posMetadata.position.groupPos));
     mExpGroupMetadataList.add(posMetadata.groupInsertIndex, expandedGm);
     // Refresh the metadata
     refreshExpGroupMetadataList(false, false);
     // Notify of change
     notifyDataSetChanged();
     // Give the callback
     mExpandableListAdapter.onGroupExpanded(expandedGm.gPos);
     return(true);
 }