Skip to content

Commit

Permalink
Fix bitmap re-use bug cross fading from thumb.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjudd committed Mar 4, 2015
1 parent 93a7613 commit a9f80ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -295,6 +295,13 @@ public void testDoesNotClearThumbOnThumbRequestComplete() {
verify(thumb, never()).clear();
}

@Test
public void testDoesNotClearThumbOnFullComplete_whenThumbIsComplete() {
when(thumb.isComplete()).thenReturn(true);
coordinator.onRequestSuccess(full);
verify(thumb, never()).clear();
}

@Test
public void testDoesNotNotifyParentOnThumbRequestComplete() {
coordinator = new ThumbnailRequestCoordinator(parent);
Expand Down
Expand Up @@ -66,7 +66,12 @@ public void onRequestSuccess(Request request) {
if (coordinator != null) {
coordinator.onRequestSuccess(this);
}
thumb.clear();
// Clearing the thumb is not necessarily safe if the thumb is being displayed in the Target,
// as a layer in a cross fade for example. The only way we know the thumb is not being
// displayed and is therefore safe to clear is if the thumb request has not yet completed.
if (!thumb.isComplete()) {
thumb.clear();
}
}

private boolean parentIsAnyResourceSet() {
Expand Down

0 comments on commit a9f80ea

Please sign in to comment.