public WFHeaderViewHolder(AView view) : base(view) { ItemView = view; var lParams = new StaggeredGridLayoutManager.LayoutParams(ItemView.LayoutParameters); lParams.FullSpan = true; ItemView.LayoutParameters = lParams; }
protected void SetFullSpan(RecyclerView.ViewHolder holder) { if (holder.ItemView.LayoutParameters is StaggeredGridLayoutManager.LayoutParams) { StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams)holder .ItemView.LayoutParameters; p.FullSpan = true; } }
protected virtual void TuneSectionFooter(bool first, bool last, RecyclerView.ViewHolder viewHolder) { var layoutParams = new StaggeredGridLayoutManager.LayoutParams(viewHolder.ItemView.LayoutParameters); layoutParams.FullSpan = true; viewHolder.ItemView.LayoutParameters = layoutParams; SetupFooterView(viewHolder.ItemView); (viewHolder as IMvxRecyclerViewHolder).DataContext = BindingContext.DataContext; }
private View createSpViewByType(ViewGroup parent, int viewType) { foreach (ItemView headerView in headers) { if (headerView.GetHashCode() == viewType) { View view = headerView.onCreateView(parent); StaggeredGridLayoutManager.LayoutParams layoutParams; if (view.LayoutParameters != null) { layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.LayoutParameters); } else { layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); } layoutParams.FullSpan = true; view.LayoutParameters = layoutParams; return(view); } } foreach (ItemView footerview in footers) { if (footerview.GetHashCode() == viewType) { View view = footerview.onCreateView(parent); StaggeredGridLayoutManager.LayoutParams layoutParams; if (view.LayoutParameters != null) { layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.LayoutParameters); } else { layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); } layoutParams.FullSpan = true; view.LayoutParameters = layoutParams; return(view); } } return(null); }
private View CreateSpViewByType(ViewGroup parent, int viewType) { foreach (var view in from headerView in headers where headerView.GetHashCode() == viewType select headerView.OnCreateView(parent)) { StaggeredGridLayoutManager.LayoutParams layoutParams; if (view.LayoutParameters != null) { layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.LayoutParameters); } else { layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); } layoutParams.FullSpan = true; view.LayoutParameters = layoutParams; return(view); } foreach (var view in from footer in footers where footer.GetHashCode() == viewType select footer.OnCreateView(parent)) { StaggeredGridLayoutManager.LayoutParams layoutParams; if (view.LayoutParameters != null) { layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.LayoutParameters); } else { layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); } layoutParams.FullSpan = true; view.LayoutParameters = layoutParams; return(view); } return(null); }
OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var Product = _grid.ItemsSource[position]; if (Product.Index != -1) { MarketViewHolder vh = holder as MarketViewHolder; var height = Product.LayoutOption == 1 ? DpToPixels(150) : DpToPixels(90); if (!string.IsNullOrWhiteSpace(Product.MainImage)) { ImageService.Instance.LoadUrl(Product.MainImage, TimeSpan.FromMinutes(1)) .LoadingPlaceholder("placeholderimg", FFImageLoading.Work.ImageSource.CompiledResource) //.LoadingPlaceholder(Product.Thumbnail, FFImageLoading.Work.ImageSource.Url) .Retry(3, 200) .DownSample(height: height) .Into(vh.Image); } else { ImageService.Instance.LoadCompiledResource("placeholderimg") .LoadingPlaceholder("placeholderimg", FFImageLoading.Work.ImageSource.CompiledResource) .DownSample(height: height) .Into(vh.Image); } vh.Title.Text = Product.Title; vh.Seller.Text = Product.Seller; vh.Price.Text = Product.Price; } else { StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams)holder.ItemView.LayoutParameters; layoutParams.FullSpan = true; } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var isHeader = holder is WFGroupHeaderViewHolder; var itemView = holder.ItemView; var element = (itemView as VisualElementRenderer <View>).Element; var dpHeight = 0; int pxHeight; var dpWidth = (int)ItemWidth; if (holder is WFHeaderViewHolder) { dpHeight = (int)Element.Header.HeightRequest; element.Layout(new Rectangle(0, 0, Element.Width, dpHeight)); pxHeight = DroidUtils.DpToPixel(dpHeight); var pxWidth = DroidUtils.DpToPixel((int)Element.Width); var layoutParams = new ViewGroup.LayoutParams(pxWidth, pxHeight); itemView.LayoutParameters = layoutParams; itemView.Layout(0, 0, pxWidth, pxHeight); var lParams = new StaggeredGridLayoutManager.LayoutParams(itemView.LayoutParameters); lParams.FullSpan = true; itemView.LayoutParameters = lParams; return; } if (Element.Header != null) { position--; //because the first index is the Header View } element.BindingContext = SourceList[position]; if (holder is WFGroupHeaderViewHolder) { (holder as WFGroupHeaderViewHolder).BindingContext = element.BindingContext; dpHeight = (int)Element.HeaderTemplateHeight; element.Layout(new Rectangle(0, 0, Element.Width, dpHeight)); pxHeight = DroidUtils.DpToPixel(dpHeight); var pxWidth = DroidUtils.DpToPixel((int)Element.Width); var layoutParams = new ViewGroup.LayoutParams(pxWidth, pxHeight); itemView.LayoutParameters = layoutParams; itemView.Layout(0, 0, pxWidth, pxHeight); var lParams = new StaggeredGridLayoutManager.LayoutParams(itemView.LayoutParameters); lParams.FullSpan = true; itemView.LayoutParameters = lParams; } else { (holder as WFViewHolder).BindingContext = element.BindingContext; if (Element.GetHeightForCellDelegate != null) { dpHeight = (int)Element.GetHeightForCellDelegate(SourceList[position]); } else { dpHeight = _heights[position]; } element.Layout(new Rectangle(0, 0, dpWidth, dpHeight)); pxHeight = DroidUtils.DpToPixel(dpHeight); var pxWidth = DroidUtils.DpToPixel((int)ItemWidth); var layoutParams = new ViewGroup.LayoutParams(pxWidth, pxHeight); itemView.LayoutParameters = layoutParams; itemView.Layout(0, 0, pxWidth, pxHeight); } }