Ejemplo n.º 1
0
        public void SetFilter(BlockView.Categories category)
        {
            FilteredBvs.Clear();

            if (LastCategory.Equals(category))
            {
                return;
            }

            LastCategory = category;

            if (category.Equals(BlockView.Categories.All))
            {
                FilteredBvs.AddRange(BlockViews);
                NotifyDataSetChanged();
                return;
            }

            BlockViews.ForEach(bv =>
            {
                if (bv.GetCategories().Contains(category))
                {
                    FilteredBvs.Add(bv);
                }
            });
        }
Ejemplo n.º 2
0
        public RecyclerAdapter(MainActivity ac, BlockView.Categories selectedCat)
        {
            Ma         = ac;
            BlockViews = new List <BlockView>
            {
                new TextBlockView(ac, "Action 1"),
                new TextBlockView(ac, "Action 2"),
                new InstructionBlockView(ac, Resource.Drawable.turn_left, "Turn Left"),
                new InstructionBlockView(ac, Resource.Drawable.turn_right, "Turn Right"),
                new ForBlockView(ac),
                new IfBlockView(ac)
            };

            FilteredBvs = new List <BlockView>();
            FilteredBvs.AddRange(BlockViews);
            LastCategory = selectedCat;
        }