-
-
Notifications
You must be signed in to change notification settings - Fork 689
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2829 from maranas/activityindicator-ios
Added ActivityIndicator implementation for iOS
- Loading branch information
Showing
10 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The ActivityIndicator widget is now supported on iOS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from rubicon.objc import CGSize | ||
|
||
from toga_iOS.libs import UIActivityIndicatorView | ||
from toga_iOS.widgets.base import Widget | ||
|
||
|
||
class ActivityIndicator(Widget): | ||
def create(self): | ||
self.native = UIActivityIndicatorView.new() | ||
self.native.hidesWhenStopped = True | ||
self.native.translatesAutoresizingMaskIntoConstraints = False | ||
self.native.sizeToFit() | ||
|
||
self.add_constraints() | ||
|
||
def set_hidden(self, hidden): | ||
self.native.setHidden((not self.is_running()) or hidden) | ||
|
||
def is_running(self): | ||
return self.native.isAnimating() | ||
|
||
def start(self): | ||
self.native.startAnimating() | ||
|
||
def stop(self): | ||
self.native.stopAnimating() | ||
|
||
def rehint(self): | ||
fitting_size = self.native.systemLayoutSizeFittingSize(CGSize(0, 0)) | ||
self.interface.intrinsic.width = fitting_size.width | ||
self.interface.intrinsic.height = fitting_size.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from toga_iOS.libs import UIActivityIndicatorView | ||
|
||
from .base import SimpleProbe | ||
|
||
|
||
class ActivityIndicatorProbe(SimpleProbe): | ||
native_class = UIActivityIndicatorView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters