Replace updating overlay icon with spinner

This commit is contained in:
Cameron Gutman
2019-08-31 16:02:37 -07:00
parent f6153fe818
commit 9a4cdc9c94
3 changed files with 9 additions and 90 deletions
@@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "updating.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -1,68 +0,0 @@
%PDF-1.5
%µí®û
4 0 obj
<< /Length 5 0 R
/Filter /FlateDecode
>>
stream
xœmQÁm1ü»Ši Ä`ðÚe¤„ÈR.ÛG’þ¥`|»·Š"KÀ0ÌÈþ^ØÍf{úJŒù¾ox}ϸý$ëTœÃ­Ô<.î°JòèFMõp—‚ŠRyR¼€‘ÖiäÍM)WñJQâÖ`ªÌ Nç¨<ù„"d]QÝ­
˜÷dY(Ì5Ÿ:’wþL£ƒÝ±€lÄVw)Xá€fª'£eîd¾¤†<ÉÔK;ej¾×8å}ÒÝs ^…4{£sÁÍ[‰7õ æšxH)ÄÏO`[Y^ç:˜4~¤·ô ªHby
endstream
endobj
5 0 obj
236
endobj
3 0 obj
<<
/ExtGState <<
/a0 << /CA 1 /ca 1 >>
>>
>>
endobj
2 0 obj
<< /Type /Page % 1
/Parent 1 0 R
/MediaBox [ 0 0 75 75 ]
/Contents 4 0 R
/Group <<
/Type /Group
/S /Transparency
/I true
/CS /DeviceRGB
>>
/Resources 3 0 R
>>
endobj
1 0 obj
<< /Type /Pages
/Kids [ 2 0 R ]
/Count 1
>>
endobj
6 0 obj
<< /Producer (cairo 1.16.0 (https://cairographics.org))
/CreationDate (D:20190830182029-07'00)
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000638 00000 n
0000000422 00000 n
0000000350 00000 n
0000000015 00000 n
0000000328 00000 n
0000000703 00000 n
0000000819 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
871
+9 -1
View File
@@ -13,6 +13,7 @@
UIButton* _hostButton; UIButton* _hostButton;
UILabel* _hostLabel; UILabel* _hostLabel;
UIImageView* _hostOverlay; UIImageView* _hostOverlay;
UIActivityIndicatorView* _hostSpinner;
id<HostCallback> _callback; id<HostCallback> _callback;
CGSize _labelSize; CGSize _labelSize;
} }
@@ -51,10 +52,14 @@ static const int LABEL_DY = 20;
_hostLabel.textColor = [UIColor whiteColor]; _hostLabel.textColor = [UIColor whiteColor];
_hostOverlay = [[UIImageView alloc] initWithFrame:CGRectMake(_hostButton.frame.size.width / 3, _hostButton.frame.size.height / 4, _hostButton.frame.size.width / 3, _hostButton.frame.size.height / 3)]; _hostOverlay = [[UIImageView alloc] initWithFrame:CGRectMake(_hostButton.frame.size.width / 3, _hostButton.frame.size.height / 4, _hostButton.frame.size.width / 3, _hostButton.frame.size.height / 3)];
_hostSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[_hostSpinner setFrame:_hostOverlay.frame];
_hostSpinner.hidesWhenStopped = YES;
[self addSubview:_hostButton]; [self addSubview:_hostButton];
[self addSubview:_hostLabel]; [self addSubview:_hostLabel];
[self addSubview:_hostOverlay]; [self addSubview:_hostOverlay];
[self addSubview:_hostSpinner];
return self; return self;
} }
@@ -132,6 +137,8 @@ static const int LABEL_DY = 20;
[_hostLabel sizeToFit]; [_hostLabel sizeToFit];
if (host.state == StateOnline) { if (host.state == StateOnline) {
[_hostSpinner stopAnimating];
if (host.pairState == PairStateUnpaired) { if (host.pairState == PairStateUnpaired) {
[_hostOverlay setImage:[UIImage imageNamed:@"LockedOverlayIcon"]]; [_hostOverlay setImage:[UIImage imageNamed:@"LockedOverlayIcon"]];
} }
@@ -140,10 +147,11 @@ static const int LABEL_DY = 20;
} }
} }
else if (host.state == StateOffline) { else if (host.state == StateOffline) {
[_hostSpinner stopAnimating];
[_hostOverlay setImage:[UIImage imageNamed:@"ErrorOverlayIcon"]]; [_hostOverlay setImage:[UIImage imageNamed:@"ErrorOverlayIcon"]];
} }
else { else {
[_hostOverlay setImage:[UIImage imageNamed:@"UpdatingOverlayIcon"]]; [_hostSpinner startAnimating];
} }
float x = _hostButton.frame.origin.x + _hostButton.frame.size.width / 2; float x = _hostButton.frame.origin.x + _hostButton.frame.size.width / 2;