private async Task DownloadAndShowAdvertisements(bool resetList) { SetAdvertisementListPageNumber(resetList); List <AdvertisementItemShort> advertisements = await GetAdvertisements(); if (advertisements.Count > 0 || resetList) { if (advertisementItemListAdapter == null || resetList) { advertisementItemListAdapter = new AdvertisementItemListAdapter(this, advertisements, this.advertisementsSearchModel.AdvertisementsKind, this); advertisementItemListAdapter.AdvertisementItemClick += AdvertisementItemListAdapter_AdvertisementItemClick; advertisementItemListAdapter.DeleteAdvertisementItemClick += AdvertisementItemListAdapter_DeleteAdvertisementItemClick; advertisementItemListAdapter.EditAdvertisementItemClick += AdvertisementItemListAdapter_EditAdvertisementItemClick; var mLayoutManager = new GridLayoutManager(this, 2); advertisementsRecyclerView.SetLayoutManager(mLayoutManager); advertisementsRecyclerView.SetAdapter(advertisementItemListAdapter); advertisementsRecyclerView.RequestLayout(); } else { advertisementItemListAdapter.AddAdvertisements(advertisements); } } else { if (advertisementItemListAdapter == null) { advertisementItemListAdapter = new AdvertisementItemListAdapter(this, new List <AdvertisementItemShort>(), this.advertisementsSearchModel.AdvertisementsKind, this); } advertisementItemListAdapter.InfiniteScrollDisabled = true; } SetRecyclerVisibility(advertisements); }
private async Task DownloadAndShowAdvertisements() { progress.ShowProgressDialog("Pobieranie og³oszeñ. Proszê czekaæ..."); var coordinates = gpsLocationService.GetCoordinatesModel(); List <AdvertisementItemShort> advertisements = await this.advertisementItemService.GetUserAdvertisements(userAdvertsPageNumber, this.advertisement.SellerId, coordinates.Latitude, coordinates.Longitude); if (advertisements.Count > 0) { if (advertisementItemListAdapter == null) { advertisementItemListAdapter = new AdvertisementItemListAdapter(this, advertisements, AdvertisementsKind.AdvertisementsAroundUserCurrentLocation, this); advertisementItemListAdapter.AdvertisementItemClick += AdvertisementItemListAdapter_AdvertisementItemClick; advertisementsRecyclerView.SetAdapter(advertisementItemListAdapter); } else { advertisementItemListAdapter.AddAdvertisements(advertisements); } } else { if (advertisementItemListAdapter == null) { advertisementItemListAdapter = new AdvertisementItemListAdapter(this, new List <AdvertisementItemShort>(), AdvertisementsKind.AdvertisementsAroundUserCurrentLocation, this); } advertisementItemListAdapter.InfiniteScrollDisabled = true; userAdvertsPageNumber = 0; } progress.CloseProgressDialog(); }