New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added autoplay control property to AnimatedImageView (autoPlayAnimatedImage) #3003
Conversation
@liulichao123 Sounds a interesting and useful feature. Can you add a test case for this as well ? To ensure it always work. You can check other's animated image testing code, check the |
Test cases have been added |
@liulichao123 Test case failed to compile on macOS. macOS AppKit use |
Codecov Report
@@ Coverage Diff @@
## master #3003 +/- ##
==========================================
+ Coverage 83.78% 83.95% +0.16%
==========================================
Files 69 69
Lines 7408 7534 +126
==========================================
+ Hits 6207 6325 +118
- Misses 1201 1209 +8
Continue to review full report at Codecov.
|
[self stopAnimating]; | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code actually don't need. Because SDAnimatedImageView provide the startAnimating
and stopAnimating
for macOS (not public API, implementation only)
The only thing not exist is the isAnimting
property.
You can actually check the code again...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to call [self stopAnimating] directly here without distinguishing between iOS and Mac?
However, if we do not call [self setAnimates: NO] in the Mac environment, the animates property will not change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, if we do not call [self setAnimates: NO] in the Mac environment, the animates property will not change.
Previous code does not call that. I just review the code based on changes diff.
@liulichao123 If you think this is a bug, maybe we can have a fix at the same time :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like:
- (void)startAnimating
{
if (self.player) {
[self updateShouldAnimate];
if (self.shouldAnimate) {
[self.player startPlaying];
}
} else {
#if SD_UIKIT
[super startAnimating];
#else
[super setAnimates:YES];
#endif
}
}
then just keep the exist [self startAnimating];
caller code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some tweaking, and I overwrote the - (BOOL)animates function
LGTM now. Thanks for your contribution @liulichao123 👍 |
New Pull Request Checklist
I have read and understood the CONTRIBUTING guide
I have read the Documentation
I have searched for a similar pull request in the project and found none
I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
I have added the required tests to prove the fix/feature I am adding
I have updated the documentation (if necessary)
I have run the tests and they pass
I have run the lint and it passes (
pod lib lint
)This merge request fixes / refers to the following issues: ...
Pull Request Description
Sometimes we set up a GIF and don't want it to play right away, so we need to add a control
Added autoplay control property to AnimatedImageView (autoPlayAnimatedImage)
(reference YYAnimatedImageView)