mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add retryCount parameter to make it clear onLoadStarted is called for retries too
This commit is contained in:
parent
33d9b78e21
commit
af5df6e700
1 changed files with 5 additions and 2 deletions
|
|
@ -97,8 +97,11 @@ public final class Loader implements LoaderErrorThrower {
|
||||||
* @param elapsedRealtimeMs {@link SystemClock#elapsedRealtime} when the load attempts to start.
|
* @param elapsedRealtimeMs {@link SystemClock#elapsedRealtime} when the load attempts to start.
|
||||||
* @param loadDurationMs The duration in milliseconds of the load since {@link #startLoading}
|
* @param loadDurationMs The duration in milliseconds of the load since {@link #startLoading}
|
||||||
* was called.
|
* was called.
|
||||||
|
* @param retryCount The number of failed attempts since {@link #startLoading} was called (this
|
||||||
|
* is zero for the first load attempt).
|
||||||
*/
|
*/
|
||||||
default void onLoadStarted(T loadable, long elapsedRealtimeMs, long loadDurationMs) {}
|
default void onLoadStarted(
|
||||||
|
T loadable, long elapsedRealtimeMs, long loadDurationMs, int retryCount) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a load has completed.
|
* Called when a load has completed.
|
||||||
|
|
@ -543,7 +546,7 @@ public final class Loader implements LoaderErrorThrower {
|
||||||
private void execute() {
|
private void execute() {
|
||||||
long nowMs = SystemClock.elapsedRealtime();
|
long nowMs = SystemClock.elapsedRealtime();
|
||||||
long durationMs = nowMs - startTimeMs;
|
long durationMs = nowMs - startTimeMs;
|
||||||
Assertions.checkNotNull(this.callback).onLoadStarted(loadable, nowMs, durationMs);
|
Assertions.checkNotNull(this.callback).onLoadStarted(loadable, nowMs, durationMs, errorCount);
|
||||||
currentError = null;
|
currentError = null;
|
||||||
downloadExecutor.execute(Assertions.checkNotNull(currentTask));
|
downloadExecutor.execute(Assertions.checkNotNull(currentTask));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue