private void SetRecyclerViewAdapters() { try { MAdapter = new AlbumsAdapter(this) { AlbumList = new ObservableCollection <PostDataObject>() }; LayoutManager = new GridLayoutManager(this, 2); LayoutManager.SetSpanSizeLookup(new MySpanSizeLookup(4, 1, 1)); //5, 1, 2 MRecycler.SetLayoutManager(LayoutManager); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(10); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <PostDataObject>(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); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ActMain); var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolBar); InitCollapsingToolbar(); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view); _albumList = new List <Album>(); _adapter = new AlbumsAdapter(this, _albumList); var mLayoutManager = new GridLayoutManager(this, 2); _recyclerView.SetLayoutManager(mLayoutManager); _recyclerView.AddItemDecoration(new GridSpacingItemDecoration(2, DpConvertToPx(10), true)); _recyclerView.SetItemAnimator(new DefaultItemAnimator()); _recyclerView.SetAdapter(_adapter); PopulateAlbum(); try { var imgBackdrop = FindViewById <ImageView>(Resource.Id.backdrop); Picasso.With(this).Load(Resource.Drawable.cover).Into(imgBackdrop); } catch (Exception e) { Console.WriteLine($"@@@@@@@@@@@@@@@@@@@@@{e}"); } }
private void SetupRecyclerView() { _recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); _albums = new List<Album>(); _adapter = new AlbumsAdapter(this, _albums); LayoutManager layoutManager = new GridLayoutManager(this, 2); _recyclerView.SetLayoutManager(layoutManager); _recyclerView.AddItemDecoration(new GridSpacingItemDecoration(2, dpToPx(10), true)); _recyclerView.SetItemAnimator(new DefaultItemAnimator()); _recyclerView.SetAdapter(_adapter); PrepareAlbums(); }
private void SetupRecyclerView() { _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _adapter = new AlbumsAdapter(this, _albums); LayoutManager layoutManager = new GridLayoutManager(this, 2); _recyclerView.SetLayoutManager(layoutManager); _recyclerView.SetAdapter(_adapter); PrepareAlbums(); }
private void PersistChangesButton_Click(object sender, EventArgs e) { /*for (int i = 0; i < SongsDataGridView.Rows.Count; ++i) { * string query = "DELETE FROM Songs WHERE Id = @sid"; * * SqlCommand command = new SqlCommand(query, Connection); * var sid = SongsDataGridView.Rows[i].Cells[0].Value.ToString(); * command.Parameters.AddWithValue("@sid", sid); * * command.ExecuteNonQuery(); * }*/ SongsAdapter.Update(DataSet, "Songs"); AlbumsAdapter.Update(DataSet, "Albums"); }
private void DestroyBasic() { try { MAdView?.Destroy(); MAdapter = null; SwipeRefreshLayout = null; MRecycler = null; EmptyStateLayout = null; Inflated = null; MainScrollEvent = null; ActionButton = null; MAdView = null; } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { MAdView?.Destroy(); MAdapter = null !; SwipeRefreshLayout = null !; MRecycler = null !; EmptyStateLayout = null !; Inflated = null !; MainScrollEvent = null !; ActionButton = null !; MAdView = null !; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }