private void StartVideoPlayer ()
		{
			var b = this.Intent.Extras;
			mSelectedMovie = Utils.Deserialize(this.Intent.GetStringExtra (
				Resources.GetString (Resource.String.movie)));
			if (null != b) {
				mShouldStartPlayback = b.GetBoolean (Resources.GetString (Resource.String.should_start));
				int startPosition = b.GetInt (Resources.GetString (Resource.String.start_position), 0);
				mVideoView.SetVideoPath (mSelectedMovie.VideoUrl);
				if (mShouldStartPlayback) {
					mPlaybackState = PlaybackState.PLAYING;
					UpdatePlayButton (mPlaybackState);
					if (startPosition > 0) {
						mVideoView.SeekTo (startPosition);
					}
					mVideoView.Start ();
					mPlayPause.RequestFocus ();
					StartControllersTimer ();
				} else {
					UpdatePlaybackLocation ();
					mPlaybackState = PlaybackState.PAUSED;
					UpdatePlayButton (mPlaybackState);
				}
			}
		}
		private PendingIntent BuildPendingIntent(Movie movie) {
			var detailsIntent = new Intent(this, typeof( DetailsActivity));
			detailsIntent.PutExtra(GetString(Resource.String.movie), Utils.Serialize(movie));

			var stackBuilder = TaskStackBuilder.Create(this);
			stackBuilder.AddParentStack(Utils.ToJavaClass(typeof(DetailsActivity)));
			stackBuilder.AddNextIntent(detailsIntent);
			// Ensure a unique PendingIntents, otherwise all recommendations end up with the same
			// PendingIntent
			detailsIntent.SetAction(Java.Lang.Long.ToString(movie.Id));

			var intent = stackBuilder.GetPendingIntent (0, PendingIntentFlags.UpdateCurrent);
			return intent;
		}
예제 #3
0
        public static string Serialize(Movie movie)
        {
            string raw = "{0}\n{1}\n{2}\n{3}\n{4}";

            return(String.Format(raw, movie.Title, movie.VideoUrl, movie.BgImageUrl, movie.CardImageUrl, movie.Category));
        }
예제 #4
0
		private static Movie BuildMovieInfo (string category, string title, string description, 
		                                     string studio, string videoUrl, string cardImageUrl,
		                                     string bgImageUrl)
		{
			var movie = new Movie ();
			movie.Id = Movie.count;
			Movie.incCount ();
			movie.Title = title.Replace ("\"", "");
			movie.Description = description.Replace ("\"", "");
			movie.Studio = studio.Replace ("\"", "");
			movie.Category = category.Replace ("\"", "");
			movie.CardImageUrl = cardImageUrl.Replace ("\"", "");
			movie.BgImageUrl = bgImageUrl.Replace ("\"", "");
			movie.VideoUrl = videoUrl.Replace ("\"", "");
			return movie;
		}