示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 public void ShowForumThreadSearchResults(
     IAsyncEnumerable <OneOf <IPagedData <ForumThread>, IAniListError> > forumThreadEnumerable)
 {
     _recyclerView.SetAdapter(_adapter = new ForumThreadRecyclerAdapter(this, forumThreadEnumerable,
                                                                        ForumThreadViewModel.CreateForumThreadViewModel));
 }
示例#4
0
 public void ShowUserSearchResults(IAsyncEnumerable <OneOf <IPagedData <User>, IAniListError> > userEnumerable)
 {
     _recyclerView.SetAdapter(
         _adapter = new UserRecyclerAdapter(this, userEnumerable, _cardType, UserViewModel.CreateUserViewModel));
 }
示例#5
0
 public void ShowStaffSearchResults(IAsyncEnumerable <OneOf <IPagedData <Staff>, IAniListError> > staffEnumerable)
 {
     _recyclerView.SetAdapter(_adapter =
                                  new StaffRecyclerAdapter(this, staffEnumerable, _cardType, StaffViewModel.CreateStaffViewModel));
 }
示例#6
0
 public void ShowStudioSearchResults(IAsyncEnumerable <OneOf <IPagedData <Studio>, IAniListError> > studioEnumerable)
 {
     _recyclerView.SetAdapter(_adapter =
                                  new StudioRecyclerAdapter(this, studioEnumerable, StudioViewModel.CreateStudioViewModel));
 }
示例#7
0
 public static Action <IList <T> > BindItems <T>(this BaseRecyclerAdapter <T> adapter)
 => collection => adapter.Items = collection;