Ejemplo n.º 1
0
        internal override void Reload(RecyclerViewObservableAdapterBase adapter)
        {
            var groupedAdapter = (RecyclerViewObservableGroupedAdapterBase)adapter;

            ItemsMap.Clear();
            ItemsMap.Add(ItemMap.CreateForHeader());

            var sectionsCount = groupedAdapter.GetSectionsCount();

            for (var section = 0; section < sectionsCount; section++)
            {
                ItemsMap.Add(ItemMap.CreateForSectionHeader(groupedAdapter.GetItemsGroup(section)?.Key));

                var sectionItemsCount = groupedAdapter.GetSectionItemsCount(section);

                for (var row = 0; row < sectionItemsCount; row++)
                {
                    ItemsMap.Add(ItemMap.CreateForItem(groupedAdapter.GetItem(section, row)));
                }

                ItemsMap.Add(ItemMap.CreateForSectionFooter(groupedAdapter.GetItemsGroup(section)?.Key));
            }

            ItemsMap.Add(ItemMap.CreateForFooter());

            groupedAdapter.NotifyDataSetChanged();
        }
Ejemplo n.º 2
0
        internal override void Reload(RecyclerViewObservableAdapter adapter)
        {
            ItemsMap.Clear();
            ItemsMap.Add(ItemMap.CreateForHeader());

            var sectionsCount = adapter.GetSectionsCount();

            for (var section = 0; section < sectionsCount; section++)
            {
                ItemsMap.Add(ItemMap.CreateForSectionHeader(null));

                var sectionItemsCount = adapter.GetSectionItemsCount(section);

                for (var row = 0; row < sectionItemsCount; row++)
                {
                    ItemsMap.Add(ItemMap.CreateForItem(adapter.GetItem(section, row)));
                }

                ItemsMap.Add(ItemMap.CreateForSectionFooter(null));
            }

            ItemsMap.Add(ItemMap.CreateForFooter());

            adapter.NotifyDataSetChanged();
        }