提交 a9d87fb5 编写于 作者: S Sam Judd

Default to visible in GifDrawable.

Fixes #130.
上级 e9105644
......@@ -68,6 +68,21 @@ public class GifDrawableTest {
verify(frameManager).getNextFrame(eq(drawable));
}
@Test
public void testRequestsNextFrameOnStartWithoutCallToSetVisible() {
drawable.start();
verify(frameManager).getNextFrame(eq(drawable));
}
@Test
public void testDoesNotRequestNextFrameOnStartIfGotCallToSetVisibleWithVisibleFalse() {
drawable.setVisible(false, false);
drawable.start();
verify(frameManager, never()).getNextFrame(eq(drawable));
}
@Test
public void testShouldInvalidateSelfOnRun() {
drawable.setVisible(true, true);
......
......@@ -33,8 +33,12 @@ public class GifDrawable extends GlideDrawable implements GifFrameManager.FrameC
private boolean isStarted;
/** True if the drawable's resources have been recycled. */
private boolean isRecycled;
/** True if the drawable is currently visible. */
private boolean isVisible;
/**
* True if the drawable is currently visible. Default to true because on certain platforms (at least 4.1.1),
* setVisible is not called on {@link android.graphics.drawable.Drawable Drawables} during
* {@link android.widget.ImageView#setImageDrawable(android.graphics.drawable.Drawable)}. See issue #130.
*/
private boolean isVisible = true;
/** The number of times we've looped over all the frames in the gif. */
private int loopCount;
/** The number of times to loop through the gif animation. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册