protected override void OnCreate (Bundle savedInstanceState) {
			base.OnCreate (savedInstanceState);

			// Set our view from the "main" layout resource
			this.SetContentView (Resource.Layout.movie_detail);

			// Create your application here
			var strConfig = this.Intent.Extras.GetString ("Configuration");
			var strSelectedMovie = this.Intent.Extras.GetString ("SelectedMovie");
			this.configuration = JsonConvert.DeserializeObject<ConfigurationResponse> (strConfig);
			this.movieDetail = JsonConvert.DeserializeObject<Movie> (strSelectedMovie);

			this.btnPlay = this.FindViewById<Button> (Resource.Id.movie_detail_btnPlay);
			this.btnPlay.Click += this.btnPlay_Click;
			this.btnFavorite = this.FindViewById<Button> (Resource.Id.movie_detail_btnFavorite);
			this.btnFavorite.Click += this.btnFavorite_Click;
			this.btnClose = this.FindViewById<ImageButton> (Resource.Id.movie_detail_close);
			this.btnClose.Click += this.btnClose_Click;
			this.txtTitle = this.FindViewById<TextView> (Resource.Id.movie_detail_txtTitle);
			this.txtReleaseDate = this.FindViewById<TextView> (Resource.Id.movie_detail_txtReleaseDate);
			this.ratingBar = this.FindViewById<RatingBar> (Resource.Id.movie_detail_ratingBar);
			this.txtVoteCount = this.FindViewById<TextView> (Resource.Id.movie_detail_txtVoteCount);
			this.txtOverview = this.FindViewById<TextView> (Resource.Id.movie_detail_txtOverview);
			this.imgPoster = this.FindViewById<ImageView> (Resource.Id.movie_detail_imgPoster);
			this.vwSimilarMovies = this.FindViewById<RelativeLayout> (Resource.Id.movie_detail_vwSimilarMovies);
			this.movieList = this.FindViewById<RecyclerView>(Resource.Id.movie_detail_lstSimilarMovies);
			this.movieLayoutManager = new LinearLayoutManager (this, LinearLayoutManager.Horizontal, false);
			this.movieList.SetLayoutManager (this.movieLayoutManager);

			this.updateLayout ();
		}
		public void Bind (Movie movie, ConfigurationResponse configuration) {
			this.data = movie;
			this.configuration = configuration;

			this.vwFavoriteIndicator.Hidden = !Data.Current.IsInFavorites (this.data);
			var imageUri = new Uri (String.Concat (this.configuration.Images.BaseUrl, this.configuration.Images.PosterSizes [0], this.data.PosterPath));
			this.imgPoster.Image = ImageLoader.DefaultRequestImage (imageUri, this);
		}
		public override void PrepareForReuse () {
			this.data = null;
			this.configuration = null;
			this.SetHighlighted (false, false);
			this.Selected = false;

			base.PrepareForReuse ();
		}
		private void collectionViewSource_MovieSelected (object sender, Movie e) {
			this.stopPulseBackground ();
			MovieDetailViewController newDetail = UIStoryboard.FromName ("Main", null).InstantiateViewController ("MovieDetail") as MovieDetailViewController;
			newDetail.MovieDetail = e;
			newDetail.Configuration = this.Configuration;
			this.NavigationController.PushViewController (newDetail, true);
		}
		private void collectionViewSource_MovieSelected (object sender, Movie e) {
			if (this.selectionAction != null)
				this.selectionAction (e);			
		}
		protected void OnMovieSelected (Movie movie) {
			if (this.MovieSelected != null)
				this.MovieSelected (this, movie);
		}
示例#7
0
		/// <summary>
		/// Removes this instance of <see cref="Movie"/> from favorites.
		/// </summary>
		/// <param name="movie">Movie.</param>
		public void RemoveFromFavorites (Movie movie) {
			var existing = this.favorites.FirstOrDefault (x => x.Id == movie.Id);
			if (existing != null) {
				this.favorites.Remove (existing);
				this.cache.Set <List<Movie>>(StringResources.FavoritesCacheKey, this.favorites);
			}
		}
示例#8
0
		/// <summary>
		/// Determines whether this instance of <see cref="Movie"/> is in the favorites list.
		/// </summary>
		/// <returns><c>true</c> if this instance is in favorites; otherwise, <c>false</c>.</returns>
		/// <param name="movie">Movie.</param>
		public bool IsInFavorites (Movie movie) {
			if (this.favorites == null)
				return false;
			return this.favorites.FirstOrDefault (x => x.Id == movie.Id) != null;
		}
		private void tableViewSource_MovieSelected (object sender, Movie e) {
			this.selectedMovie = e;
			this.PerformSegue ("ShowMovieDetail", this);
		}