Replace iterable foreach loops with indexed for loops

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163193118
This commit is contained in:
eguven 2017-07-26 04:47:56 -07:00 committed by Oliver Woodman
parent b631755b63
commit 9936bc6702

View file

@ -436,13 +436,13 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
} }
if (!imaPlayingAd) { if (!imaPlayingAd) {
imaPlayingAd = true; imaPlayingAd = true;
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onPlay(); adCallbacks.get(i).onPlay();
} }
} else if (imaPausedInAd) { } else if (imaPausedInAd) {
imaPausedInAd = false; imaPausedInAd = false;
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onResume(); adCallbacks.get(i).onResume();
} }
} }
} }
@ -473,8 +473,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
return; return;
} }
imaPausedInAd = true; imaPausedInAd = true;
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onPause(); adCallbacks.get(i).onPause();
} }
} }
@ -519,8 +519,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
} else if (imaPlayingAd && playbackState == Player.STATE_ENDED) { } else if (imaPlayingAd && playbackState == Player.STATE_ENDED) {
// IMA is waiting for the ad playback to finish so invoke the callback now. // IMA is waiting for the ad playback to finish so invoke the callback now.
// Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again. // Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again.
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onEnded(); adCallbacks.get(i).onEnded();
} }
} }
} }
@ -533,8 +533,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
@Override @Override
public void onPlayerError(ExoPlaybackException error) { public void onPlayerError(ExoPlaybackException error) {
if (playingAd) { if (playingAd) {
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onError(); adCallbacks.get(i).onError();
} }
} }
} }
@ -584,8 +584,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
if (adFinished) { if (adFinished) {
// IMA is waiting for the ad playback to finish so invoke the callback now. // IMA is waiting for the ad playback to finish so invoke the callback now.
// Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again. // Either CONTENT_RESUME_REQUESTED will be passed next, or playAd will be called again.
for (VideoAdPlayerCallback callback : adCallbacks) { for (int i = 0; i < adCallbacks.size(); i++) {
callback.onEnded(); adCallbacks.get(i).onEnded();
} }
} }
if (!wasPlayingAd && playingAd) { if (!wasPlayingAd && playingAd) {