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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) {
......
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