Exemple #1
0
        protected override IShadow <RecyclerView> Create(AndroidContext context, AndroidViewGroup <RecyclerView> initial)
        {
            var shadow = (Shadow <RecyclerView>)base.Create(context, initial);

            // and now setup the data connection
            var rvac = new RecyclerViewAdapterConnector(context);
            var collectionComparer = initial.Attributes.GetAttributeOrDefault(Group.ComparerAttribute);

            var dataH = new BackingStoreUpdateHandler <AndroidContext, RecyclerView, IPrimitive>(rvac, Group.ChildrenAttribute, collectionComparer);

            this.SetChildrenAdapter(context, shadow, dataH);

            Transaction.Current.Add(() =>
            {
                // and set the adapter in the recycler view
                shadow.Item.SetAdapter(rvac.Adapter);
            });

            return(shadow);
        }
Exemple #2
0
        protected override void Remove(AndroidContext context, IShadow <RecyclerView> shadow, AndroidViewGroup <RecyclerView> current)
        {
            base.Remove(context, shadow, current);

            // clear down the recycler view adapter
            shadow.Item.SetAdapter(null);
        }