Skip to content

Commit

Permalink
Added onImageRequestFailed callback
Browse files Browse the repository at this point in the history
  • Loading branch information
DHuckaby committed Jul 10, 2013
1 parent 9b68ff5 commit 8457c86
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions library/src/com/handlerexploit/prime/utils/ImageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private void get(final ExtendedRequest request) {
} else {
synchronized (mBadUrlCache) {
if (mBadUrlCache.get(key) != null) {
request.onImageRequestFailed(source);
return;
}
}
Expand Down Expand Up @@ -267,15 +268,32 @@ public void run() {
} else {
synchronized (mBadUrlCache) {
mBadUrlCache.put(key, new Object());
mHandler.post(new Runnable() {

@Override
public void run() {
request.onImageRequestFailed(source);
}
});
}
}
}
});
}
} else {
mHandler.post(new Runnable() {

@Override
public void run() {
request.onImageRequestFailed(source);
}
});
}
}
});
}
} else {
request.onImageRequestFailed(source);
}
}

Expand Down Expand Up @@ -568,6 +586,11 @@ public static interface ExtendedRequest extends Request {
*
*/
public boolean shouldCacheInMemory(int byteSize);

/**
*
*/
public void onImageRequestFailed(String source);
}

private static class SimpleRequest implements ExtendedRequest {
Expand Down Expand Up @@ -612,5 +635,10 @@ public Config getPreferredConfig() {
public boolean shouldCacheInMemory(int byteSize) {
return true;
}

@Override
public void onImageRequestFailed(String source) {
// Ignore
}
}
}

0 comments on commit 8457c86

Please sign in to comment.