@VisibleForTesting
void onFrameReady(DelayTarget delayTarget) {
if (onEveryFrameListener != null) {
onEveryFrameListener.onFrameReady();
}
isLoadPending = false;
if (isCleared) {
handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, delayTarget).sendToTarget();
return;
}
// If we're not running, notifying here will recycle the frame that we might currently be
// showing, which breaks things (see #2526). We also can't discard this frame because we've
// already incremented the frame pointer and can't decode the same frame again. Instead we'll
// just hang on to this next frame until start() or clear() are called.
if (!isRunning) {
pendingTarget = delayTarget;
return;
}
if (delayTarget.getResource() != null) {
recycleFirstFrame();
DelayTarget previous = current;
current = delayTarget;
// The callbacks may unregister when onFrameReady is called, so iterate in reverse to avoid
// concurrent modifications.
for (int i = callbacks.size() - 1; i >= 0; i--) {
FrameCallback cb = callbacks.get(i);
cb.onFrameReady();
}
if (previous != null) {
handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, previous).sendToTarget();
}
}
loadNextFrame();
}
GifFrameLoader.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录