Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ActivityIndicator implementation for iOS #2829
Added ActivityIndicator implementation for iOS #2829
Changes from 7 commits
eb93558
2469ecf
c5e7963
bf5869a
42d7fb5
791691b
7d98567
c2d0ebd
d2c6f07
fdca33b
e927828
48ace84
8cbd5f9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is there a reason that both the UIView and UIActivatorView is needed? Is it not possible to use UIActivityIndicatorView directly as the native widget? If it isn't, there should be a docstring here describing the reason; if it is... then that's an easy cleanup :-)
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.
For this one I had to wrap it in a parent UIView, because for some reason the UIActivityIndicatorView shows up even when stopped, regardless of whether I set the
hidesWhenStopped
property totrue
- I'll add it in the docstrings in case someone figures out what is wrong, but for now this was the only way I could think of that was relatively cleanThere 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.
@freakboy3742 I added some information about the issue in a comment here: 7d98567
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.
Ok - you successfully nerd sniped me here :-)
I've worked out what is going on.
hidesWhenStopped
is implemented as a wrapper around the literalsetHidden()
implementation - so stopping the spinner isn't just making the image disappear, it's literally hiding the widget.The catch: when Toga starts up, it applies styles to all widgets - and one of the styles it applies is visibility. So - when you don't have the wrapper, Toga creates the widget, sets
hiddenWhenStopped
, and then sets the widget to be visible... which means you can then see it.This doesn't happen when the widget is wrapped by the UIView because the hidden attribute of the container view is separate from the hidden attribute of the spinner itself.
So - the fix here is to override
set_hidden()
on the iOS ActivityIndicator so that it takes into account whether the spinner is running before applying visibility on the underlying widget.This might have an impact on the testbed test - the probe evaluating visibility might also need to be adjusted.
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.
Thanks for the explanation! I was too stuck at thinking that it may be an issue with the bridge calls that I didn't think to look at the base widget 😅 I'll investigate, will have a look at the potential testbed changes as well
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've just pushed the changes @freakboy3742 - it seems the testbed didn't require any changes because the activityindicator test does not check for the visibility when stopped. This will need updating, but if it's fine on your end I'd like to do that in a separate change as I might need to implement probes for the other platforms too (gtk and cocoa)
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'm happy for the test improvement to be a separate PR.