public void AddFooterView(View v, Object data, bool isSelectable) { IListAdapter mAdapter = Adapter; if (mAdapter != null && !(mAdapter is HeaderViewGridAdapter)) { throw new Java.Lang.IllegalStateException( "Cannot add header view to grid -- setAdapter has already been called."); } ViewGroup.LayoutParams lyp = v.LayoutParameters; FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(Context,this); if (lyp != null) { v.LayoutParameters=new FrameLayout.LayoutParams(lyp.Width, lyp.Height); fl.LayoutParameters=new AbsListView.LayoutParams(lyp.Width, lyp.Height); } fl.AddView(v); info.view = v; info.viewContainer = fl; info.data = data; info.isSelectable = isSelectable; _footerViewInfos.Add(info); if (mAdapter != null) { ((HeaderViewGridAdapter) mAdapter).notifyDataSetChanged(); } }
public void AddFooterView(View v, Java.Lang.Object data, bool isSelectable) { IListAdapter adapter = (IListAdapter)Adapter; if (adapter != null && !(adapter is HeaderFooterViewGridAdapter)) { throw new IllegalStateException("Cannot add footer view to grid -- setAdapter has already been called."); } FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(this, Context); fl.AddView(v); info.view = v; info.viewContainer = fl; info.data = data; info.isSelectable = isSelectable; mFooterViewInfos.Add(info); // in the case of re-adding a header view, or adding one later on, // we need to notify the observer if (adapter != null) { ((HeaderFooterViewGridAdapter)adapter).notifyDataSetChanged(); } }
/** * Add a fixed view to appear at the top of the grid. If addHeaderView is * called more than once, the views will appear in the order they were * added. Views added using this call can take focus if they want. * <p/> * NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap * the supplied cursor with one that will also account for header views. * * @param v The view to add. * @param data Data to associate with this view * @param isSelectable whether the item is selectable */ public void AddHeaderView(View v, Object data, bool isSelectable) { IListAdapter adapter = Adapter; if (adapter != null && !(adapter is HeaderViewGridAdapter)) { throw new Java.Lang.IllegalStateException( "Cannot add header view to grid -- setAdapter has already been called."); } ViewGroup.LayoutParams lyp = v.LayoutParameters; FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(Context,this); if (lyp == null) { lyp = new ViewGroup.LayoutParams (WindowManagerLayoutParams.MatchParent,WindowManagerLayoutParams.MatchParent); } if (lyp != null) { v.LayoutParameters=new FrameLayout.LayoutParams(lyp.Width, lyp.Height); fl.LayoutParameters=new AbsListView.LayoutParams(lyp.Width, lyp.Height); } fl.AddView(v); info.view = v; info.viewContainer = fl; info.data = data; info.isSelectable = isSelectable; _headerViewInfos.Add(info); // in the case of re-adding a header view, or adding one later on, // we need to notify the observer if (adapter != null) { ((HeaderViewGridAdapter) adapter).notifyDataSetChanged(); } }
private void RemoveFixedViewInfo(View v, List<FixedViewInfo> where) { int len = where.Count; for (int i = 0; i < len; ++i) { FixedViewInfo info = where[i]; if (info.view == v) { where.RemoveAt(i); break; } } }
public bool removeFooter(View v) { for (int i = 0; i < _footerViewInfos.Count; i++) { FixedViewInfo info = _footerViewInfos.ElementAt(i); if (info.view == v) { _footerViewInfos.RemoveAt(i); areAllFixedViewsSelectable = areAllListInfosSelectable(_headerViewInfos) && areAllListInfosSelectable(_footerViewInfos); dataSetObservable.NotifyChanged(); return true; } } return false; }
private void RemoveFixedViewInfo(View v, List<FixedViewInfo> list) { int len = list.Count; for (int i = 0; i < len; ++i) { FixedViewInfo info = list[i]; if (info.view == v) { list.RemoveAt(i); break; } } }
public bool RemoveHeader(View v) { for (int i = 0; i < mHeaderViewInfos.Count; i++) { FixedViewInfo info = mHeaderViewInfos[i]; if (info.view == v) { mHeaderViewInfos.RemoveAt(i); mAreAllFixedViewsSelectable = AreAllListInfosSelectable(mHeaderViewInfos); mDataSetObservable.NotifyChanged(); return(true); } } return(false); }
public bool RemoveFooter(View v) { for (int i = 0; i < _footerViewInfos.Count; i++) { FixedViewInfo info = _footerViewInfos[i]; if (info.View == v) { _footerViewInfos.RemoveAt(i); _areAllFixedViewsSelectable = AreAllListInfosSelectable(_headerViewInfos) && AreAllListInfosSelectable(_footerViewInfos); _dataSetObservable.NotifyChanged(); return(true); } } return(false); }
public bool RemoveFooter(View v) { for (int i = 0; i < mFooterViewInfos.Count; i++) { FixedViewInfo info = mFooterViewInfos[i]; if (info.view == v) { mFooterViewInfos.RemoveAt(i); mAreAllFixedViewsSelectable = (AreAllListInfosSelectable(mHeaderViewInfos) && AreAllListInfosSelectable(mFooterViewInfos)); mDataSetObservable.NotifyChanged(); return true; } } return false; }
private IList <FixedViewInfo> GetFixedViewInfos(int id) { var viewInfos = new List <FixedViewInfo>(); View view = GetBoundView(id); if (view != null) { var info = new FixedViewInfo(this) { Data = null, IsSelectable = true, View = view, }; viewInfos.Add(info); } return(viewInfos); }
public void AddHeaderView(View v, Object data, bool isSelectable) { IListAdapter adapter = Adapter; if (adapter != null && !(adapter is HeaderViewGridAdapter)) { throw new IllegalStateException("Cannot add header view to grid -- setAdapter has already been called."); } FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(this, Context); fl.AddView(v); info.View = v; info.ViewContainer = fl; info.Data = data; info.IsSelectable = isSelectable; _mHeaderViewInfos.Add(info); // in the case of re-adding a header view, or adding one later on, // we need to notify the observer if (adapter != null) { ((HeaderViewGridAdapter)adapter).NotifyDataSetChanged(); } }