/// <summary>Sets the children Cursor for a particular group.</summary> /// <remarks> /// Sets the children Cursor for a particular group. If there is an existing cursor /// it will be closed. /// <p> /// This is useful when asynchronously querying to prevent blocking the UI. /// </remarks> /// <param name="groupPosition">The group whose children are being set via this Cursor. /// </param> /// <param name="childrenCursor">The Cursor that contains the children of the group.</param> public virtual void setChildrenCursor(int groupPosition, android.database.Cursor childrenCursor) { android.widget.CursorTreeAdapter.MyCursorHelper childrenCursorHelper = getChildrenCursorHelper (groupPosition, false); childrenCursorHelper.changeCursor(childrenCursor, false); }
/// <summary>Deactivates the Cursor and removes the helper from cache.</summary> /// <remarks>Deactivates the Cursor and removes the helper from cache.</remarks> /// <param name="groupPosition"> /// The group whose children Cursor and helper should be /// deactivated. /// </param> internal virtual void deactivateChildrenCursorHelper(int groupPosition) { lock (this) { android.widget.CursorTreeAdapter.MyCursorHelper cursorHelper = getChildrenCursorHelper (groupPosition, true); mChildrenCursorHelpers.remove(groupPosition); cursorHelper.deactivate(); } }
private void init(android.database.Cursor cursor, android.content.Context context , bool autoRequery) { mContext = context; mHandler = new android.os.Handler(); mAutoRequery = autoRequery; mGroupCursorHelper = new android.widget.CursorTreeAdapter.MyCursorHelper(this, cursor ); mChildrenCursorHelpers = new android.util.SparseArray<android.widget.CursorTreeAdapter .MyCursorHelper>(); }
private void init(android.database.Cursor cursor, android.content.Context context , bool autoRequery) { mContext = context; mHandler = new android.os.Handler(); mAutoRequery = autoRequery; mGroupCursorHelper = new android.widget.CursorTreeAdapter.MyCursorHelper(this, cursor ); mChildrenCursorHelpers = new android.util.SparseArray <android.widget.CursorTreeAdapter .MyCursorHelper>(); }
/// <summary>Gets the cursor helper for the children in the given group.</summary> /// <remarks>Gets the cursor helper for the children in the given group.</remarks> /// <param name="groupPosition">The group whose children will be returned</param> /// <param name="requestCursor"> /// Whether to request a Cursor via /// <see cref="getChildrenCursor(android.database.Cursor)">getChildrenCursor(android.database.Cursor) /// </see> /// (true), or to assume a call /// to /// <see cref="setChildrenCursor(int, android.database.Cursor)">setChildrenCursor(int, android.database.Cursor) /// </see> /// will happen shortly /// (false). /// </param> /// <returns>The cursor helper for the children of the given group</returns> internal virtual android.widget.CursorTreeAdapter.MyCursorHelper getChildrenCursorHelper (int groupPosition, bool requestCursor) { lock (this) { android.widget.CursorTreeAdapter.MyCursorHelper cursorHelper = mChildrenCursorHelpers .get(groupPosition); if (cursorHelper == null) { if (mGroupCursorHelper.moveTo(groupPosition) == null) { return(null); } android.database.Cursor cursor = getChildrenCursor(mGroupCursorHelper.getCursor() ); cursorHelper = new android.widget.CursorTreeAdapter.MyCursorHelper(this, cursor); mChildrenCursorHelpers.put(groupPosition, cursorHelper); } return(cursorHelper); } }
public override android.view.View getChildView(int groupPosition, int childPosition , bool isLastChild, android.view.View convertView, android.view.ViewGroup parent ) { android.widget.CursorTreeAdapter.MyCursorHelper cursorHelper = getChildrenCursorHelper (groupPosition, true); android.database.Cursor cursor = cursorHelper.moveTo(childPosition); if (cursor == null) { throw new System.InvalidOperationException("this should only be called when the cursor is valid" ); } android.view.View v; if (convertView == null) { v = newChildView(mContext, cursor, isLastChild, parent); } else { v = convertView; } bindChildView(v, mContext, cursor, isLastChild); return(v); }
/// <summary>Gets the cursor helper for the children in the given group.</summary> /// <remarks>Gets the cursor helper for the children in the given group.</remarks> /// <param name="groupPosition">The group whose children will be returned</param> /// <param name="requestCursor"> /// Whether to request a Cursor via /// <see cref="getChildrenCursor(android.database.Cursor)">getChildrenCursor(android.database.Cursor) /// </see> /// (true), or to assume a call /// to /// <see cref="setChildrenCursor(int, android.database.Cursor)">setChildrenCursor(int, android.database.Cursor) /// </see> /// will happen shortly /// (false). /// </param> /// <returns>The cursor helper for the children of the given group</returns> internal virtual android.widget.CursorTreeAdapter.MyCursorHelper getChildrenCursorHelper (int groupPosition, bool requestCursor) { lock (this) { android.widget.CursorTreeAdapter.MyCursorHelper cursorHelper = mChildrenCursorHelpers .get(groupPosition); if (cursorHelper == null) { if (mGroupCursorHelper.moveTo(groupPosition) == null) { return null; } android.database.Cursor cursor = getChildrenCursor(mGroupCursorHelper.getCursor() ); cursorHelper = new android.widget.CursorTreeAdapter.MyCursorHelper(this, cursor); mChildrenCursorHelpers.put(groupPosition, cursorHelper); } return cursorHelper; } }
public override int getChildrenCount(int groupPosition) { android.widget.CursorTreeAdapter.MyCursorHelper helper = getChildrenCursorHelper( groupPosition, true); return((mGroupCursorHelper.isValid() && helper != null) ? helper.getCount() : 0); }