示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Demiactivity_main);
            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView1);

            if (this.Intent.Extras != null)
            {
                var category = (DemiProductCategory)Intent.Extras.GetInt("CategoryID");
                CategoryID = category;
                var productlist = Intent.Extras.GetStringArray("lijst");
                ListOfProducts = productlist.ToList();
            }

            mProductList = new DemiProductList(CategoryID);

            button = FindViewById <Button>(Resource.Id.button1);

            //----------------------------------------------------------------------------------------
            // Layout Managing Set-up

            mLayoutManager = new GridLayoutManager(this, 2, GridLayoutManager.Vertical, false);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            //----------------------------------------------------------------------------------------
            // Adapter Set-up
            mAdapter            = new DemiProductGroupListAdapter(mProductList);
            mAdapter.ItemClick += OnItemClick;

            button.Click += Button_Click;;

            mRecyclerView.SetAdapter(mAdapter);
        }
示例#2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Demiactivity_main);

            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView1);

            if (this.Intent.Extras != null)
            {
                var category = (DemiProductCategory)Intent.Extras.GetInt("CategoryID");
                CategoryID = category;
            }

            mProductList = new DemiProductList(CategoryID);

            //
            //var allProducts = DefaultProductList.Get().Where((product) => product.category == CategoryID);

            //----------------------------------------------------------------------------------------
            // Layout Managing Set-up

            mLayoutManager = new GridLayoutManager(this, 2, GridLayoutManager.Vertical, false);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            //----------------------------------------------------------------------------------------
            // Adapter Set-up
            mAdapter            = new DemiProductGroupListAdapter(mProductList);
            mAdapter.ItemClick += OnItemClick;
            mRecyclerView.SetAdapter(mAdapter);
        }