protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); var GoTocartPageFloatingActionButton = FindViewById <FloatingActionButton>(Resource.Id.GoToCartPageButton); GoTocartPageFloatingActionButton.Click += GoToCartPage_Click; this.SearchView = FindViewById <SearchView>(Resource.Id.searchView); this.SearchView.QueryTextChange += SearchView_QueryTextChange; this.Products = ProductAPIController.GetProducts().Result; this.Adapter = new ProductsAdapter(this, this.Products, Resource.Layout.ProductAdapterItem); this.ProductsGridView = FindViewById <GridView>(Resource.Id.ProductListView); this.ProductsGridView.ItemClick += ProductsGridView_ItemClick; this.FilterImageView = FindViewById <ImageView>(Resource.Id.FilterImageView); this.FilterImageView.Click += FilterImageView_Click; this.SortBySpiner = FindViewById <Spinner>(Resource.Id.SortBySpiner); this.SortBySpiner.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleExpandableListItem1, SearchByItems); this.SortBySpiner.ItemSelected += SortBySpiner_ItemSelected; this.ProductDescriptionActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(ProductDescriptionActivity))); this.ProductDescriptionActivityGenericTask.Start(); this.CartActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(CartActivity))); this.CartActivityGenericTask.Start(); }
private void SortBySpiner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Console.WriteLine(e.Position); Comparison <Product> compare = null; switch (e.Position) { case 0: compare = (a, b) => a.Name.CompareTo(b.Name); break; case 1: compare = (a, b) => ((decimal)a.Price).CompareTo((decimal)b.Price); break; case 2: compare = (a, b) => ((double)a.Memory).CompareTo((double)b.Memory); break; case 3: compare = (a, b) => ((double)a.RAM).CompareTo((double)b.RAM); break; default: throw new Exception("Inadmissible situation."); } this.Products.Sort(compare); this.Adapter = new ProductsAdapter(this, this.Products, Resource.Layout.ProductAdapterItem); this.ProductsGridView.Adapter = this.Adapter; Console.WriteLine("=============="); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SellerDescriptionActivity); var seller = ActivityCommunication.Seller; FindViewById <TextView>(Resource.Id.SellerNameTextView).Text = seller.Name; FindViewById <RatingBar>(Resource.Id.SellerRatingBar).Rating = (float)seller.Rating; FindViewById <TextView>(Resource.Id.SellerAddressTextView).Text = seller.Address; FindViewById <TextView>(Resource.Id.SellerCellPhoneTextView).Text = seller.CellPhone; FindViewById <TextView>(Resource.Id.SellerEmailTextView).Text = seller.Email; var products = CatalogAPIController.GetProductsBySellerId(seller.Id); this.Adapter = new ProductsAdapter(this, products, Resource.Layout.ProductAdapterItem); var ProductsGridView = FindViewById <GridView>(Resource.Id.ProductListView); ProductsGridView.Adapter = Adapter; ProductsGridView.ItemClick += ProductsGridView_ItemClick; }
public async void SetUpRecyclerView(View view) { try { ProductsG LProducts = new ProductsG(); var getP = await LProducts.GetListProducts(); fulllPList = getP; pRecyclerView = (RecyclerView)view.FindViewById(Resource.Id.productRecyclerView); pLayoutManager = new LinearLayoutManager(pRecyclerView.Context); pAdapter = new ProductsAdapter(getP); // Register the Item click handler (below) with adapter pAdapter.ItemClick += OnItemClick; pRecyclerView.SetLayoutManager(pLayoutManager); pRecyclerView.SetAdapter(pAdapter); } catch (Exception ex) { Console.WriteLine("Error on async Task " + ex); } }
public override void InitializeScreen() { SetContentView(Resource.Layout.layout_customer_details); SetScreenTitle(GetString(Resource.String.component_swap)); ActionBar.SetDisplayHomeAsUpEnabled(true); //init productsList = new List <SwapProduct>(); nameTextView = FindViewById <TextView>(Resource.Id.textView_customer_name); idNumberTextView = FindViewById <TextView>(Resource.Id.textView_idnumber); phoneNumberTextView = FindViewById <TextView>(Resource.Id.textView_customer_phone); previousButton = FindViewById <Button>(Resource.Id.button_previous); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView_products); UpdateScreen(); layoutManager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(layoutManager); adapter = new ProductsAdapter(productsList, this); adapter.ItemClick += OnItemClick; recyclerView.SetAdapter(adapter); SetListeners(); }
public ProductsFilterDialog(Activity context, ProductsAdapter adapter, GridView gridView) { this.GridView = gridView; this.context = context; this.adapter = adapter; }