Commit 9936bc67 by eguven Committed by Oliver Woodman

Replace iterable foreach loops with indexed for loops

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163193118
parent b631755b
......@@ -436,13 +436,13 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
}
if (!imaPlayingAd) {
imaPlayingAd = true;
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onPlay();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onPlay();
}
} else if (imaPausedInAd) {
imaPausedInAd = false;
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onResume();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onResume();
}
}
}
......@@ -473,8 +473,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
return;
}
imaPausedInAd = true;
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onPause();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onPause();
}
}
......@@ -519,8 +519,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
} else if (imaPlayingAd && playbackState == Player.STATE_ENDED) {
// 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.
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onEnded();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onEnded();
}
}
}
......@@ -533,8 +533,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
@Override
public void onPlayerError(ExoPlaybackException error) {
if (playingAd) {
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onError();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onError();
}
}
}
......@@ -584,8 +584,8 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
if (adFinished) {
// 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.
for (VideoAdPlayerCallback callback : adCallbacks) {
callback.onEnded();
for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onEnded();
}
}
if (!wasPlayingAd && playingAd) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment