Ejemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var view = inflater.Inflate(Resource.Layout.Prices, container, false);

            var spotTilesRecyclerView = view.FindViewById<RecyclerView>(Resource.Id.SpotTilesRecyclerView);
            var spotTilesAdapter = new SpotTileAdapter(_shellViewModel.SpotTiles.SpotTiles, _concurrencyService);

            if (App.IsTablet)
            {
                var gridLayoutManager = new BugFixGridLayoutManager(Activity, 1);
                spotTilesRecyclerView.SetLayoutManager(gridLayoutManager);

                spotTilesRecyclerView.ViewTreeObserver.GlobalLayout +=
                    (sender, args) => SetupColumns(spotTilesRecyclerView, gridLayoutManager);
            }
            else
            {
                var layoutManager = new LinearLayoutManager(Activity);
                spotTilesRecyclerView.SetLayoutManager(layoutManager);
            }

            spotTilesRecyclerView.SetAdapter(spotTilesAdapter);
            spotTilesRecyclerView.HasFixedSize = true;

            return view;
        }
Ejemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var view = inflater.Inflate(Resource.Layout.Prices, container, false);

            var spotTilesRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.SpotTilesRecyclerView);
            var spotTilesAdapter      = new SpotTileAdapter(_shellViewModel.SpotTiles.SpotTiles, _concurrencyService);

            if (App.IsTablet)
            {
                var gridLayoutManager = new BugFixGridLayoutManager(Activity, 1);
                spotTilesRecyclerView.SetLayoutManager(gridLayoutManager);

                spotTilesRecyclerView.ViewTreeObserver.GlobalLayout +=
                    (sender, args) => SetupColumns(spotTilesRecyclerView, gridLayoutManager);
            }
            else
            {
                var layoutManager = new LinearLayoutManager(Activity);
                spotTilesRecyclerView.SetLayoutManager(layoutManager);
            }

            spotTilesRecyclerView.SetAdapter(spotTilesAdapter);
            spotTilesRecyclerView.HasFixedSize = true;

            return(view);
        }