Пример #1
0
        private void SetupUiElements()
        {
            this.saleRecyclerAdapter = new SaleRecyclerAdapter(
                this.Context,
                this.saleItems,
                (v, i) =>
            {
                //var currentSaleItem = this.saleItems[i];
                //var itemJson = JsonConvert.SerializeObject(currentSaleItem);

                //var detailIntent = new Intent(this, typeof(DetailSaleItemActivity));
                //detailIntent.PutExtra("Item", itemJson);

                //StartActivity(detailIntent);
                var frag = new VerticalBarSeriesFragment();

                FragmentManager fg     = this.Activity.SupportFragmentManager;
                FragmentTransaction ft = fg.BeginTransaction();
                ft.Replace(Resource.Id.content_frame, frag);
                ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                ft.Commit();
            },
                async(v, i) =>
            {
                // StartActivityForResult(typeof(SellActivity), 0);
                //await AuthenticationService.Instance.RequestLoginIfNecessary();

                //if (AuthenticationService.Instance.UserIsAuthenticated)
                //{

                //}
            }
                );

            var sglm = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical);

            this.recyclerView.SetLayoutManager(sglm);
            this.recyclerView.SetItemAnimator(null);
            this.recyclerView.SetAdapter(this.saleRecyclerAdapter);

            var color = new Color(ContextCompat.GetColor(this.Context, Resource.Color.grey));

            this.recyclerView.SetBackgroundColor(color);
        }
Пример #2
0
        private void SetupUiElements()
        {
            this.saleRecyclerAdapter = new SaleRecyclerAdapter(
                this,
                this.saleItems,
                (v, i) =>
            {
                var currentSaleItem = this.saleItems[i];
                var itemJson        = JsonConvert.SerializeObject(currentSaleItem);

                var detailIntent = new Intent(this, typeof(DetailSaleItemActivity));
                detailIntent.PutExtra("Item", itemJson);

                StartActivity(detailIntent);
            },
                async(v, i) =>
            {
                await AuthenticationService.Instance.RequestLoginIfNecessary();

                if (AuthenticationService.Instance.UserIsAuthenticated)
                {
                    StartActivityForResult(typeof(SellActivity), 0);
                }
            }
                );

            var sglm = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical);

            this.recyclerView.SetLayoutManager(sglm);
            this.recyclerView.SetItemAnimator(null);
            this.recyclerView.SetAdapter(this.saleRecyclerAdapter);

            var color = new Color(ContextCompat.GetColor(this, Resource.Color.grey));

            this.recyclerView.SetBackgroundColor(color);
        }