Exemplo n.º 1
0
        async void ConfigureView()
        {
            if (IsViewLoaded && movie != null)
            {
                var handle = Insights.TrackTime("TimeLoadMovie", new Dictionary <string, string> {
                    { "MovieID", movie.Id.ToString() }
                });
                handle.Start();
                movie = await PotatoesManager.Instance.GetFullMovieData(movie.Id);

                handle.Stop();

                this.Title = movie.Title;

                criticsScoreLabel.Text  = movie.Ratings.Critics_Score.ToString() + "%";
                audienceScoreLabel.Text = movie.Ratings.Audience_Score.ToString() + "%";
                string  criticsRessources = movie.GetRatingIcon() + ".png";
                UIImage criticsImage      = new UIImage(criticsRessources);
                criticsRatingView.Image = criticsImage;

                firstCastLabel.Text = string.Join(", ", movie.Abridged_Cast.ConvertAll(actor => actor.Name).ToArray(), 0, 2);
                dateLabel.Text      = "In theaters " + movie.Release_Dates.GetTheaterDateReadable();
                subLabel.Text       = movie.Mpaa_Rating + ", " + movie.GetRuntimeReadable();

                synopsisLabel.Text = movie.Synopsis;
                synopsisLabel.AccessibilityIdentifier = "synopsisLabel";
                directorsLabel.Text = string.Join(", ", movie.Abridged_Directors.ConvertAll(director => director.Name).ToArray());
                mpaaLabel.Text      = movie.Mpaa_Rating;
                timeLabel.Text      = movie.GetRuntimeReadable();
                genresLabels.Text   = string.Join(", ", movie.Genres);
                theaterLabel.Text   = movie.Release_Dates.GetTheaterDateReadable();

                moreButton.TouchUpInside += delegate {
                    OpenUrl(movie.Links.Alternate.AbsoluteUri);
                };

                tableViewCast.Source         = castDataSource = new CastDataSource();
                tableViewCast.SeparatorColor = UIColor.Gray;
                tableViewCast.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
                castDataSource.actor         = movie.Abridged_Cast;
                tableViewCast.ReloadData();

                // Download the picture after displaying all the data
                handle = Insights.TrackTime("TimeLoadMovie", new Dictionary <string, string> {
                    { "MovieID", movie.Id.ToString() }
                });
                handle.Start();
                string path = await PictureManager.Download(movie.Posters.Original.AbsoluteUri);

                UIImage thumbnail = new UIImage(path);
                moviePicView.Image = thumbnail;
                handle.Stop();
            }
        }
Exemplo n.º 2
0
        public async void Update()
        {
            titleLabel.Text = movie.Title;
            string path = await PictureManager.Download(movie.Posters.Thumbnail.AbsoluteUri);

            UIImage thumbnails = new UIImage(path);

            imageView.Image = thumbnails;
            string  criticsRessources = movie.GetRatingIcon() + ".png";
            UIImage criticsImage      = new UIImage(criticsRessources);

            criticsRatingView.Image = criticsImage;
            criticsRatingView.AccessibilityLabel = "criticsRatingView-" + movie.Ratings.Critics_Rating;
            criticsScoreLabel.Text = movie.Ratings.Critics_Score.ToString() + "%";
            int actorMax = movie.Abridged_Cast.Count < 2 ? movie.Abridged_Cast.Count : 2;

            actorLabel.Text = string.Join(", ", movie.Abridged_Cast.ConvertAll(actor => actor.Name).ToArray(), 0, actorMax);
            subLabel.Text   = movie.Mpaa_Rating + ", " + movie.GetRuntimeReadable();;
            dateLabel.Text  = movie.Release_Dates.GetTheaterDateReadable();
        }
Exemplo n.º 3
0
            public async void Update(Movie m, Context ctx)
            {
                string path = await PictureManager.Download(m.Posters.Thumbnail.AbsoluteUri);

                Bitmap myBitmap = BitmapFactory.DecodeFile(path);

                pictureView.SetImageBitmap(myBitmap);
                titleView.Text = m.Title;
                scoreView.Text = (m.Ratings.Critics_Score).ToString() + " %";
                mpaaView.Text  = m.Mpaa_Rating;
                int certifiedPic = ctx.Resources.GetIdentifier("drawable/" + m.GetRatingIcon(), null, ctx.PackageName);

                certifiedView.SetImageResource(certifiedPic);
                certifiedView.ContentDescription = "criticsRatingView-" + m.Ratings.Critics_Rating;
                runtime.Text = m.GetRuntimeReadable();
                int    actorMax = m.Abridged_Cast.Count < 2 ? m.Abridged_Cast.Count : 2;
                string value    = string.Join(", ", m.Abridged_Cast.ConvertAll(actor => actor.Name).ToArray(), 0, actorMax);

                actorView.Text = value;
                dateView.Text  = m.Release_Dates.GetTheaterDateReadable();
            }
