Example #1
0
        private void SetRecyclerViewAdapters()
        {
            try
            {
                MAdapter = new TrendingAdapter(Activity)
                {
                    TrendingList = new ObservableCollection <Classes.TrendingClass>()
                };
                LayoutManager = new GridLayoutManager(Context, 2);
                LayoutManager.SetSpanSizeLookup(new MySpanSizeLookup2(2, 1, 2));//20, 1, 4
                MRecycler.SetLayoutManager(LayoutManager);
                MRecycler.HasFixedSize = true;
                MRecycler.SetItemViewCacheSize(10);
                MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
                MRecycler.SetAdapter(MAdapter);

                MAdapter.UsersItemClick           += MAdapterOnUsersItemClick;
                MAdapter.UsersLikeButtonItemClick += MAdapterOnUsersLikeButtonItemClick;

                RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(LayoutManager);
                MainScrollEvent = xamarinRecyclerViewOnScrollListener;
                MainScrollEvent.LoadMoreEvent += MainScrollEventOnLoadMoreEvent;
                MRecycler.AddOnScrollListener(xamarinRecyclerViewOnScrollListener);
                MainScrollEvent.IsLoading = false;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #2
0
        private void SetRecyclerViewAdapters()
        {
            try
            {
                MAdapter = new TrendingAdapter(Activity)
                {
                    TrendingList = new ObservableCollection <Classes.TrendingClass>()
                };
                LayoutManager = new LinearLayoutManager(Context);
                MRecycler.SetLayoutManager(LayoutManager);
                MRecycler.HasFixedSize = true;
                MRecycler.SetItemViewCacheSize(10);
                MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
                var sizeProvider = new FixedPreloadSizeProvider(10, 10);
                var preLoader    = new RecyclerViewPreloader <Classes.TrendingClass>(Activity, MAdapter, sizeProvider, 10);
                MRecycler.AddOnScrollListener(preLoader);
                MRecycler.SetAdapter(MAdapter);
                MAdapter.VideoItemClick += MAdapterOnVideoItemClick;

                RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(LayoutManager);
                MainScrollEvent = xamarinRecyclerViewOnScrollListener;
                MainScrollEvent.LoadMoreEvent += MainScrollEventOnLoadMoreEvent;
                MRecycler.AddOnScrollListener(xamarinRecyclerViewOnScrollListener);
                MainScrollEvent.IsLoading = false;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void SetRecyclerViewAdapters()
 {
     try
     {
         LayoutManager = new LinearLayoutManager(Activity);
         MAdapter      = new TrendingAdapter(Activity)
         {
             TrendingList = new ObservableCollection <Classes.TrendingClass>()
         };
         MAdapter.ItemClick += MAdapterOnItemClick;
         MRecycler.SetLayoutManager(LayoutManager);
         MRecycler.HasFixedSize = true;
         MRecycler.SetItemViewCacheSize(10);
         MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
         MRecycler.SetAdapter(MAdapter);
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }