public void OnInitializationSuccess(YouTubeThumbnailView thumbnailView, IYouTubeThumbnailLoader thumbnailLoader) { this.thumbnailLoader = thumbnailLoader; thumbnailLoader.SetOnThumbnailLoadedListener(new ThumbnailListener() { ThumbnailLoaded = (thumbnail, videoId) => { nextThumbnailLoaded = true; if (activityResumed) { if (state.Equals(State.LOADING_THUMBNAILS)) { FlipNext(); } else if (state.Equals(State.VIDEO_FLIPPED_OUT)) { // load player with the video of the next thumbnail being flipped in state = State.VIDEO_LOADING; player.CueVideo(videoId); } } }, ThumbnailError = (thumbnail, reason) => { LoadNextThumbnail(); } }); MaybeStartDemo(); }
void YouTubeThumbnailView.IOnInitializedListener.OnInitializationSuccess(YouTubeThumbnailView view, IYouTubeThumbnailLoader loader) { loader.SetOnThumbnailLoadedListener(this); thumbnailViewToLoaderMap.Add(view, loader); view.SetImageResource(Resource.Drawable.loading_thumbnail); var videoId = (string)view.Tag; loader.SetVideo(videoId); }
public void OnInitializationSuccess(YouTubeThumbnailView view, IYouTubeThumbnailLoader loader) { loader.SetOnThumbnailLoadedListener(this); OnInitializationSuccessAction?.Invoke(view, loader); //thumbnailViewToLoaderMap.put(view, loader); view.SetImageResource(Resource.Drawable.loading_thumbnail); string videoId = (string)view.Tag; loader.SetVideo(videoId); }
void YouTubeThumbnailView.IOnInitializedListener.OnInitializationFailure(YouTubeThumbnailView thumbnailView, YouTubeInitializationResult errorReason) { if (errorReason.IsUserRecoverableError) { if (errorDialog == null || !errorDialog.IsShowing) { errorDialog = errorReason.GetErrorDialog(this, RecoveryDialogRequest); errorDialog.Show(); } } else { var errorMessage = string.Format(GetString(Resource.String.error_thumbnail_view), errorReason); Toast.MakeText(this, errorMessage, ToastLength.Long).Show(); } }
public void OnInitializationFailure(YouTubeThumbnailView thumbnailView, YouTubeInitializationResult errorReason) { if (errorReason.IsUserRecoverableError) { if (errorDialog == null || !errorDialog.IsShowing) { errorDialog = errorReason.GetErrorDialog(this, RECOVERY_DIALOG_REQUEST); errorDialog.Show(); } } else { string errorMessage = string.Format(GetString(Resource.String.error_thumbnail_view), errorReason.ToString()); Toast.MakeText(this, errorMessage, ToastLength.Short).Show(); } }
void IYouTubeThumbnailLoaderOnThumbnailLoadedListener.OnThumbnailLoaded(YouTubeThumbnailView thumbnail, string videoId) { nextThumbnailLoaded = true; if (activityResumed) { if (state == State.LoadingThumbnails) { FlipNext(); } else if (state == State.VideoFlippedOut) { // load player with the video of the next thumbnail being flipped in state = State.VideoLoading; player.CueVideo(videoId); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); state = State.Uninitialized; var viewFrame = new FrameLayout(this); var displayMetrics = Resources.DisplayMetrics; int maxAllowedNumberOfRows = (int)Math.Floor((displayMetrics.HeightPixels / displayMetrics.Density) / PlayerViewMinimumHeight); int numberOfRows = Math.Min(maxAllowedNumberOfRows, MaxRowCount); int interImagePaddingPx = (int)displayMetrics.Density * ImagePadding; int imageHeight = (displayMetrics.HeightPixels / numberOfRows) - interImagePaddingPx; int imageWidth = (int)(imageHeight * ThumbnailAspectRatio); imageWallView = new ImageWallView(this, imageWidth, imageHeight, interImagePaddingPx); viewFrame.AddView(imageWallView, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); thumbnailView = new YouTubeThumbnailView(this); thumbnailView.Initialize(DeveloperKey.Key, this); flippingView = new FlippingView(this, imageWidth, imageHeight); flippingView.Flipped += OnFlipped; flippingView.SetFlipDuration(InitialFlipDuration); viewFrame.AddView(flippingView, imageWidth, imageHeight); playerView = new FrameLayout(this); playerView.Id = Resource.Id.player_view; playerView.Visibility = ViewStates.Invisible; viewFrame.AddView(playerView, imageWidth, imageHeight); playerFragment = YouTubePlayerFragment.NewInstance(); playerFragment.Initialize(DeveloperKey.Key, this); FragmentManager.BeginTransaction().Add(Resource.Id.player_view, playerFragment).Commit(); flipDelayHandler = new Handler(msg => { FlipNext(); flipDelayHandler.SendEmptyMessageDelayed(0, FlipPeriod); }); SetContentView(viewFrame); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); state = State.UNINITIALIZED; ViewGroup viewFrame = new FrameLayout(this); DisplayMetrics displayMetrics = Resources.DisplayMetrics; int maxAllowedNumberOfRows = (int)Math.Floor( (displayMetrics.HeightPixels / displayMetrics.Density) / PLAYER_VIEW_MINIMUM_HEIGHT_DP); int numberOfRows = Math.Min(maxAllowedNumberOfRows, MAX_NUMBER_OF_ROWS_WANTED); int interImagePaddingPx = (int)displayMetrics.Density * INTER_IMAGE_PADDING_DP; int imageHeight = (displayMetrics.HeightPixels / numberOfRows) - interImagePaddingPx; int imageWidth = (int)(imageHeight * THUMBNAIL_ASPECT_RATIO); imageWallView = new ImageWallView(this, imageWidth, imageHeight, interImagePaddingPx); viewFrame.AddView(imageWallView, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); thumbnailView = new YouTubeThumbnailView(this); thumbnailView.Initialize(DeveloperKey.DEVELOPER_KEY, this); flippingView = new FlippingView(this, this, imageWidth, imageHeight); flippingView.SetFlipDuration(INITIAL_FLIP_DURATION_MILLIS); viewFrame.AddView(flippingView, imageWidth, imageHeight); playerView = new FrameLayout(this); playerView.Id = Resource.Id.player_view; playerView.Visibility = ViewStates.Invisible; viewFrame.AddView(playerView, imageWidth, imageHeight); playerFragment = YouTubePlayerFragment.NewInstance(); playerFragment.Initialize(DeveloperKey.DEVELOPER_KEY, this); FragmentManager.BeginTransaction().Add(Resource.Id.player_view, playerFragment).Commit(); flipDelayHandler = new FlipDelayHandler() { HandleMessageAction = (msg) => { FlipNext(); } }; SetContentView(viewFrame); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; VideoEntry entry = entries[position]; // There are three cases here if (view == null) { // 1) The view has not yet been created - we need to initialize the YouTubeThumbnailView. view = inflater.Inflate(Resource.Layout.video_list_item, parent, false); YouTubeThumbnailView thumbnail = (YouTubeThumbnailView)view.FindViewById(Resource.Id.thumbnail); thumbnail.Tag = (entry.videoId); thumbnail.Initialize(DeveloperKey.DEVELOPER_KEY, thumbnailListener); } else { YouTubeThumbnailView thumbnail = (YouTubeThumbnailView)view.FindViewById(Resource.Id.thumbnail); IYouTubeThumbnailLoader loader = thumbnailViewToLoaderMap[thumbnail]; if (loader == null) { // 2) The view is already created, and is currently being initialized. We store the // current videoId in the tag. thumbnail.Tag = (entry.videoId); } else { // 3) The view is already created and already initialized. Simply Set the right videoId // on the loader. thumbnail.SetImageResource(Resource.Drawable.loading_thumbnail); loader.SetVideo(entry.videoId); } } TextView label = ((TextView)view.FindViewById(Resource.Id.text)); label.Text = (entry.text); label.Visibility = (labelsVisible ? ViewStates.Visible : ViewStates.Gone); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(Resource.Layout.video_list_demo, null); // ToggleButton togglebutton = view.FindViewById<ToggleButton>(Resource.Id.FavoriteButton); videoBox = view.FindViewById(Resource.Id.video_box); closeButton = view.FindViewById(Resource.Id.close_button); videoBox.Visibility = ViewStates.Visible; //invisible text = view.FindViewById <TextView>(Resource.Id.titletext); thumbnail_channel = view.FindViewById <YouTubeThumbnailView>(Resource.Id.thumbnail_channel); thumbnail_channel.Initialize(DeveloperKey.Key, this); var adapter = new VideoListAdapter((IMvxAndroidBindingContext)this.BindingContext); MvxRecyclerView m = view.FindViewById <MvxRecyclerView>(Resource.Id.rvItems); m.Adapter = adapter; adapter.NotifyDataSetChanged(); adapter.ViewModel = ViewModel; adapter.mcon = Context; adapter.ToogleIcon = Resource.Drawable.button_favorite; var set1 = this.CreateBindingSet <PlayVideoFragment, PlayVideoViewModel>(); set1.Bind(adapter).For(x => x.ItemsSource).To(x => x.YoutubeItems); set1.Apply(); return(view); }
void IYouTubeThumbnailLoaderOnThumbnailLoadedListener.OnThumbnailLoaded(YouTubeThumbnailView thumbnail, string videoId) { }
void IYouTubeThumbnailLoaderOnThumbnailLoadedListener.OnThumbnailError(YouTubeThumbnailView view, YouTubeThumbnailLoaderErrorReason errorReason) { view.SetImageResource(Resource.Drawable.cart1);//no_thumbnail }
void YouTubeThumbnailView.IOnInitializedListener.OnInitializationFailure(YouTubeThumbnailView view, YouTubeInitializationResult result) { view.SetImageResource(Resource.Drawable.cart1);// no_thumbnail }
void YouTubeThumbnailView.IOnInitializedListener.OnInitializationSuccess(YouTubeThumbnailView view, IYouTubeThumbnailLoader loader) { this.thumbnailLoader = loader; thumbnailLoader.SetOnThumbnailLoadedListener(this); thumbnailLoader.SetPlaylist(PlaylistId); }
public void OnThumbnailLoaded(YouTubeThumbnailView p0, string p1) { }
public void OnThumbnailError(YouTubeThumbnailView view, YouTubeThumbnailLoaderErrorReason p1) { view.SetImageResource(Resource.Drawable.no_thumbnail); }
public void OnThumbnailLoaded(YouTubeThumbnailView thumbnail, string videoId) { ThumbnailLoaded?.Invoke(thumbnail, videoId); }
public void OnThumbnailError(YouTubeThumbnailView thumbnail, YouTubeThumbnailLoaderErrorReason reason) { ThumbnailError?.Invoke(thumbnail, reason); }
void YouTubeThumbnailView.IOnInitializedListener.OnInitializationSuccess(YouTubeThumbnailView thumbnailView, IYouTubeThumbnailLoader thumbnailLoader) { this.thumbnailLoader = thumbnailLoader; thumbnailLoader.SetOnThumbnailLoadedListener(this); MaybeStartDemo(); }
public void OnInitializationFailure(YouTubeThumbnailView view, YouTubeInitializationResult loader) { view.SetImageResource(Resource.Drawable.no_thumbnail); }
void IYouTubeThumbnailLoaderOnThumbnailLoadedListener.OnThumbnailError(YouTubeThumbnailView thumbnail, YouTubeThumbnailLoaderErrorReason reason) { LoadNextThumbnail(); }