public virtual Com.Zhy.Adapter.Recyclerview.MultiItemTypeAdapter <T> AddItemViewDelegate (int viewType, Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> itemViewDelegate ) { mItemViewDelegateManager.AddDelegate(viewType, itemViewDelegate); return(this); }
public virtual Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegateManager <T> AddDelegate (int viewType, Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_) { if (delegates.Get(viewType) != null) { throw new System.ArgumentException("An ItemViewDelegate is already registered for the viewType = " + viewType + ". Already registered ItemViewDelegate is " + delegates.Get(viewType )); } delegates.Put(viewType, delegate_); return(this); }
public virtual Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegateManager <T> AddDelegate (Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_) { int viewType = delegates.Size(); if (delegate_ != null) { delegates.Put(viewType, delegate_); viewType++; } return(this); }
public override Android.Support.V7.Widget.RecyclerView.ViewHolder OnCreateViewHolder(Android.Views.ViewGroup parent, int viewType) { Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> itemViewDelegate = mItemViewDelegateManager .GetItemViewDelegate(viewType); int layoutId = itemViewDelegate.GetItemViewLayoutId(); Com.Zhy.Adapter.Recyclerview.Base.ViewHolder holder = Com.Zhy.Adapter.Recyclerview.Base.ViewHolder .CreateViewHolder(mContext, parent, layoutId); OnViewHolderCreated(holder, holder.GetConvertView()); SetListener(parent, holder, viewType); return(holder); }
public virtual Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegateManager <T> RemoveDelegate (Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_) { if (delegate_ == null) { throw new System.ArgumentNullException("ItemViewDelegate is null"); } int indexToRemove = delegates.IndexOfValue(delegate_); if (indexToRemove >= 0) { delegates.RemoveAt(indexToRemove); } return(this); }
public virtual int GetItemViewType(T item, int position) { int delegatesCount = delegates.Size(); for (int i = delegatesCount - 1; i >= 0; i--) { Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_ = delegates.ValueAt (i); if (delegate_.IsForViewType(item, position)) { return(delegates.KeyAt(i)); } } throw new System.ArgumentException("No ItemViewDelegate added that matches position=" + position + " in data source"); }
public virtual void Convert(Com.Zhy.Adapter.Recyclerview.Base.ViewHolder holder, T item, int position) { int delegatesCount = delegates.Size(); for (int i = 0; i < delegatesCount; i++) { Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_ = delegates.ValueAt (i); if (delegate_.IsForViewType(item, position)) { delegate_.Convert(holder, item, position); return; } } throw new System.ArgumentException("No ItemViewDelegateManager added that matches position=" + position + " in data source"); }
public virtual int GetItemViewType(Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> itemViewDelegate) { return(delegates.IndexOfValue(itemViewDelegate)); }