Exemple #1
0
 /// <summary>Constructs the connector</summary>
 public ExpandableListConnector(android.widget.ExpandableListAdapter expandableListAdapter
                                )
 {
     mDataSetObserver = new android.widget.ExpandableListConnector.MyDataSetObserver(this
                                                                                     );
     mExpGroupMetadataList = new java.util.ArrayList <android.widget.ExpandableListConnector
                                                      .GroupMetadata>();
     setExpandableListAdapter(expandableListAdapter);
 }
Exemple #2
0
 /// <summary>
 /// Point to the
 /// <see cref="ExpandableListAdapter">ExpandableListAdapter</see>
 /// that will give us data/Views
 /// </summary>
 /// <param name="expandableListAdapter">the adapter that supplies us with data/Views</param>
 public virtual void setExpandableListAdapter(android.widget.ExpandableListAdapter
                                              expandableListAdapter)
 {
     if (mExpandableListAdapter != null)
     {
         mExpandableListAdapter.unregisterDataSetObserver(mDataSetObserver);
     }
     mExpandableListAdapter = expandableListAdapter;
     expandableListAdapter.registerDataSetObserver(mDataSetObserver);
 }
Exemple #3
0
 public virtual void setListAdapter(android.widget.ExpandableListAdapter arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.app.ExpandableListActivity._setListAdapter543, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.app.ExpandableListActivity.staticClass, global::android.app.ExpandableListActivity._setListAdapter543, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
Exemple #4
0
 public virtual android.widget.Filter getFilter()
 {
     android.widget.ExpandableListAdapter adapter = getAdapter();
     if (adapter is android.widget.Filterable)
     {
         return(((android.widget.Filterable)adapter).getFilter());
     }
     else
     {
         return(null);
     }
 }
Exemple #5
0
 internal virtual void getSectionsFromIndexer()
 {
     android.widget.Adapter adapter = mList.getAdapter();
     mSectionIndexer = null;
     if (adapter is android.widget.HeaderViewListAdapter)
     {
         mListOffset = ((android.widget.HeaderViewListAdapter)adapter).getHeadersCount();
         adapter     = ((android.widget.HeaderViewListAdapter)adapter).getWrappedAdapter();
     }
     if (adapter is android.widget.ExpandableListConnector)
     {
         android.widget.ExpandableListAdapter expAdapter = ((android.widget.ExpandableListConnector
                                                             )adapter).getAdapter();
         if (expAdapter is android.widget.SectionIndexer)
         {
             mSectionIndexer = (android.widget.SectionIndexer)expAdapter;
             mListAdapter    = (android.widget.BaseAdapter)adapter;
             mSections       = mSectionIndexer.getSections();
         }
     }
     else
     {
         if (adapter is android.widget.SectionIndexer)
         {
             mListAdapter    = (android.widget.BaseAdapter)adapter;
             mSectionIndexer = (android.widget.SectionIndexer)adapter;
             mSections       = mSectionIndexer.getSections();
             if (mSections == null)
             {
                 mSections = new string[] { " " };
             }
         }
         else
         {
             mListAdapter = (android.widget.BaseAdapter)adapter;
             mSections    = new string[] { " " };
         }
     }
 }
Exemple #6
0
        /// <summary>
        /// Searches the expandable list adapter for a group position matching the
        /// given group ID.
        /// </summary>
        /// <remarks>
        /// Searches the expandable list adapter for a group position matching the
        /// given group ID. The search starts at the given seed position and then
        /// alternates between moving up and moving down until 1) we find the right
        /// position, or 2) we run out of time, or 3) we have looked at every
        /// position
        /// </remarks>
        /// <returns>
        /// Position of the row that matches the given row ID, or
        /// <see cref="android.widget.AdapterView.INVALID_POSITION">android.widget.AdapterView.INVALID_POSITION
        ///     </see>
        /// if it can't be found
        /// </returns>
        /// <seealso cref="AdapterView{T}.findSyncPosition()">AdapterView&lt;T&gt;.findSyncPosition()
        ///     </seealso>
        internal virtual int findGroupPosition(long groupIdToMatch, int seedGroupPosition
                                               )
        {
            int count = mExpandableListAdapter.getGroupCount();

            if (count == 0)
            {
                return(android.widget.AdapterView.INVALID_POSITION);
            }
            // If there isn't a selection don't hunt for it
            if (groupIdToMatch == android.widget.AdapterView.INVALID_ROW_ID)
            {
                return(android.widget.AdapterView.INVALID_POSITION);
            }
            // Pin seed to reasonable values
            seedGroupPosition = System.Math.Max(0, seedGroupPosition);
            seedGroupPosition = System.Math.Min(count - 1, seedGroupPosition);
            long endTime = android.os.SystemClock.uptimeMillis() + android.widget.AdapterView.SYNC_MAX_DURATION_MILLIS;
            long rowId;
            // first position scanned so far
            int first = seedGroupPosition;
            // last position scanned so far
            int last = seedGroupPosition;
            // True if we should move down on the next iteration
            bool next = false;
            // True when we have looked at the first item in the data
            bool hitFirst;
            // True when we have looked at the last item in the data
            bool hitLast;

            // Get the item ID locally (instead of getItemIdAtPosition), so
            // we need the adapter
            android.widget.ExpandableListAdapter adapter = getAdapter();
            if (adapter == null)
            {
                return(android.widget.AdapterView.INVALID_POSITION);
            }
            while (android.os.SystemClock.uptimeMillis() <= endTime)
            {
                rowId = adapter.getGroupId(seedGroupPosition);
                if (rowId == groupIdToMatch)
                {
                    // Found it!
                    return(seedGroupPosition);
                }
                hitLast  = last == count - 1;
                hitFirst = first == 0;
                if (hitLast && hitFirst)
                {
                    // Looked at everything
                    break;
                }
                if (hitFirst || (next && !hitLast))
                {
                    // Either we hit the top, or we are trying to move down
                    last++;
                    seedGroupPosition = last;
                    // Try going up next time
                    next = false;
                }
                else
                {
                    if (hitLast || (!next && !hitFirst))
                    {
                        // Either we hit the bottom, or we are trying to move up
                        first--;
                        seedGroupPosition = first;
                        // Try going down next time
                        next = true;
                    }
                }
            }
            return(android.widget.AdapterView.INVALID_POSITION);
        }
Exemple #7
0
 public override bool isEmpty()
 {
     android.widget.ExpandableListAdapter adapter = getAdapter();
     return(adapter != null?adapter.isEmpty() : true);
 }
Exemple #8
0
 public virtual void setListAdapter(android.widget.ExpandableListAdapter adapter)
 {
     throw new System.NotImplementedException();
 }