Example #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view                   = base.OnCreateView(inflater, container, savedInstanceState);
            collectionView         = view.FindViewById <MvxRecyclerView>(Resource.Id.challenges_collection);
            collectionViewAdapter  = new ChallengesCollectionAdapter((IMvxAndroidBindingContext)BindingContext, collectionView);
            collectionView.Adapter = collectionViewAdapter;
            collectionView.SetLayoutManager(new ChallengesLinearLayoutManager(this.Activity, LinearLayoutManager.Horizontal, false));
            collectionView.HasFixedSize  = true;
            collectionView.ScrollChange += (s, e) =>
            {
                OnScrollViewChanged(s, e, collectionView.ScrollState);
            };

            tableView                     = view.FindViewById <MvxListView>(Resource.Id.challenges_list);
            tableAdapter                  = new ChallengesTableViewAdapter(this.Activity, (IMvxAndroidBindingContext)BindingContext);
            tableView.Adapter             = tableAdapter;
            tableView.ScrollStateChanged += (s, e) =>
            {
                if (e.ScrollState == ScrollState.TouchScroll)
                {
                    OnScrollViewChanged(s, e, 1);
                }
            };
            //tableView.ScrollChange += (s, e) =>
            //{
            //    OnScrollViewChanged(s, e);
            //};
            SetPlaceholder();
            UpdateControls();
            var _refreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh_layout);

            _refreshLayout.Refresh += (s, e) =>
            {
                ViewModel.RefreshCommand.Execute();
            };
            var set = this.CreateBindingSet <ChallengesFragment, ChallengeViewModel>();

            set.Bind(_refreshLayout).For(v => v.Refreshing).To(viewModel => viewModel.IsRefreshing);
            set.Apply();
            CustomSwipeRefreshLayoutHelper.Customize(_refreshLayout);
            return(view);
        }
Example #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            this.EnsureBindingContextIsSet(inflater);
            view = this.BindingInflate(FragmentId, container, false);

            _rewardRecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.reward_category_collection);
            _rewardRecyclerView.SetLayoutManager(new GridLayoutManager(Activity, 2, LinearLayoutManager.Vertical, false));
            _rewardRecyclerView.Adapter = new RewardsCategoryAdapter((IMvxAndroidBindingContext)BindingContext);
            UpdateControls();
            SetPlaceholder();
            var _refreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh_layout);

            _refreshLayout.Refresh += (s, e) => { ViewModel.RefreshCommand.Execute(); };
            var set = this.CreateBindingSet <RewardCategoriesFragment, RewardCategoriesViewModel>();

            set.Bind(_refreshLayout).For(v => v.Refreshing).To(viewModel => viewModel.IsRefreshing);
            set.Apply();
            CustomSwipeRefreshLayoutHelper.Customize(_refreshLayout);
            _rewardRecyclerView.ScrollChange += (s, e) =>
            {
                OnScrollViewChanged(s, e, _rewardRecyclerView.ScrollState);
            };
            return(view);
        }