public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(Arguments.GetString("myShowString")); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(savedInstanceState.GetString("showSerialized")); } // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); var view = inflater.Inflate(Resource.Layout.show_description_fragment, container, false); var backgroundLinearLayout = view.FindViewById<LinearLayout>(Resource.Id.linLayout); //backgroundLinearLayout.SetBackgroundColor(Color.Red); //Koush.UrlImageViewHelper.SetUrlDrawable(backgroundLinearLayout, // "http://image.tmdb.org/t/p/w92" + _myShow.Seasons[position].PosterPath); var showTitle = view.FindViewById<TextView>(Resource.Id.showTitle); showTitle.Text = _myShow.Name + " with " + _myShow.Actors.Count + " in the cast and the Overview:"+ _myShow.Overview; return view; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _stateMemory = new StateMemory(); //positionInEpisodeTabList = 0; LayoutInflater.Inflate(Resource.Layout.shows_overview_activity, _BaseFrameLayout); _myShow = await PopulateSeasons(Intent.GetStringExtra("TMDBID")); SetTitle("Description for show " + _myShow.Name); if (savedInstanceState != null) { _stateMemory._isAfterAnimation = savedInstanceState.GetBoolean(KEY_ISAFTERANIMATION, false); //positionInEpisodeTabList = savedInstanceState.GetInt("position", 0); } else { _stateMemory._isAfterAnimation = false; } SetUpBeforeFragment(); }
public void Setup() { var assembly = Assembly.GetExecutingAssembly(); var resource = "All.com.robobat.UnitTests.TxtFiles.JSONBreakingBadShow.txt"; using (Stream stream = assembly.GetManifestResourceStream(resource)) using (StreamReader reader = new StreamReader(stream)) { _FULLSHOWJSON = reader.ReadToEnd(); } JSONParserForTMDB myParser = new JSONParserForTMDB(_FULLSHOWJSON); _FULLJSONSEASONLIST = new List<string>(); for (int i = 1; i <= 5; i++) { resource = "All.com.robobat.UnitTests.TxtFiles.JSONBreakingBadSeason" + i + ".txt"; using (Stream stream = assembly.GetManifestResourceStream(resource)) using (StreamReader reader = new StreamReader(stream)) { _FULLJSONSEASONLIST.Add(reader.ReadToEnd()); } } myParser.PopulateSeasonsFromJsonList(_FULLJSONSEASONLIST); _myShow = myParser.show; }
public void AddShow(TVShow show) { if (show != null) { _tvShowList.Add(show); } }
public void TestForMultipleShows(TVShow myShow, Dictionary<string, object> expectedValues) { Assert.AreEqual(expectedValues["name"], myShow.Name); Assert.AreEqual(expectedValues["numberOfSeasons"], _myShow.NumberOfSeasons); Assert.AreEqual(expectedValues["network"], _myShow.Network); }
public DetailsShowSeasonListAdapter(Activity a, int position, TVShow myShow, bool highlightSelectedIndex) { mActivity = a; selectedIndex = position; _myShow = myShow; _showSetSelectedIndex = highlightSelectedIndex; }
public JSONParserForTMDB(string data) { fullShowJSONData = data; show = new TVShow(); PopulateTVShowFromJSON(); }
public void Setup () { myShow = new TVShow (); myShow.Name = "Breaking Bad"; myShow.Network = "AMC"; }
public static ShowsOverviewMajorFragment NewInstance(TVShow show) { var frag = new ShowsOverviewMajorFragment(); var args = new Bundle(); var serializedShow = JsonConvert.SerializeObject(show); args.PutString("myShowString", serializedShow); frag.Arguments = args; return frag; }
public void SetPositionAndShow(int pos, TVShow show) { _myShow = show; SelectedIndex = pos; _adapter.SetTVSeasonList(_myShow.Seasons); _adapter.setSelectedIndex(SelectedIndex); _adapter.NotifyDataSetChanged(); }
public void Setup () { myShow = new TVShow (); myShow.Name = "Dexter"; myShow.Network = "Showtime"; }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (Arguments != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(Arguments.GetString("myShowString")); selectedTab = Arguments.GetInt("tabPosition", 0); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (Arguments != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(Arguments.GetString("myShowString")); SelectedIndex = Arguments.GetInt("index", 0); _showSelectedIndex = Arguments.GetBoolean("highlight", false); } // Create your fragment here }
public static NextUnwatchedEpisodeFragment NewInstance(TVShow show) { NextUnwatchedEpisodeFragment frag = new NextUnwatchedEpisodeFragment(); Bundle args = new Bundle(); string serializedShow = JsonConvert.SerializeObject(show); args.PutString("myShowString", serializedShow); frag.Arguments = args; return frag; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(savedInstanceState.GetString("showSerialized")); } var view = inflater.Inflate(Resource.Layout.shows_tab_holder, container, false); SetUpTabLayout(view); return view; }
public static ShowDescriptionFragment NewInstance(TVShow show) { ShowDescriptionFragment frag = new ShowDescriptionFragment(); Bundle args = new Bundle(); string serializedShow = JsonConvert.SerializeObject(show); args.PutString("myShowString", serializedShow); frag.Arguments = args; return frag; }
public static ShowTabHolderFragment NewInstance(TVShow show, int tabPosition) { ShowTabHolderFragment frag = new ShowTabHolderFragment(); Bundle args = new Bundle(); string serializedShow = JsonConvert.SerializeObject(show); args.PutString("myShowString", serializedShow); args.PutInt("tabPosition", tabPosition); frag.Arguments = args; return frag; }
public static DetailsShowSeasonListFragment NewInstance(TVShow show, int index, bool highlightSelectedIndex) { DetailsShowSeasonListFragment frag = new DetailsShowSeasonListFragment(); Bundle args = new Bundle(); string serializedShow = JsonConvert.SerializeObject(show); args.PutString("myShowString", serializedShow); args.PutInt("index", index); args.PutBoolean("highlight", highlightSelectedIndex); frag.Arguments = args; return frag; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(savedInstanceState.GetString("showSerialized")); } // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); var view = inflater.Inflate(Resource.Layout.next_unwatched_episode_fragment, container, false); BasicTextView = view.FindViewById<TextView>(Resource.Id.nextEpisodeTextView); return view; }
public void UpdateShow(TVShow show) { _myShow = show; SetUpTextView(); }
public void UpdateWatchedEpisode(TVShow show) { _myShow = show; _adapter.UpdateWatchedEpisode(_myShow); RefreshAdapter(); }
public async Task DownloadShow(string id) { TVShow show = new TVShow(); string myURL = "https://api.themoviedb.org/3/tv/" + id + "?api_key=661b76973b90b91e0df214904015fd4d"; var client = new HttpClient(); var data = await client.GetStringAsync(myURL); JObject o = JObject.Parse(data); show.Name = o["name"] + ""; show.Network = o["networks"][0]["name"] + ""; show.NumberOfSeasons = (int)o["number_of_seasons"]; show.TMDBID = o["id"] + ""; show.PosterLink = o["poster_path"] + ""; show.Overview = o["overview"] + ""; show.Language = o["languages"][0] + ""; show.isSaved = TMDBFileLoading.TMDBShowFileExists(id); _myShowList.Add(show); AddShowToAdapter(show); }
public void UpdateWatchedEpisode(TVShow show) { _myShow = show; }
public EpisodeManagerAdapter(FragmentManager fm, string[] myTitles, TVShow show ) : base(fm) { _titles = myTitles; TrakkedShowList = new List<string>(); _myShow = show; }
private async Task PopulateSeasonsAndSetUpFragments() { if (!TMDBFileLoading.TMDBShowFileExists(Intent.GetStringExtra("TMDBID"))) { string myURL = "https://api.themoviedb.org/3/tv/" + Intent.GetStringExtra("TMDBID") + "?api_key=661b76973b90b91e0df214904015fd4d"; var client = new HttpClient(); var data = await client.GetStringAsync(myURL); JObject o = JObject.Parse(data); _myShow.Name = o["name"] + ""; _myShow.Network = o["networks"][0]["name"] + ""; _myShow.NumberOfSeasons = (int) o["number_of_seasons"]; _myShow.TMDBID = o["id"] + ""; //_myShow.FullJson = data; _myShow.PosterLink = o["poster_path"] + ""; _myShow.Overview = o["overview"] + ""; _myShow.Language = o["languages"][0] + ""; //SupportActionBar._title = _myShow.Name; //await _myShow.PopulateSeasonJSONListFromWeb(); //_myTextView.Text = _myShow.Name + " is on " + _myShow.Network; //SetUpListViewFragment(); _myShow.Seasons = new List<TVSeason>(); for (int i = 1; i <= _myShow.NumberOfSeasons; i++) { TVSeason mySeason = new TVSeason(); string mySeasonURL = "https://api.themoviedb.org/3/tv/" + Intent.GetStringExtra("TMDBID") + "/season/" + i + "?api_key=661b76973b90b91e0df214904015fd4d"; var seasonClient = new HttpClient(); var seasonData = await seasonClient.GetStringAsync(mySeasonURL); JObject seasonJObject = JObject.Parse(seasonData); mySeason.AirDate = "" + seasonJObject["air_date"]; mySeason.TVDBID = "" + seasonJObject["id"]; mySeason.Overview = "" + seasonJObject["overview"]; mySeason.PosterPath = "" + seasonJObject["poster_path"]; mySeason.SeasonNumber = (int) seasonJObject["season_number"]; JArray myEpisodeArray = (JArray) seasonJObject.SelectToken("episodes"); mySeason.EpisodeCount = myEpisodeArray.Count; mySeason.Episodes = new List<TVEpisode>(); foreach (JToken episodeJToken in myEpisodeArray) { TVEpisode myEpisode = new TVEpisode { EpisodeNumber = (int) episodeJToken["episode_number"], SeasonNumber = i, Name = "" + episodeJToken["name"], AirDate = "" + episodeJToken["air_date"], StillPath = "" + episodeJToken["still_path"], Overview = "" + episodeJToken["overview"] }; mySeason.Episodes.Add(myEpisode); } _myShow.Seasons.Add(mySeason); } string showToSave = JsonConvert.SerializeObject(_myShow); TMDBFileSaving.saveTMDBShowJSON(Intent.GetStringExtra("TMDBID"), showToSave); } else { Console.WriteLine("Show has been saved"); string loadedShow = TMDBFileLoading.loadTMDBShowJSONFromFile(Intent.GetStringExtra("TMDBID")); _myShow = JsonConvert.DeserializeObject<TVShow>(loadedShow); } //string serialized = JsonConvert.SerializeObject(_myShow); //Console.UpdateTrakkedShowList(serialized); //_myShow = new TVShow(); //_myShow = JsonConvert.DeserializeObject<TVShow>(serialized); //Console.UpdateTrakkedShowList(JsonConvert.SerializeObject(_myShow)); // Console.UpdateTrakkedShowList("Last Episode of First Season is titled " + // _myShow.SeasonList[0].TVEpisodes[_myShow.SeasonList[0].TVEpisodes.Count - 1].Name); SetUpTitle(); SetUpBothFragments(); GetUpdatedParseObject(); //IEnumerable<TVEpisodeForParse> trakkedEpisodeList = await GetParseEpisodeObject(); //UpdateShowEpisodesWithTrakkedEpisode(trakkedEpisodeList); }
private async void PopulateSeasons() { string myURL = "https://api.themoviedb.org/3/tv/1396?api_key=661b76973b90b91e0df214904015fd4d"; var client = new HttpClient(); var data = await client.GetStringAsync(myURL); JObject o = JObject.Parse(data); _myShow.Name = o["name"] + ""; _myShow.Network = o["networks"][0]["name"] + ""; _myShow.NumberOfSeasons = (int)o["number_of_seasons"]; _myShow.TMDBID = o["id"] + ""; //_myShow.FullJson = data; _myShow.PosterLink = o["poster_path"] + ""; _myShow.Overview = o["overview"] + ""; _myShow.Language = o["languages"][0] + ""; // SupportActionBar._title = _myShow.Name; //await _myShow.PopulateSeasonJSONListFromWeb(); //_myTextView.Text = _myShow.Name + " is on " + _myShow.Network; //SetUpListViewFragmnet(); _myShow.Seasons = new List<TVSeason>(); for (int i = 1; i <= _myShow.NumberOfSeasons; i++) { TVSeason mySeason = new TVSeason(); string mySeasonURL = "https://api.themoviedb.org/3/tv/1396/season/"+i+"?api_key=661b76973b90b91e0df214904015fd4d"; var seasonClient = new HttpClient(); var seasonData = await seasonClient.GetStringAsync(mySeasonURL); JObject seasonJObject = JObject.Parse(seasonData); mySeason.AirDate = "" + seasonJObject["air_date"]; mySeason.TVDBID = "" + seasonJObject["id"]; mySeason.Overview = "" + seasonJObject["overview"]; mySeason.PosterPath = "" + seasonJObject["poster_path"]; mySeason.SeasonNumber = (int)seasonJObject["season_number"]; JArray myEpisodeArray = (JArray)seasonJObject.SelectToken("episodes"); mySeason.EpisodeCount = myEpisodeArray.Count; mySeason.Episodes = new List<TVEpisode>(); for (int j = 0; j < myEpisodeArray.Count; j++) { JToken episodeJToken = myEpisodeArray[j]; TVEpisode myEpisode = new TVEpisode(); myEpisode.EpisodeNumber = (int)episodeJToken["episode_number"]; myEpisode.Name = "" + episodeJToken["name"]; mySeason.Episodes.Add(myEpisode); } _myShow.Seasons.Add(mySeason); } string serialized = JsonConvert.SerializeObject(_myShow); Console.WriteLine(serialized); _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(serialized); Console.WriteLine(JsonConvert.SerializeObject(_myShow)); // Console.UpdateTrakkedShowList("Last Episode of First Season is titled " + // _myShow.SeasonList[0].TVEpisodes[_myShow.SeasonList[0].TVEpisodes.Count - 1].Name); }
private void AddShowToAdapter(TVShow show) { _adapter.AddShow(show); _adapter.NotifyDataSetChanged(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.details_show_activity); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); //Toolbar will now take on default actionbar characteristics SetSupportActionBar(_toolbar); //SupportActionBar._title = ""; SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); SupportActionBar.SetDisplayHomeAsUpEnabled(true); _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); _selectedSeason = Intent.GetIntExtra("seasonPosition", 0); var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view); if (navigationView != null) { SetupDrawerContent(navigationView); } //Set up names in Nav view, maybe need to extend base activity to hold navigation view //var navHeader= LayoutInflater.Inflate(Resource.Layout.nav_header, navigationView); //var textViewInNav = navHeader.FindViewById<TextView>(Resource.Id.username); //textViewInNav.Text = ParseUser.CurrentUser.Email; _myShow = new TVShow(); _myTextView = FindViewById<TextView>(Resource.Id.tvForID); var bClickCounter = FindViewById<Button>(Resource.Id.bClickCounter); bClickCounter.Click += delegate(object sender, EventArgs args) { GetParseEpisodeObject(); }; if (bundle != null) { _myShow = new TVShow(); _myShow = JsonConvert.DeserializeObject<TVShow>(bundle.GetString("showSerialized")); SetUpTitle(); SetUpBothFragments(); } else { myDownloadTask = PopulateSeasonsAndSetUpFragments(); } }
public static async Task<TVShow> DownloadTVShowAndSave(string tmdbID) { var show = new TVShow(); var myURL = "https://api.themoviedb.org/3/tv/" + tmdbID + "?api_key=661b76973b90b91e0df214904015fd4d"; var client = new HttpClient(); var data = await client.GetStringAsync(myURL); var o = JObject.Parse(data); show.Name = o["name"] + ""; show.Network = o["networks"][0]["name"] + ""; show.NumberOfSeasons = (int) o["number_of_seasons"]; var mySeasonArray = (JArray) o.SelectToken("seasons"); var elementsInSeasons = mySeasonArray.Count; var hasSeasonZero = mySeasonArray.Count > show.NumberOfSeasons; show.TMDBID = o["id"] + ""; show.PosterLink = o["poster_path"] + ""; show.Overview = o["overview"] + ""; show.Language = o["languages"][0] + ""; show.Seasons = new List<TVSeason>(); var endAtSeason = hasSeasonZero ? 0 : 1; for (var i = show.NumberOfSeasons; i >= endAtSeason; i--) { var mySeason = new TVSeason(); var mySeasonURL = "https://api.themoviedb.org/3/tv/" + tmdbID + "/season/" + i + "?api_key=661b76973b90b91e0df214904015fd4d"; var seasonClient = new HttpClient(); try { var seasonData = await seasonClient.GetStringAsync(mySeasonURL); var seasonJObject = JObject.Parse(seasonData); mySeason.AirDate = "" + seasonJObject["air_date"]; mySeason.TVDBID = "" + seasonJObject["id"]; mySeason.Overview = "" + seasonJObject["overview"]; mySeason.PosterPath = "" + seasonJObject["poster_path"]; mySeason.SeasonNumber = (int) seasonJObject["season_number"]; var myEpisodeArray = (JArray) seasonJObject.SelectToken("episodes"); mySeason.EpisodeCount = myEpisodeArray.Count; mySeason.Episodes = new List<TVEpisode>(); foreach (var episodeJToken in myEpisodeArray) { var myEpisode = new TVEpisode { EpisodeNumber = (int) episodeJToken["episode_number"], SeasonNumber = i, Name = "" + episodeJToken["name"], AirDate = "" + episodeJToken["air_date"], StillPath = "" + episodeJToken["still_path"], Overview = "" + episodeJToken["overview"] }; mySeason.Episodes.Add(myEpisode); } show.Seasons.Add(mySeason); } catch (Exception ex) { //Takes care of 404, need to confirm Console.WriteLine("I caught this" + ex); } } var creditsURL = "https://api.themoviedb.org/3/tv/" + tmdbID + "/credits?api_key=661b76973b90b91e0df214904015fd4d"; var creditClient = new HttpClient(); var creditData = await creditClient.GetStringAsync(creditsURL); var creditJObject = JObject.Parse(creditData); show.Actors = new List<Actor>(); var myActorArray = (JArray) creditJObject.SelectToken("cast"); foreach (var actorJToken in myActorArray) { var actor = new Actor { characterName = "" + actorJToken["character"], creditId = "" + actorJToken["credit_id"], tmdbID = "" + actorJToken["id"], name = "" + actorJToken["name"], profilePath = "" + actorJToken["profile_path"], order = (int) actorJToken["order"] }; show.Actors.Add(actor); } string showToSave = JsonConvert.SerializeObject(show); TMDBFileSaving.saveTMDBShowJSON(show.TMDBID, showToSave); return show; }