Ejemplo n.º 1
0
        //初始化item
        void InitItem(int index)
        {
            if (loadItems[index] == null)
            {
                loadItems[index] = CreateItem();
            }

            if (loadWindow.Content[index] >= 0 && loadWindow.Content[index] < mAdapter.GetCount())
            {
                mAdapter.InitItem(loadItems[index], mAdapter.GetItem(loadWindow.Content[index]));
            }
        }
Ejemplo n.º 2
0
            public Java.Lang.Object GetItem(int position)
            {
                int numHeadersAndPlaceholders = HeadersCount * mNumColumns;

                if (position < numHeadersAndPlaceholders)
                {
                    if (position % mNumColumns == 0)
                    {
                        return(mHeaderViewInfos[position / mNumColumns].data);
                    }
                    return(null);
                }
                int adjPosition  = position - numHeadersAndPlaceholders;
                int adapterCount = 0;

                if (mAdapter != null)
                {
                    adapterCount = mAdapter.Count;
                    if (adjPosition < adapterCount)
                    {
                        return(mAdapter.GetItem(adjPosition));
                    }
                }
                throw new System.IndexOutOfRangeException(position.ToString());
            }
			Java.Lang.Object IAdapter.GetItem (int position)
			{
				// Header (negative positions will throw an ArrayIndexOutOfBoundsException)
				int numHeadersAndPlaceholders = getHeadersCount() * _numColumns;
				if (position < numHeadersAndPlaceholders) {
					if (position % _numColumns == 0) {
						return (Java.Lang.Object)_headerViewInfos.ElementAt(position / _numColumns).data;
					}
					return null;
				}

				// Adapter
				int adjPosition = position - numHeadersAndPlaceholders;
				int adapterCount = 0;
				if (mAdapter != null) {
					adapterCount = getAdapterAndPlaceHolderCount();
					if (adjPosition < adapterCount) {
						if (adjPosition < mAdapter.Count) {
							return mAdapter.GetItem(adjPosition);
						} else {
							return null;
						}
					}
				}

				// Footer (off-limits positions will throw an IndexOutOfBoundsException)
				int footerPosition = adjPosition - adapterCount;
				if (footerPosition % _numColumns == 0) {
					return (Java.Lang.Object)_footerViewInfos.ElementAt(footerPosition).data;
				} else {
					return null;
				}
			}
        public Java.Lang.Object GetItem(int position)
        {
            // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
            int numHeaders = HeadersCount;

            if (position < numHeaders)
            {
                return(mHeaderViewInfos[position].Data);
            }

            // Adapter
            int adjPosition  = position - numHeaders;
            int adapterCount = 0;

            if (mAdapter != null)
            {
                adapterCount = mAdapter.Count;
                if (adjPosition < adapterCount)
                {
                    return(mAdapter.GetItem(adjPosition));
                }
            }

            // Footer (off-limits positions will throw an ArrayIndexOutOfBoundsException)
            return(mFooterViewInfos[adjPosition - adapterCount].Data);
        }
Ejemplo n.º 5
0
            public Java.Lang.Object GetItem(int position)
            {
                // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
                int numHeadersAndPlaceholders = HeadersCount * mNumColumns;

                if (position < numHeadersAndPlaceholders)
                {
                    if (position % mNumColumns == 0)
                    {
                        return(mHeaderViewInfos[position / mNumColumns].data);
                    }
                    return(null);
                }

                // Adapter
                if (position < numHeadersAndPlaceholders + mAdapter.Count)
                {
                    int adjPosition  = position - numHeadersAndPlaceholders;
                    int adapterCount = 0;
                    if (mAdapter != null)
                    {
                        adapterCount = mAdapter.Count;
                        if (adjPosition < adapterCount)
                        {
                            return(mAdapter.GetItem(adjPosition));
                        }
                    }
                }

                int lastRowItemCount = (mAdapter.Count % mNumColumns);
                int emptyItemCount   = ((lastRowItemCount == 0) ? 0 : mNumColumns - lastRowItemCount);

                if (position < numHeadersAndPlaceholders + mAdapter.Count + emptyItemCount)
                {
                    return(null);
                }

                // Footer
                int numFootersAndPlaceholders = FootersCount * mNumColumns;

                if (position < numHeadersAndPlaceholders + mAdapter.Count + emptyItemCount + numFootersAndPlaceholders)
                {
                    if (position % mNumColumns == 0)
                    {
                        return(mFooterViewInfos[(position - numHeadersAndPlaceholders - mAdapter.Count - emptyItemCount) / mNumColumns].data);
                    }
                }

                throw new System.IndexOutOfRangeException(position.ToString());
            }
Ejemplo n.º 6
0
            public Object GetItem(int position)
            {
                // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
                int numHeadersAndPlaceholders = GetHeadersCount() * _numColumns;

                if (position < numHeadersAndPlaceholders)
                {
                    if (position % _numColumns == 0)
                    {
                        return(_headerViewInfos[position / _numColumns].Data);
                    }
                    return(null);
                }

                // Adapter
                int adjPosition  = position - numHeadersAndPlaceholders;
                int adapterCount = 0;

                if (_adapter != null)
                {
                    adapterCount = GetAdapterAndPlaceHolderCount();
                    if (adjPosition < adapterCount)
                    {
                        if (adjPosition < _adapter.Count)
                        {
                            return(_adapter.GetItem(adjPosition));
                        }
                        return(null);
                    }
                }

                // Footer (off-limits positions will throw an IndexOutOfBoundsException)
                int footerPosition = adjPosition - adapterCount;

                if (footerPosition % _numColumns == 0)
                {
                    return(_footerViewInfos[footerPosition].Data);
                }
                return(null);
            }
Ejemplo n.º 7
0
 public override Java.Lang.Object GetItem(int position)
 {
     return(mAdapter.GetItem(position));
 }
Ejemplo n.º 8
0
 public Object GetItem(int position)
 {
     return(mAdapter.GetItem(position));
 }
Ejemplo n.º 9
0
 public override Java.Lang.Object GetItem(int position)
 {
     Java.Lang.Object item = _wrappedAdapter.GetItem(position);
     return(item);
 }