Пример #1
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            viewModel = Locator.Get <BrowseViewModel>();
            if (viewModel == null)
            {
                viewModel = Locator.GetNewInstance <BrowseViewModel>();
                viewModel.PropertyChanged += ViewModel_PropertyChanged;
                Task.Run(async() =>
                {
                    await viewModel.GetTopRated().ConfigureAwait(false);
                    await viewModel.GetPopular().ConfigureAwait(false);
                    await viewModel.GetNowPlaying().ConfigureAwait(false);
                });
            }

            Activity.InvalidateOptionsMenu();
        }
Пример #2
0
        private void InitPopularRecyclerView()
        {
            popularManager = new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false);
            popular.SetLayoutManager(popularManager);
            popularAdapter = new ItemAdapter(viewModel.GetCachedPopular());
            popular.SetAdapter(popularAdapter);
            var popularScrollListener = new ItemAdapterScollListener(popularManager);

            popularScrollListener.LoadMore += async delegate()
            {
                if (!viewModel.CanLoadMorePopular())
                {
                    return;
                }
                await viewModel.GetPopular().ConfigureAwait(false);
            };
            popular.AddOnScrollListener(popularScrollListener);
        }