From f6153fe818b4a1340af44b9f8010956cf00507e0 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 30 Aug 2019 22:33:32 -0700 Subject: [PATCH] Improve selection visibility on tvOS --- Limelight/UIComputerView.m | 9 +++++---- Limelight/ViewControllers/MainFrameViewController.m | 12 ++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index 75589c2..49666c2 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -19,8 +19,10 @@ static const float REFRESH_CYCLE = 2.0f; #if TARGET_OS_TV +static const int ITEM_PADDING = 50; static const int LABEL_DY = 40; #else +static const int ITEM_PADDING = 0; static const int LABEL_DY = 20; #endif @@ -122,8 +124,7 @@ static const int LABEL_DY = 20; _hostLabel.frame.size.height + LABEL_DY / 2; - self.bounds = CGRectMake(x, y, width, height); - self.frame = CGRectMake(x, y, width, height); + self.bounds = CGRectMake(x - ITEM_PADDING, y - ITEM_PADDING, width + 2 * ITEM_PADDING, height + 2 * ITEM_PADDING); } - (void) updateContentsForHost:(TemporaryHost*)host { @@ -181,8 +182,8 @@ static const int LABEL_DY = 20; UIButton *previousButton = (UIButton *)context.previouslyFocusedItem; UIButton *nextButton = (UIButton *) context.nextFocusedItem; - previousButton.layer.shadowColor = [[UIColor blackColor] CGColor]; - nextButton.layer.shadowColor = [[UIColor greenColor] CGColor]; + previousButton.superview.backgroundColor = nil; + nextButton.superview.backgroundColor = [UIColor darkGrayColor]; } #endif diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 623a0c0..f9433d3 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -909,10 +909,18 @@ static NSMutableSet* hostList; } - (float) getCompViewX:(UIComputerView*)comp addComp:(UIComputerView*)addComp prevEdge:(float)prevEdge { + float padding; + +#if TARGET_OS_TV + padding = 100; +#else + padding = addComp.frame.size.width / 2; +#endif + if (prevEdge == -1) { - return hostScrollView.frame.origin.x + comp.frame.size.width / 2 + addComp.frame.size.width / 2; + return hostScrollView.frame.origin.x + comp.frame.size.width / 2 + padding; } else { - return prevEdge + addComp.frame.size.width / 2 + comp.frame.size.width / 2; + return prevEdge + comp.frame.size.width / 2 + padding; } }