diff --git a/Limelight/Images.xcassets/AddComputerIcon.imageset/Contents.json b/Limelight/Images.xcassets/AddComputerIcon.imageset/Contents.json deleted file mode 100644 index 159ec2c..0000000 --- a/Limelight/Images.xcassets/AddComputerIcon.imageset/Contents.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_1x.png b/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_1x.png deleted file mode 100644 index 1c3d2db..0000000 Binary files a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_1x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_2x.png b/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_2x.png deleted file mode 100644 index 661eddd..0000000 Binary files a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_2x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_3x.png b/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_3x.png deleted file mode 100644 index 9323db1..0000000 Binary files a/Limelight/Images.xcassets/AddComputerIcon.imageset/limelight_computer_add_icon_3x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/Computer.imageset/Contents.json b/Limelight/Images.xcassets/AddOverlayIcon.imageset/Contents.json similarity index 50% rename from Limelight/Images.xcassets/Computer.imageset/Contents.json rename to Limelight/Images.xcassets/AddOverlayIcon.imageset/Contents.json index 3a06eed..def80db 100644 --- a/Limelight/Images.xcassets/Computer.imageset/Contents.json +++ b/Limelight/Images.xcassets/AddOverlayIcon.imageset/Contents.json @@ -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" : { diff --git a/Limelight/Images.xcassets/AddOverlayIcon.imageset/add.pdf b/Limelight/Images.xcassets/AddOverlayIcon.imageset/add.pdf new file mode 100644 index 0000000..cbc7615 Binary files /dev/null and b/Limelight/Images.xcassets/AddOverlayIcon.imageset/add.pdf differ diff --git a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_1x.png b/Limelight/Images.xcassets/Computer.imageset/limelight_computer_1x.png deleted file mode 100644 index 7c2e71f..0000000 Binary files a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_1x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_2x.png b/Limelight/Images.xcassets/Computer.imageset/limelight_computer_2x.png deleted file mode 100644 index 25468de..0000000 Binary files a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_2x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_3x.png b/Limelight/Images.xcassets/Computer.imageset/limelight_computer_3x.png deleted file mode 100644 index e93d417..0000000 Binary files a/Limelight/Images.xcassets/Computer.imageset/limelight_computer_3x.png and /dev/null differ diff --git a/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/Contents.json b/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/Contents.json new file mode 100644 index 0000000..82b46eb --- /dev/null +++ b/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/error.pdf b/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/error.pdf new file mode 100644 index 0000000..2b37291 --- /dev/null +++ b/Limelight/Images.xcassets/ErrorOverlayIcon.imageset/error.pdf @@ -0,0 +1,68 @@ +%PDF-1.5 +% +4 0 obj +<< /Length 5 0 R + /Filter /FlateDecode +>> +stream +xe 0 D5-U(ktRh8 t︓BbB)̸=1fWsWPjjXbkG ݒ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 diff --git a/Limelight/Images.xcassets/LockedOverlayIcon.imageset/Contents.json b/Limelight/Images.xcassets/LockedOverlayIcon.imageset/Contents.json new file mode 100644 index 0000000..d374f9c --- /dev/null +++ b/Limelight/Images.xcassets/LockedOverlayIcon.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/Limelight/Images.xcassets/LockedOverlayIcon.imageset/lock.pdf b/Limelight/Images.xcassets/LockedOverlayIcon.imageset/lock.pdf new file mode 100644 index 0000000..7c4848a --- /dev/null +++ b/Limelight/Images.xcassets/LockedOverlayIcon.imageset/lock.pdf @@ -0,0 +1,68 @@ +%PDF-1.5 +% +4 0 obj +<< /Length 5 0 R + /Filter /FlateDecode +>> +stream +xUQKn @]P!u,_*"cZq$|B wb+Ć> + >> +>> +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 +>> +startxref +902 +%%EOF diff --git a/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/Contents.json b/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/Contents.json new file mode 100644 index 0000000..ba046c1 --- /dev/null +++ b/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/updating.pdf b/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/updating.pdf new file mode 100644 index 0000000..549477a --- /dev/null +++ b/Limelight/Images.xcassets/UpdatingOverlayIcon.imageset/updating.pdf @@ -0,0 +1,68 @@ +%PDF-1.5 +% +4 0 obj +<< /Length 5 0 R + /Filter /FlateDecode +>> +stream +xmQm1i `eR.G`|"K0^f{Jox}ϸ$T<.JFMpRyRiM)WJQ` N¨<"d]Qݭ dY(5:wLݱlVw)Xf'ed> + >> +>> +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 +%%EOF diff --git a/Limelight/Images.xcassets/computer.imageset/Contents.json b/Limelight/Images.xcassets/computer.imageset/Contents.json new file mode 100644 index 0000000..81d660d --- /dev/null +++ b/Limelight/Images.xcassets/computer.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/Limelight/Images.xcassets/computer.imageset/computer.pdf b/Limelight/Images.xcassets/computer.imageset/computer.pdf new file mode 100644 index 0000000..be00acf --- /dev/null +++ b/Limelight/Images.xcassets/computer.imageset/computer.pdf @@ -0,0 +1,69 @@ +%PDF-1.5 +% +4 0 obj +<< /Length 5 0 R + /Filter /FlateDecode +>> +stream +x]]! {^ʔ1< E NYpm=)ו7iطHb"=3_\WF!K%X@;$ڮm@ǿ +!d}#T;7_۫,L٘EMHS~8$XFٴ<\WͤMlee 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 +%%EOF diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index dea2e51..6bf33e4 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -12,8 +12,7 @@ TemporaryHost* _host; UIButton* _hostButton; UILabel* _hostLabel; - UILabel* _hostStatus; - UILabel* _hostPairState; + UIImageView* _hostOverlay; id _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 {