Improve selection visibility on tvOS

This commit is contained in:
Cameron Gutman
2019-08-30 22:33:32 -07:00
parent f2fa9e18ea
commit f6153fe818
2 changed files with 15 additions and 6 deletions

View File

@@ -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

View File

@@ -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;
}
}