private void SetRecyclerViewAdapters() { try { LayoutManager = new LinearLayoutManager(this); MAdapter = new OffersAdapter(this) { OffersList = new ObservableCollection <OffersDataObject>() }; MRecycler.SetLayoutManager(LayoutManager); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(10); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <OffersDataObject>(this, MAdapter, sizeProvider, 10); MRecycler.AddOnScrollListener(preLoader); MRecycler.SetAdapter(MAdapter); RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(LayoutManager); MainScrollEvent = xamarinRecyclerViewOnScrollListener; MainScrollEvent.LoadMoreEvent += MainScrollEventOnLoadMoreEvent; MRecycler.AddOnScrollListener(xamarinRecyclerViewOnScrollListener); MainScrollEvent.IsLoading = false; } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { MAdView?.Destroy(); RewardedVideo?.Destroy(); MAdapter = null; SwipeRefreshLayout = null; MRecycler = null; EmptyStateLayout = null; Inflated = null; MainScrollEvent = null; MAdView = null; Instance = null; } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { MAdView?.Destroy(); RewardedVideo?.Destroy(); MAdapter = null !; SwipeRefreshLayout = null !; MRecycler = null !; EmptyStateLayout = null !; Inflated = null !; MainScrollEvent = null !; MAdView = null !; Instance = null !; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public OffersHelper(OffersAdapter adapter) { this.Offers = new Dictionary <string, Offer>(); this.Adapter = adapter; this.Load(); }