protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Checkout_layout);
            Cheeseknife.Inject(this);
            products = Ultilities.GetData <Product>("data.json");
            adapter  = new BillAdapter(products);
            rvProducts.SetLayoutManager(new LinearLayoutManager(this));
            rvProducts.SetAdapter(adapter);

            tvBillMoney.Text = products.Sum(p => p.Count * p.UnitPrice) + " vnd";
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.acticity_show_bill);

            Cheeseknife.Inject(this);
            SetActionBar(toolbar);
            tvSumPrices.Text = $"Sum of price: {ListOrders.GetInstance.SumOfPrices}";
            recyclerViewBill.SetLayoutManager(new LinearLayoutManager(this));
            adapter = new BillAdapter(ListOrders.GetInstance.Orders.Where(x => x.Quantity != 0).ToList());
            recyclerViewBill.SetAdapter(adapter);
            //Create your application here
        }
Exemplo n.º 3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            currentPage = RetrieveCurrentPageIfAvailable(savedInstanceState);

            if (savedInstanceState != null && savedInstanceState.ContainsKey(BundleType.BillViewerFragmentType))
            {
                _viewerMode = (BillViewerKind)savedInstanceState.GetInt(BundleType.BillViewerFragmentType);
            }

            if (_legislator == null && (_viewerMode != BillViewerKind.BillSearch && _viewerMode != BillViewerKind.LastestBillsForEveryone))
            {
                _legislator = RetrieveLegislatorIfAvailable(savedInstanceState);
            }

            var fragment = base.OnCreateView(inflater, container, savedInstanceState);

            var adapter = new BillAdapter(this);

            adapter.OnEndOfListReached         += Adapter_OnEndOfListReached;
            adapter.OnEndOfListElementRecycled += Adapter_OnEndOfListElementRecycled;
            recycler.SetAdapter(adapter);

            ShowEmptyview(GetString(_viewerMode == BillViewerKind.BillSearch
                                    ? Resource.String.enterSearchCriteria
                                    : Resource.String.loading));

            if (_billsToDisplay != null && _billsToDisplay.Count >= 0)
            {
                SetBills(_billsToDisplay, _isThereMoreVotes);
            }
            else if (savedInstanceState != null && !string.IsNullOrWhiteSpace(savedInstanceState.GetString(BundleType.Bills, string.Empty)))
            {
                var serializedBills = savedInstanceState.GetString(BundleType.Bills);
                _billsToDisplay = new List <Bill>().DeserializeFromJson(serializedBills);
                SetBills(_billsToDisplay, _isThereMoreVotes);
            }

            // Removing '|| !string.IsNullOrWhiteSpace(_lastSearchTerm))' for now
            // since it will fetch legislator content when searchview is not empty and the
            // use does something like switch orientation
            else if (_viewerMode != BillViewerKind.BillSearch)// || !string.IsNullOrWhiteSpace(_lastSearchTerm))
            {
                FetchMoreLegislatorContent(false);
            }

            return(fragment);
        }