@@ -131,44 +131,39 @@ public void onAdEvent(AdEvent adEvent) {
131131 // These are the suggested event types to handle. For full list of
132132 // all ad event types, see AdEvent.AdEventType documentation.
133133 switch (adEvent .getType ()) {
134- case LOADED :
135- // AdEventType.LOADED is fired when ads are ready to play.
136-
137- // This sample app uses the sample tag
138- // single_preroll_skippable_ad_tag_url that requires calling
139- // AdsManager.start() to start ad playback.
140- // If you use a different ad tag URL that returns a VMAP or
141- // an ad rules playlist, the adsManager.init() function will
142- // trigger ad playback automatically and the IMA SDK will
143- // ignore the adsManager.start().
144- // It is safe to always call adsManager.start() in the
145- // LOADED event.
146- adsManager .start ();
147- break ;
148- case CONTENT_PAUSE_REQUESTED :
149- // AdEventType.CONTENT_PAUSE_REQUESTED is fired when you
150- // should pause your content and start playing an ad.
151- pauseContentForAds ();
152- break ;
153- case CONTENT_RESUME_REQUESTED :
154- // AdEventType.CONTENT_RESUME_REQUESTED is fired when the ad
155- // you should play your content.
156- resumeContent ();
157- break ;
158- case ALL_ADS_COMPLETED :
134+ case LOADED ->
135+ // AdEventType.LOADED is fired when ads are ready to play.
136+ // This sample app uses the sample tag
137+ // single_preroll_skippable_ad_tag_url that requires calling
138+ // AdsManager.start() to start ad playback.
139+ // If you use a different ad tag URL that returns a VMAP or
140+ // an ad rules playlist, the adsManager.init() function will
141+ // trigger ad playback automatically and the IMA SDK will
142+ // ignore the adsManager.start().
143+ // It is safe to always call adsManager.start() in the
144+ // LOADED event.
145+ adsManager .start ();
146+ case CONTENT_PAUSE_REQUESTED ->
147+ // AdEventType.CONTENT_PAUSE_REQUESTED is fired when you
148+ // should pause your content and start playing an ad.
149+ pauseContentForAds ();
150+ case CONTENT_RESUME_REQUESTED ->
151+ // AdEventType.CONTENT_RESUME_REQUESTED is fired when the ad
152+ // you should play your content.
153+ resumeContent ();
154+ case ALL_ADS_COMPLETED -> {
159155 // Calling adsManager.destroy() triggers the function
160156 // VideoAdPlayer.release().
161157 adsManager .destroy ();
162158 adsManager = null ;
163- break ;
164- case CLICKED :
159+ }
160+ case CLICKED -> {
165161 // When the user clicks on the Learn More button, the IMA SDK fires
166162 // this event, pauses the ad, and opens the ad's click-through URL.
167163 // When the user returns to the app, the IMA SDK calls the
168164 // VideoAdPlayer.playAd() function automatically.
169- break ;
170- default :
171- break ;
165+ }
166+ default -> {}
172167 }
173168 }
174169 });
0 commit comments