public object this[int aPosition] { get { SectionHeader <SectionHeaderType> header = GetSectionHeader(aPosition); if (header != null) { // user has clicked on a header return(header.Header); } // user has clicked on an item, return it if loaded, or null if not int loaderPosition = GetLoaderPosition(aPosition); return(iLoader.Item(loaderPosition)); } }
private void EventMoveDownHandler(object sender, EventArgs args) { RecyclingContainerView senderView = sender as RecyclingContainerView; ViewCache cache = senderView.Tag as ViewCache; Assert.Check(cache != null); int position = cache.Position; SectionHeader <SectionHeaderType> header = GetSectionHeader(position); if (header != null) { OnEventSectionMovedDown(header.Header, position); } else { int loaderPosition = GetLoaderPosition(position); ItemType item = iLoader.Item(loaderPosition); Assert.Check(item != null); OnEventItemMovedDown(item, position); } }
public override View GetView(int aPosition, View aConvertView, ViewGroup aParent) { RecyclingContainerView root = aConvertView as RecyclingContainerView; if (root == null) { root = CreateContainerView(iContext); } else if (root.HasResurfacedWithoutJNIHandle) { UserLog.WriteLine("Ticket #1194: Item has resurfaced after dispose! - " + iId); Assert.Check(false); } ViewCache cache = root.Tag as ViewCache; Assert.Check(cache != null); cache.Position = aPosition; SectionHeader <SectionHeaderType> header = GetSectionHeader(aPosition); ItemType item = default(ItemType); bool isPlaceholder = false; if (header != null) { SetHeader(root, header); } else { int loaderPosition = GetLoaderPosition(aPosition); item = iLoader.Item(loaderPosition); if (item != null) { SetItem(root, item); } else { SetItem(root, default(ItemType)); isPlaceholder = true; } } if (iEditMode && !isPlaceholder) { root.EditMode = aPosition == iDeleteIndex ? EItemEditMode.ConfirmDelete : EItemEditMode.Editing; if (header != null) { root.CanDelete = CanDeleteSection(header.Header, aPosition); root.CanMoveUp = CanMoveSectionUp(header.Header, aPosition); root.CanMoveDown = CanMoveSectionDown(header.Header, aPosition); } else { root.CanDelete = CanDeleteItem(item, aPosition); root.CanMoveUp = CanMoveItemUp(item, aPosition); root.CanMoveDown = CanMoveItemDown(item, aPosition); } } else { root.EditMode = EItemEditMode.None; } root.IsFirst = aPosition == 0; root.IsLast = aPosition == Count - 1; return(root); }