Пример #1
0
        private async void LoadEpisodeData(string link)
        {
            loadingView.Visibility = Android.Views.ViewStates.Visible;
            epData = await WebData.GetDetailsForTVShowEpisode(link);
            loadingView.Visibility = Android.Views.ViewStates.Gone;
            if (epData != null)
            {
                InvalidateOptionsMenu();
                collapseToolbar.TitleEnabled = false;
                SupportActionBar.SetDisplayShowTitleEnabled(false);

                var titleView = FindViewById<AppCompatTextView>(Resource.Id.image_toolbar_main_title);
                var descriptionView = FindViewById<AppCompatTextView>(Resource.Id.image_toolbar_main_description);
                var releaseView = FindViewById<AppCompatTextView>(Resource.Id.image_toolbar_main_release);
                var genreView = FindViewById<AppCompatTextView>(Resource.Id.image_toolbar_main_genre);
                var imageView = FindViewById<AppCompatImageView>(Resource.Id.image_toolbar_main_image);
                SupportActionBar.Title = titleView.Text = epData.EpisodeShowTitle;
                descriptionView.Text = epData.EpisodeSummary;
                releaseView.Text = epData.EpisodeAirDate;
                genreView.Text = epData.EpisodeFullNameNumber;
                SupportActionBar.Subtitle = epData.EpisodeNumber;
                Picasso.With(this).Load(epData.EpisodeImage).Into(imageView);
                
                if (epData.IsEpisodeWatchable)
                {
                    var adapter = new EpisodesAdapter<EpisodeStreamLink>(epData.EpisodeStreamLinks, DataEnum.DataType.EpisodeStreamLinks, null);
                    dataRV.SetAdapter(adapter);
                    adapter.ItemClick += (s, e) =>
                    {
                        // handle watch episode here
                        // first get the decoded link from WebView and JavaValueCallback
                        LoadEncodedLinkFromWebView(adapter.GetItem(e));
                    };
                }
                else
                {
                    Helper.Error.Instance.ShowErrorSnack("No links found. Episode cannot be streamed.", dataRV);
                }
            }
            else
            {
                Helper.Error.Instance.ShowErrorSnack("Episode data could not be loaded.", dataRV);
            }
        }