Esempio n. 1
0
        public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView,
                                          ViewGroup parent)
        {
            var cell = convertView;

            var viewType = _provider.GetElementCellResource;

            if (cell == null || (cell.Tag as ViewHolder)?.ViewType != viewType)
            {
                cell = LayoutInflater.From(parent.Context).Inflate(viewType, parent, false);
                var vh = new ViewHolder(cell, null, viewType);
                _provider.RegisterCell(cell, vh, false);
                cell.Tag = vh;
            }

            var item = _provider.ElementForIndex(groupPosition, childPosition);

            var viewHolde = (ViewHolder)cell.Tag;

            viewHolde.Position = childPosition;

            _provider.BindElementCell(viewHolde, item);

            return(cell);
        }
Esempio n. 2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var cell = convertView;

            var viewType = _provider.GetCellResource(position);

            if (cell == null || (cell.Tag as ViewHolder)?.ViewType != viewType)
            {
                cell = LayoutInflater.From(parent.Context).Inflate(viewType, null);
                var vh = new ViewHolder(cell, this, viewType);
                _provider.RegisterCell(cell, vh);
                cell.Tag = vh;
            }

            var item      = this[position];
            var viewHolde = (ViewHolder)cell.Tag;

            viewHolde.Position = position;

            _provider.Bind(viewHolde, item);

            return(cell);
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var cell = convertView;

            if (SectionHeadersPositions.Contains(position))
            {
                var title = Provider.SectionTitle(SectionHeadersPositions.IndexOf(position));

                if (cell == null)
                {
                    cell = OnCreateHeaderViewCell(parent.Context);
                }

                OnSetSectionHeaderTitle(cell, title);

                return(cell);
            }

            if (cell == null)
            {
                cell = LayoutInflater.From(parent.Context).Inflate(Provider.ItemCell, null);


                var vh = new ViewHolder(cell, this);
                Provider.RegisterCell(cell, vh);
                cell.Tag = vh;
            }

            var item = this[position];

            ((ViewHolder)cell.Tag).Position = position;

            Provider.Bind((ViewHolder)cell.Tag, item);

            return(cell);
        }
Esempio n. 4
0
        public override View GetGroupView(int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
        {
            var cell = convertView;

            var viewType = _provider.GetHeaderCellResource;

            if (cell == null || (cell.Tag as ViewHolder)?.ViewType != viewType)
            {
                cell = LayoutInflater.From(parent.Context).Inflate(viewType, parent, false);
                var vh = new ViewHolder(cell, null, viewType, false);
                _provider.RegisterCell(cell, vh, true);
                cell.Tag = vh;
            }

            var item = _provider.ElementForSectionHeader(groupPosition);

            var viewHolde = (ViewHolder)cell.Tag;

            viewHolde.Position = groupPosition;

            _provider.BindHeaderCell(viewHolde, item);

            return(cell);
        }