public override Object InstantiateItem(ViewGroup container, int position)
        {
            var inflater     = LayoutInflater.FromContext(context);
            var inflatedView = inflater.Inflate(Resource.Layout.ReportsCalendarFragmentPage, container, false);

            var calendarRecyclerView = (ReportsCalendarRecyclerView)inflatedView;

            calendarRecyclerView.SetRecycledViewPool(recyclerviewPool);
            calendarRecyclerView.SetLayoutManager(new ReportsCalendarLayoutManager(context));
            var adapter = new ReportsCalendarRecyclerAdapter(currentDateRange)
            {
                Items = currentMonths[position].Days
            };

            calendarRecyclerView.SetAdapter(adapter);

            adapter.ItemTapObservable
            .Subscribe(dayTaps.OnNext)
            .DisposedBy(disposeBag);

            selectionChanges
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(adapter.UpdateDateRangeParameter)
            .DisposedBy(disposeBag);

            container.AddView(inflatedView);

            return(inflatedView);
        }
        private void setupAdapter(ReportsCalendarRecyclerView calendarRecyclerView, int position)
        {
            var adapter = new ReportsCalendarRecyclerAdapter(currentDateRange)
            {
                Items = currentMonths[position].Days
            };

            var disposeBag = new CompositeDisposable();

            disposableBags[position] = disposeBag;

            calendarRecyclerView.SetAdapter(adapter);

            adapter.ItemTapObservable
            .Subscribe(dayTaps.OnNext)
            .DisposedBy(disposeBag);

            selectionChanges
            .ObserveOn(AndroidDependencyContainer.Instance.SchedulerProvider.MainScheduler)
            .Subscribe(adapter.UpdateDateRangeParameter)
            .DisposedBy(disposeBag);
        }
예제 #3
0
        private void setupAdapter(ReportsCalendarRecyclerView calendarRecyclerView, int position)
        {
            var adapter = new ReportsCalendarRecyclerAdapter(currentDateRange)
            {
                Items = currentMonths[position].Days
            };

            var disposeBag = new CompositeDisposable();

            disposableBags[position] = disposeBag;

            calendarRecyclerView.SetAdapter(adapter);

            adapter.ItemTapObservable
            .Subscribe(dayTaps.OnNext)
            .DisposedBy(disposeBag);

            selectionChanges
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(adapter.UpdateDateRangeParameter)
            .DisposedBy(disposeBag);
        }