Restyle UIComputerView to match other clients

This commit is contained in:
Cameron Gutman
2019-08-30 18:36:14 -07:00
parent 83479719a4
commit a065c78b5f
18 changed files with 386 additions and 92 deletions
@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "limelight_computer_add_icon_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "limelight_computer_add_icon_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "limelight_computer_add_icon_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

@@ -2,18 +2,16 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "limelight_computer_1x.png"
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "limelight_computer_2x.png"
"filename" : "add.pdf",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "limelight_computer_3x.png"
"scale" : "3x"
}
],
"info" : {
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "error.pdf",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,68 @@
%PDF-1.5
%µí®û
4 0 obj
<< /Length 5 0 R
/Filter /FlateDecode
>>
stream
xœeŒÑ Ã0 Dÿ5Å-Uªì(kt„Rhò¤Ýª8µ t︓Bbå¯B)öù̸=ó—Œõž1fã¸òäW˜sW½P’jçjXbó†kG Ý’rî%c?õì=ÓãÍ?ÜðÒ~Óƒ~®L+·
endstream
endobj
5 0 obj
115
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:20190830180932-07'00)
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000517 00000 n
0000000301 00000 n
0000000229 00000 n
0000000015 00000 n
0000000207 00000 n
0000000582 00000 n
0000000698 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
750
%%EOF
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "lock.pdf",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,68 @@
%PDF-1.5
%µí®û
4 0 obj
<< /Length 5 0 R
/Filter /FlateDecode
>>
stream
xœUQKnÅ Üû¾@]ÌÇðŽñŽP!õu‘,ÚÞ_*ø¥"‚ÐÌØcZë×Öξq¯Ÿ¾$|ýBÊ
×wb+ĆÀ<¨ßiÒ£ŠvW:9œ˜O™•¸*˜ZΠšfwΰ çåœ;
Ά ïZ§ÙÛá¸Ñ£ ×¢¨›y‚xœõ)Ñσd §r³ËzÚa™Ç2ºUãòõpè(|T'JIrpóiI+4²Æ8´6§…êªÀd€5‘ÄxÏ
v•Η¢_:'áiÔò tíöËïºk'¶vÎèP{ŽÙûЂ®¼$X2q|h“ê†Wv¦Q«?¹¹«‚ù_ùŸý Oøp…&
endstream
endobj
5 0 obj
267
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:20190830180930-07'00)
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000669 00000 n
0000000453 00000 n
0000000381 00000 n
0000000015 00000 n
0000000359 00000 n
0000000734 00000 n
0000000850 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "updating.pdf",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,68 @@
%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
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "computer.pdf",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,69 @@
%PDF-1.5
%µí®û
4 0 obj
<< /Length 5 0 R
/Filter /FlateDecode
>>
stream
xœ]‘]! „ß{Š^ÀÊ”Àâ1<‚Ùøó êý …E
»ÛN‡Yp°µƒmª‰×=)´³×•÷§À×7iØ·¸Hbä"= ¯3_\W«F­Æ!K©%­ðÁ½ÛñÎX¤@;$Ú®‹ ”mÊê@Œ¬Ç¿ ‰µµ+¸“!ïd±ùË}œ#¡TÙ;7_Û«†,ÚLÙ˜MHS~»ì8Ðà—î$ëô¾±ÍX™F—ØÙ´<òŸ\W¾Í¤MlæÜûþeÓeÇÿÎ é¦Lg7
endstream
endobj
5 0 obj
212
endobj
3 0 obj
<<
/ExtGState <<
/a0 << /CA 0.3 /ca 0.3 >>
/a1 << /CA 1 /ca 1 >>
>>
>>
endobj
2 0 obj
<< /Type /Page % 1
/Parent 1 0 R
/MediaBox [ 0 0 225 225 ]
/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:20190830180928-07'00)
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000648 00000 n
0000000430 00000 n
0000000326 00000 n
0000000015 00000 n
0000000304 00000 n
0000000713 00000 n
0000000829 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
881
+25 -63
View File
@@ -12,8 +12,7 @@
TemporaryHost* _host;
UIButton* _hostButton;
UILabel* _hostLabel;
UILabel* _hostStatus;
UILabel* _hostPairState;
UIImageView* _hostOverlay;
id<HostCallback> _callback;
CGSize _labelSize;
}
@@ -32,14 +31,21 @@ static const int LABEL_DY = 20;
[_hostButton setBackgroundImage:[UIImage imageNamed:@"Computer"] forState:UIControlStateNormal];
[_hostButton sizeToFit];
_hostButton.layer.shadowColor = [[UIColor blackColor] CGColor];
_hostButton.layer.shadowColor = [[UIColor blackColor] CGColor];
_hostButton.layer.shadowOffset = CGSizeMake(5,8);
_hostButton.layer.shadowOpacity = 0.7;
_hostLabel = [[UILabel alloc] init];
_hostStatus = [[UILabel alloc] init];
_hostPairState = [[UILabel alloc] init];
#if !TARGET_OS_TV
_hostLabel.textColor = [UIColor whiteColor];
#endif
_hostOverlay = [[UIImageView alloc] initWithFrame:CGRectMake(_hostButton.frame.size.width / 4, _hostButton.frame.size.height / 6, _hostButton.frame.size.width / 2, _hostButton.frame.size.height / 2)];
[self addSubview:_hostButton];
[self addSubview:_hostLabel];
[self addSubview:_hostOverlay];
return self;
}
@@ -47,38 +53,23 @@ static const int LABEL_DY = 20;
self = [self init];
_callback = callback;
[_hostButton setBackgroundImage:[UIImage imageNamed:@"Computer"] forState:UIControlStateNormal];
[_hostButton setContentEdgeInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
if (@available(iOS 9.0, tvOS 9.0, *)) {
[_hostButton addTarget:self action:@selector(addClicked) forControlEvents:UIControlEventPrimaryActionTriggered];
}
else {
[_hostButton addTarget:self action:@selector(addClicked) forControlEvents:UIControlEventTouchUpInside];
}
[_hostButton sizeToFit];
[_hostLabel setText:@"Add Host"];
[_hostLabel sizeToFit];
#if !TARGET_OS_TV
_hostLabel.textColor = [UIColor whiteColor];
#endif
_hostLabel.center = CGPointMake(_hostButton.frame.origin.x + (_hostButton.frame.size.width / 2), _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY);
UIImageView* addIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AddComputerIcon"]];
[addIcon sizeToFit];
addIcon.center = CGPointMake(_hostButton.frame.origin.x + _hostButton.frame.size.width, _hostButton.frame.origin.y);
float x = _hostButton.frame.origin.x + _hostButton.frame.size.width / 2;
_hostLabel.center = CGPointMake(x, _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY);
// This is required to ensure this button is the same size as the others
_hostPairState.text = @"None";
_hostStatus.text = @"None";
[_hostPairState sizeToFit];
[_hostStatus sizeToFit];
[_hostOverlay setImage:[UIImage imageNamed:@"AddOverlayIcon"]];
[self updateBounds];
[self addSubview:_hostButton];
[self addSubview:_hostLabel];
[self addSubview:addIcon];
return self;
}
@@ -99,10 +90,6 @@ static const int LABEL_DY = 20;
[self updateContentsForHost:host];
[self updateBounds];
[self addSubview:_hostButton];
[self addSubview:_hostLabel];
[self addSubview:_hostStatus];
[self addSubview:_hostPairState];
[self startUpdateLoop];
return self;
@@ -116,23 +103,15 @@ static const int LABEL_DY = 20;
x = MIN(x, _hostButton.frame.origin.x);
x = MIN(x, _hostLabel.frame.origin.x);
x = MIN(x, _hostStatus.frame.origin.x);
x = MIN(x, _hostPairState.frame.origin.x);
y = MIN(y, _hostButton.frame.origin.y);
y = MIN(y, _hostLabel.frame.origin.y);
y = MIN(y, _hostStatus.frame.origin.y);
y = MIN(y, _hostPairState.frame.origin.y);
width = MAX(width, _hostButton.frame.size.width);
width = MAX(width, _hostLabel.frame.size.width);
width = MAX(width, _hostStatus.frame.size.width);
width = MAX(width, _hostPairState.frame.size.width);
height = _hostButton.frame.size.height +
_hostLabel.frame.size.height +
_hostStatus.frame.size.height +
_hostPairState.frame.size.height +
LABEL_DY / 2;
self.bounds = CGRectMake(x, y, width, height);
@@ -141,40 +120,23 @@ static const int LABEL_DY = 20;
- (void) updateContentsForHost:(TemporaryHost*)host {
_hostLabel.text = _host.name;
#if !TARGET_OS_TV
_hostLabel.textColor = [UIColor whiteColor];
#endif
[_hostLabel sizeToFit];
switch (host.pairState) {
case PairStateUnknown:
_hostPairState.text = @"Pair State Unknown";
break;
case PairStateUnpaired:
_hostPairState.text = @"Not Paired";
break;
case PairStatePaired:
_hostPairState.text = @"Paired";
break;
}
#if !TARGET_OS_TV
_hostPairState.textColor = [UIColor whiteColor];
#endif
[_hostPairState sizeToFit];
if (host.online) {
_hostStatus.text = @"Online";
_hostStatus.textColor = [UIColor greenColor];
} else {
_hostStatus.text = @"Offline";
_hostStatus.textColor = [UIColor grayColor];
if (host.pairState == PairStateUnpaired) {
[_hostOverlay setImage:[UIImage imageNamed:@"LockedOverlayIcon"]];
}
else {
[_hostOverlay setImage:nil];
}
}
else {
// TODO: Use updating icon if we've not determined online state yet
[_hostOverlay setImage:[UIImage imageNamed:@"ErrorOverlayIcon"]];
}
[_hostStatus sizeToFit];
float x = _hostButton.frame.origin.x + _hostButton.frame.size.width / 2;
_hostLabel.center = CGPointMake(x, _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY);
_hostPairState.center = CGPointMake(x, _hostLabel.center.y + LABEL_DY);
_hostStatus.center = CGPointMake(x, _hostPairState.center.y + LABEL_DY);
}
- (void) startUpdateLoop {