protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_practice_repast); var mToolbar = FindViewById <Toolbar>(Resource.Id.toolbar); mToolbar.NavigationClick += (sender, e) => { Finish(); }; var mRefreshLayout = FindViewById(Resource.Id.refreshLayout) as IRefreshLayout; if (isFirstEnter) { isFirstEnter = false; mRefreshLayout.AutoRefresh();//第一次进入触发自动刷新,演示效果 } var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetItemAnimator(new DefaultItemAnimator()); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); //recyclerView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical)); mAdapter = new CustomBaseRecyclerAdapter(loadModels(), Resource.Layout.listitem_practive_repast); recyclerView.SetAdapter(mAdapter); mRefreshLayout.SetOnRefreshLoadmoreListener(new CustomOnRefreshLoadmoreListener(this)); //状态栏透明和间距处理 StatusBarUtil.darkMode(this); StatusBarUtil.setPaddingSmart(this, recyclerView); StatusBarUtil.setPaddingSmart(this, mToolbar); StatusBarUtil.setPaddingSmart(this, FindViewById(Resource.Id.blurview)); StatusBarUtil.setMargin(this, FindViewById(Resource.Id.gifview)); }
public void ShowMediaSearchResults(IAsyncEnumerable <OneOf <IPagedData <Media>, IAniListError> > mediaEnumerable) { _adapter = new MediaRecyclerAdapter(this, mediaEnumerable, _cardType, MediaViewModel.CreateMediaViewModel) { LongClickAction = (viewModel, position) => { if (Settings?.IsUserAuthenticated == true) { EditMediaListItemDialog.Create(this, Presenter, viewModel.Model, viewModel.Model.MediaListEntry, Settings.LoggedInUser?.MediaListOptions); } }, }; _recyclerView.SetAdapter(_adapter); }
public void ShowForumThreadSearchResults( IAsyncEnumerable <OneOf <IPagedData <ForumThread>, IAniListError> > forumThreadEnumerable) { _recyclerView.SetAdapter(_adapter = new ForumThreadRecyclerAdapter(this, forumThreadEnumerable, ForumThreadViewModel.CreateForumThreadViewModel)); }
public void ShowUserSearchResults(IAsyncEnumerable <OneOf <IPagedData <User>, IAniListError> > userEnumerable) { _recyclerView.SetAdapter( _adapter = new UserRecyclerAdapter(this, userEnumerable, _cardType, UserViewModel.CreateUserViewModel)); }
public void ShowStaffSearchResults(IAsyncEnumerable <OneOf <IPagedData <Staff>, IAniListError> > staffEnumerable) { _recyclerView.SetAdapter(_adapter = new StaffRecyclerAdapter(this, staffEnumerable, _cardType, StaffViewModel.CreateStaffViewModel)); }
public void ShowStudioSearchResults(IAsyncEnumerable <OneOf <IPagedData <Studio>, IAniListError> > studioEnumerable) { _recyclerView.SetAdapter(_adapter = new StudioRecyclerAdapter(this, studioEnumerable, StudioViewModel.CreateStudioViewModel)); }
public static Action <IList <T> > BindItems <T>(this BaseRecyclerAdapter <T> adapter) => collection => adapter.Items = collection;