public override void OnStart() { Film f = SharedComponents.CurrentFilm; DetailedFilm df = WaitForItBLL.Singleton.GetMovie(f); _userReview = SharedComponents.CurrentUser.GetUserReview(f.Id); _movieTitleTextView = Activity.FindViewById <TextView>(Resource.Id.filmNameTextView); _movieReleaseDateTextView = Activity.FindViewById <TextView>(Resource.Id.filmRealeaseDateTextView); _movieOverviewTextView = Activity.FindViewById <TextView>(Resource.Id.filmOverviewTextView); _moviePosterImageView = Activity.FindViewById <ImageView>(Resource.Id.filmPosterImageView); _movieDirectorTextView = Activity.FindViewById <TextView>(Resource.Id.filmDirectorTextView); _movieActorsTextView = Activity.FindViewById <TextView>(Resource.Id.filmCastTextView); _movieNoteTextView = Activity.FindViewById <TextView>(Resource.Id.filmNotesTextView); _movieNoteCountTextView = Activity.FindViewById <TextView>(Resource.Id.filmNotesCountTextView); _movieRuntimeTextView = Activity.FindViewById <TextView>(Resource.Id.filmRuntimeTextView); _movieGenresTextView = Activity.FindViewById <TextView>(Resource.Id.filmGenresTextView); _yepButton = Activity.FindViewById <Button>(Resource.Id.yepButton); _nopButton = Activity.FindViewById <Button>(Resource.Id.nopButton); _reviewStatusTextView = Activity.FindViewById <TextView>(Resource.Id.reviewStatusTextView); _positiveReviewsTextView = Activity.FindViewById <TextView>(Resource.Id.positiveReviewsTextView); _negativeReviewsTextView = Activity.FindViewById <TextView>(Resource.Id.negativeReviewsTextView); _percentageTextView = Activity.FindViewById <TextView>(Resource.Id.percentageTextView); _percentageProgressBar = Activity.FindViewById <ProgressBar>(Resource.Id.percentageProgressBar); _movieTitleTextView.Text = df.Title; _movieReleaseDateTextView.Text = Resources.GetString(Resource.String.Released, df.ReleaseDate.ToLongDateString()); _movieOverviewTextView.Text = (df.Overview == null || df.Overview == string.Empty) ? Resources.GetString(Resource.String.EmptyOverview) : df.Overview; _movieActorsTextView.Text = df.Acteurs; _movieDirectorTextView.Text = Resources.GetString(Resource.String.By, df.Realisateur); _movieNoteTextView.Text = $"{df.VoteAverage}/10"; _movieNoteCountTextView.Text = Resources.GetQuantityString(Resource.Plurals.ReviewsCount, df.VoteCount, df.VoteCount); _movieRuntimeTextView.Text = df.Duree.ToString(); _movieGenresTextView.Text = df.Genres; if (df.Duree == TimeSpan.Zero) { _movieRuntimeTextView.Visibility = ViewStates.Gone; } if (df.Realisateur == null) { _movieDirectorTextView.Visibility = ViewStates.Gone; } _moviePosterImageView.SetUrlDrawable(df.PosterBigImagePath, Android.Resource.Drawable.IcMenuGallery); _positiveReviewsTextView.Text = Resources.GetString(Resource.String.SaidYes, df.PositiveReviewsCount); _negativeReviewsTextView.Text = Resources.GetString(Resource.String.SaidNo, df.NegativeReviewsCount); _percentageTextView.Text = $"{f.YesPercentage}%"; _percentageProgressBar.SetProgress(f.YesPercentage, false); _percentageProgressBar.ProgressDrawable.SetColorFilter(GetGradientColor(f.YesPercentage), PorterDuff.Mode.SrcIn); _yepButton.Click += _yepButton_Click; _nopButton.Click += _nopButton_Click; GestionAffichageUtilisateur(); base.OnStart(); }
public DetailedFilm GetMovie(Film film) { DetailedFilm detailedFilm = new DetailedFilm(film); TMDbLib.Objects.Movies.Movie movie = WaitForItDAL.Singleton.GetMovieFullDetails(film.Id); detailedFilm.Duree = TimeSpan.FromMinutes(movie.Runtime ?? 0); detailedFilm.Genres = string.Join(" / ", movie.Genres.Select(i => i.Name).ToArray()); detailedFilm.Realisateur = movie.Credits.Crew.Find(i => i.Job == "Director")?.Name; detailedFilm.Acteurs = string.Join(System.Environment.NewLine, movie.Credits.Cast.Select(i => i.Name).Take(4).ToArray()); detailedFilm.VoteAverage = movie.VoteAverage; detailedFilm.VoteCount = movie.VoteCount; return(detailedFilm); }