Exemplo n.º 4
0
        public async void RefreshMovieData(int movieId)
        {
            var handle = Insights.TrackTime("TimeLoadMovie", new Dictionary <string, string> {
                { "MovieID", movieId.ToString() }
            });

            handle.Start();
            movie = await PotatoesManager.Instance.GetFullMovieData(movieId);

            handle.Stop();

            TextView title = FindViewById <TextView>(Resource.Id.titleView);

            title.Text = movie.Title;

            ImageView ratingPicView = FindViewById <ImageView>(Resource.Id.ratingPicView);
            int       certifiedPic  = this.Resources.GetIdentifier("drawable/" + movie.GetRatingIcon(), null, this.PackageName);

            ratingPicView.SetImageResource(certifiedPic);

            TextView ratingPercentView = FindViewById <TextView>(Resource.Id.ratingPercentView);

            ratingPercentView.Text = movie.Ratings.Critics_Score.ToString() + " %";

            TextView userRatingPercentView = FindViewById <TextView>(Resource.Id.userRatingPercentView);

            userRatingPercentView.Text = movie.Ratings.Audience_Score.ToString() + " %";

            TextView actorView = FindViewById <TextView>(Resource.Id.actorView);
            int      actorMax  = movie.Abridged_Cast.Count < 2 ? movie.Abridged_Cast.Count : 2;

            actorView.Text = string.Join(", ", movie.Abridged_Cast.ConvertAll(actor => actor.Name).ToArray(), 0, actorMax);


            TextView theaterRealseView = FindViewById <TextView>(Resource.Id.theaterRealseView);

            theaterRealseView.Text = movie.Release_Dates.GetTheaterDateReadable();

            TextView mpaaView = FindViewById <TextView>(Resource.Id.mpaaView);

            mpaaView.Text = movie.Mpaa_Rating;

            TextView runtime = FindViewById <TextView>(Resource.Id.runtime);

            runtime.Text = movie.GetRuntimeReadable();

            TextView synopsisView = FindViewById <TextView>(Resource.Id.synopsisView);

            synopsisView.Ellipsize = TextUtils.TruncateAt.End;
            synopsisView.SetMaxLines(4);
            synopsisView.Text = movie.Synopsis;

            TextView directorView = FindViewById <TextView>(Resource.Id.directorView);

            directorView.Text = string.Join(", ", movie.Abridged_Directors.ConvertAll(director => director.Name).ToArray());

            TextView genreView = FindViewById <TextView>(Resource.Id.genreView);

            genreView.Text = string.Join(", ", movie.Genres);

            TextView runningTimeView = FindViewById <TextView>(Resource.Id.runningTimeView);

            runningTimeView.Text = movie.GetRuntimeReadable();

            TextView theaterReleaseView = FindViewById <TextView>(Resource.Id.theaterReleaseView);

            theaterReleaseView.Text = movie.Release_Dates.GetTheaterDateReadable();

            LinearLayout castList = FindViewById <LinearLayout>(Resource.Id.castListView);

            castList.RemoveAllViews();
            LayoutInflater inflater = (LayoutInflater)this.GetSystemService(Context.LayoutInflaterService);

            foreach (People p in movie.Abridged_Cast)
            {
                View     view = inflater.Inflate(Resource.Layout.Adapter_Movie_Cast, null);
                TextView text = view.FindViewById <TextView>(Resource.Id.textView);
                text.Text = p.Name;
                castList.AddView(view);
            }

            LinearLayout titleBar = FindViewById <LinearLayout>(Resource.Id.titleBar);

            titleBar.Click += delegate {
                Finish();
            };

            LinearLayout movieDesc = FindViewById <LinearLayout>(Resource.Id.movieDesc);

            movieDesc.Click += delegate {
                this.openUrl(movie.Links.Alternate.AbsoluteUri);
            };

            // Download the picture after displaying all the data
            ImageView pictureView = FindViewById <ImageView>(Resource.Id.pictureView);

            handle = Insights.TrackTime("TimeLoadMoviePosters", movie.GetData());
            handle.Start();
            string path = await PictureManager.Download(movie.Posters.Original.AbsoluteUri);

            Bitmap ThumbnailBitmap = BitmapFactory.DecodeFile(path);

            pictureView.SetImageBitmap(ThumbnailBitmap);
            handle.Stop();
        }