private void SetupRecyclerView()
        {
            if (_rvCryptoCurrency != null)
            {
                _rvCryptoCurrency.HasFixedSize = true;
                var layoutManager = new LinearLayoutManager(this);
                layoutManager.Orientation = LinearLayoutManager.Vertical;
                _rvCryptoCurrency.SetLayoutManager(layoutManager);
                _rvCryptoCurrency.Adapter = new CryptoCurrencyAdapter((IMvxAndroidBindingContext)BindingContext, ViewModel, this);
                var mDividerItemDecoration = new DividerItemDecoration(_rvCryptoCurrency.Context, layoutManager.Orientation);
                _rvCryptoCurrency.AddItemDecoration(mDividerItemDecoration);
                _rvCryptoCurrency.SetItemAnimator(new DefaultItemAnimator());
            }

            if (_rvMyCryptoCurrency != null)
            {
                _rvMyCryptoCurrency.HasFixedSize = true;
                var layoutManager = new LinearLayoutManager(this);
                layoutManager.Orientation = LinearLayoutManager.Vertical;
                _rvMyCryptoCurrency.SetLayoutManager(layoutManager);
                _rvMyCryptoCurrency.Adapter = new CryptoReminderAdapter((IMvxAndroidBindingContext)BindingContext, ViewModel, this);
                var mDividerItemDecoration = new DividerItemDecoration(_rvMyCryptoCurrency.Context, layoutManager.Orientation);
                _rvMyCryptoCurrency.AddItemDecoration(mDividerItemDecoration);
                _rvMyCryptoCurrency.SetItemAnimator(new DefaultItemAnimator());
            }
        }
Exemple #2
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;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = base.OnCreateView(inflater, container, savedInstanceState);

            ShowHamburgerMenuButton = true;

            RecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.my_recycler_view);

            if (RecyclerView != null)
            {
                RecyclerView.HasFixedSize = true;
                var layoutManager = new LinearLayoutManager(Activity);
                RecyclerView.SetLayoutManager(layoutManager);
                RecyclerView.AddItemDecoration(new SimpleDividerItemDecoration(Application.Context));
            }

            if (!string.IsNullOrWhiteSpace(EmptyListMessage) && RecyclerView != null)
            {
                var tb = view.FindViewById <TextView>(Resource.Id.empty_view);
                tb.Text = EmptyListMessage;
            }

            // TODO

            /*
             * var swipeToRefresh = view.FindViewById<MvxSwipeRefreshLayout>(Resource.Id.refresher);
             * var appBar = Activity.FindViewById<AppBarLayout>(Resource.Id.appbar);
             * if (appBar != null)
             * {
             *  appBar.OffsetChanged += (sender, args) => swipeToRefresh.Enabled = args.VerticalOffset == 0;
             * }
             */

            return(view);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = this.BindingInflate(Resource.Layout.fragment_menu, null);

            RecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.recyclerview);

            adapter = new MenuListAdapter((IMvxAndroidBindingContext)this.BindingContext);

            var mvxViewModelLoader = Mvx.Resolve <IMvxViewModelLoader>();
            var vmRequest          = MvxViewModelRequest.GetDefaultRequest(typeof(SideMenuViewModel));

            ViewModel         = mvxViewModelLoader.LoadViewModel(vmRequest, null) as SideMenuViewModel;
            adapter.ViewModel = ViewModel;

            var linearLayoutManager   = new LinearLayoutManager(Context);
            var dividerItemDecoration = new DividerItemDecoration(RecyclerView.Context, linearLayoutManager.Orientation);

            RecyclerView.SetLayoutManager(linearLayoutManager);
            RecyclerView.AddItemDecoration(dividerItemDecoration);

            RecyclerView.Adapter = adapter;
            adapter.ItemClick   += OnItemClick;

            return(view);
        }
Exemple #5
0
        protected void InitView()
        {
            SetContentView(Resource.Layout.ViewZipCodes);

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayShowHomeEnabled(false);

            RecyclerView = FindViewById <MvxRecyclerView>(Resource.Id.RecyclerView);

            RecyclerView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical));
            RecyclerView.HasFixedSize = true;
        }
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();
            SetContentView(Resource.Layout.Main);

            PersonssGrid = FindViewById <MvxRecyclerView>(Resource.Id.persons_grid_view);
            PersonssGrid.HasFixedSize = true;
            PersonssGrid.SetLayoutManager(new GridLayoutManager(this, 2, LinearLayoutManager.Horizontal, false));
            PersonssGrid.AddItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.Horizontal));

            ViewModel.PopulatePersons();
            ViewModel.FetchPersons();
        }