private async void yearSelectButton_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            Spinner yearSelectButton = (Spinner)sender;

            this.year = (string)yearSelectButton.GetItemAtPosition(e.Position);

            mAdapter = ExpandableListViewAdapter.CreateFromData(this, (await service.GetSeriesRatings(this.year, this.makeSlug, this.seriesSlug)));
            expandableListView.SetAdapter(mAdapter);
        }
Ejemplo n.º 2
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            service = new ApiService(ApiConfig.ApiKey);

            base.OnCreate(savedInstanceState);

            this.makeTitle   = Intent.GetStringExtra("makeTitle");
            this.makeSlug    = Intent.GetStringExtra("makeSlug");
            this.seriesTitle = Intent.GetStringExtra("seriesTitle");
            this.seriesSlug  = Intent.GetStringExtra("seriesSlug");

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

            this.SupportActionBar.SetHomeButtonEnabled(true);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            this.SupportActionBar.Title = $"{this.makeTitle} {this.seriesTitle}";
            this.SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_close);

            expandableListView = FindViewById <ExpandableListView>(Resource.Id.expandableListView);


            if (this.AssertConnected())
            {
                try
                {
                    yearSelectButton = FindViewById <Spinner>(Resource.Id.yearSelectButton);
                    yearSelectButton.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(yearSelectButton_ItemSelected);

                    await loadYearSpinner();
                }
                catch (Exception e)
                {
                    DialogHelper.ShowErrorMesage(this, e);
                }
            }

            var data = await service.GetSeriesRatings(this.year, this.makeSlug, this.seriesSlug);

            expandableListView.SetAdapter(ExpandableListViewAdapter.CreateFromData(this, data));
        }