/// <summary>
        /// Initializes a new instance of the <see cref="ObservableRecyclerAdapter{TItem, THolder}"/> class.
        /// </summary>
        /// <param name="items">Backing data for the adapter.</param>
        /// <param name="dataTemplate">View binding definition.</param>
        /// <param name="itemTemplate">View inflation definition.</param>
        /// <param name="holderFactory">If not assigned make sure your ViewHolder has public constructor with <see cref="View"/> argument.</param>
        public ObservableRecyclerAdapter(
            IList <TItem> items,
            DataTemplateDelegate <THolder> dataTemplate,
            ItemTemplateDelegate itemTemplate,
            HolderFactoryDelegate <THolder> holderFactory = null)
        {
            DataTemplate  = dataTemplate;
            HolderFactory = holderFactory ?? DefaultHolderFactory;
            ItemTemplate  = itemTemplate;

            DataSource = items;
        }
Exemple #2
0
 public ObservableRecyclerAdapterWithMultipleViewTypesAndFooter(
     Dictionary <Type, IItemEntry> templates,
     IList <TItemBase> items,
     DataTemplateDelegate <TFooterHolder> footerDataTemplate,
     HolderFactoryDelegate <TFooterHolder> footerFactory,
     ItemTemplateDelegate footerTemplate)
     : base(templates, items)
 {
     _footerDataTemplate = footerDataTemplate;
     _footerFactory      = footerFactory;
     _footerTemplate     = footerTemplate;
 }
Exemple #3
0
 public ObservableRecyclerAdapterWithFooter(
     IList <TItem> items,
     DataTemplateDelegate <THolder> dataTemplate,
     HolderFactoryDelegate <THolder> holderFactory,
     ItemTemplateDelegate itemTemplate,
     DataTemplateDelegate <TFooterHolder> footerDataTemplate,
     HolderFactoryDelegate <TFooterHolder> footerFactory,
     ItemTemplateDelegate footerTemplate)
     : base(items, dataTemplate, itemTemplate, holderFactory)
 {
     _footerDataTemplate = footerDataTemplate;
     _footerFactory      = footerFactory;
     _footerTemplate     = footerTemplate;
 }