예제 #1
0
        private void InitComponents()
        {
            //Movie RecyclerView
            mvxRecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.movies_recyclerView);
            layoutManager   = new GridLayoutManager(this.Context, 2);
            adapter         = new DiscoverRecyclerAdapter((IMvxAndroidBindingContext)BindingContext);
            mvxRecyclerView.AddItemDecoration(new GridSpacingItemDecoration(2, Utils.DpToPx(12), true, 0));

            //Infinite Scrolling
            var onScrollListener = new EndlessRecyclerOnScrollListener();

            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
                ViewModel.LoadMoreDataCommand.Execute(true);
            };
            mvxRecyclerView.AddOnScrollListener(onScrollListener);
            mvxRecyclerView.SetLayoutManager(layoutManager);
            mvxRecyclerView.Adapter = adapter;

            //Genre RecyclerView
            genreRecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.genre_recyclerView);
            var genreAdapter       = new FiltersRecyclerAdapter((IMvxAndroidBindingContext)BindingContext);
            var genreLayoutManager = new LinearLayoutManager(this.Context, LinearLayoutManager.Horizontal, false);

            genreRecyclerView.SetLayoutManager(genreLayoutManager);
            genreRecyclerView.AddItemDecoration(new LinearSpaceItemDecoration(Utils.DpToPx(16), Utils.DpToPx(6)));
            genreRecyclerView.Adapter = genreAdapter;
        }
예제 #2
0
 public override void OnStart()
 {
     base.OnStart();
     _recyclerView   = View.FindViewById <MvxRecyclerView>(Resource.Id.search_friends_list_recycler_view);
     _scrollListener = new RecyclerViewOnScrollListener(StaticAppSettings.PullDataPageSize / 2);
     _scrollListener.LoadMoreEvent += _scrollListener_LoadMoreEvent;
     _recyclerView.AddOnScrollListener(_scrollListener);
 }
 public override void OnStart()
 {
     base.OnStart();
     _recyclerView   = View.FindViewById <MvxRecyclerView>(Resource.Id.recycler_games_category_list_view);
     _scrollListener = new RecyclerViewOnScrollListener(StaticAppSettings.PullDataPageSize / 2);
     _scrollListener.LoadMoreEvent += _scrollListener_LoadMoreEvent;
     _recyclerView.AddOnScrollListener(_scrollListener);
     SearchForGames(true);
 }
        public static void AddOnScrollFetchItemsListener(this MvxRecyclerView recyclerView, LinearLayoutManager linearLayoutManager, Func <INotifyTaskCompletion> fetchItemsTaskCompletionFunc, Func <ICommand> fetchItemsCommandFunc)
        {
            var onScrollListener = new RecyclerViewOnScrollListener(linearLayoutManager);

            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) =>
            {
                var fetchItemsTaskCompletion = fetchItemsTaskCompletionFunc.Invoke();
                if (fetchItemsTaskCompletion == null || !fetchItemsTaskCompletion.IsNotCompleted)
                {
                    fetchItemsCommandFunc.Invoke().Execute(null);
                }
            };
            recyclerView.AddOnScrollListener(onScrollListener);
        }
예제 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //
            SetContentView(Resource.Layout.poke_view);

            var set = this.CreateBindingSet <Pokeview, PokeViewModel>();

            set.Bind(SupportActionBar).For(v => v.Title).To(vm => vm.Title);
            set.Apply();

            _pokemonfeedPaging = new PaginationScrollListener(ViewModel);
            _recyclerView      = this.FindViewById <MvxRecyclerView>(Resource.Id.poke_list_main);
            _recyclerView.AddOnScrollListener(_pokemonfeedPaging);
        }
예제 #6
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            recyclerView.HasFixedSize = true;
            var layoutManager    = new LinearLayoutManager(Activity);
            var onScrollListener = new LoadMoreRecyclerViewOnScrollListener(layoutManager);

            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) =>
            {
                ViewModel.addItems();
            };
            recyclerView.AddOnScrollListener(onScrollListener);
            recyclerView.SetLayoutManager(layoutManager);
            recyclerView.Adapter = new HomeListAdapter((IMvxAndroidBindingContext)BindingContext);
        }
        public static void AddOnScrollFetchItemsListener(this MvxRecyclerView recyclerView, LinearLayoutManager linearLayoutManager, Func <MvxNotifyTask> fetchItemsTaskCompletionFunc, Func <ICommand> fetchItemsCommandFunc, ScrollDirection direction = ScrollDirection.DOWN)
        {
            var onScrollListener = new RecyclerViewOnScrollListener(linearLayoutManager);

            onScrollListener.Direction      = direction;
            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) =>
            {
                var fetchItemsTaskCompletion = fetchItemsTaskCompletionFunc.Invoke();
                if (fetchItemsTaskCompletion == null || !fetchItemsTaskCompletion.IsNotCompleted)
                {
                    //Log.Info(Constants.AppConfig.LogTag, "Execute searchCommand ");
                    fetchItemsCommandFunc?.Invoke().Execute(null);
                }
            };
            recyclerView.AddOnScrollListener(onScrollListener);
        }