示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            InitView(Resource.Layout.Explore, bundle);
            adRenderer.RenderAd(FindViewById <AdView>(Resource.Id.adView));

            Title = "Explore Movies";
            var endYearIndex   = Globals.Years.FindIndex(x => x == DateTime.Now.Year);
            var startYearIndex = endYearIndex - 9;
            var genres         = new List <string> {
                "Any"
            };

            genres.AddRange(MovieManager.GenreMap.Values.ToList());

            SetupSpinner(Resource.Id.spinner, spinner_ItemSelected, Globals.Years, startYearIndex);
            SetupSpinner(Resource.Id.spinner2, spinner2_ItemSelected, Globals.Years, endYearIndex);
            SetupSpinner(Resource.Id.spinner3, spinner3_ItemSelected, genres, 0);

            exploreInfo = new ExploreMovieInfo {
                StartYear = Globals.Years[startYearIndex], EndYear = Globals.Years[endYearIndex], Genre = genres[0]
            };

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
        public static ExploreMoviesFragment NewInstance(ExploreMovieInfo info)
        {
            var    frag1  = new ExploreMoviesFragment();
            Bundle bundle = new Bundle();

            bundle.PutIntArray("exploreMovieInfo", new int[3]
            {
                info.StartYear, info.EndYear, info.Genre == "Any" ? -1 : MovieManager.GenreTextToIdMap[info.Genre]
            });
            frag1.Arguments = bundle;
            return(frag1);
        }