Commit 00817bbf authored by Felix Paul Kühne's avatar Felix Paul Kühne

ATV: add label to show that we didn't find a server

parent 3b3174df
B"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
......
......@@ -27,6 +27,7 @@
- (NSUInteger)numberOfSections;
- (NSString *)titleForSection:(NSUInteger)section;
- (NSUInteger)numberOfItemsInSection:(NSUInteger)section;
- (BOOL)foundAnythingAtAll;
- (id<VLCLocalNetworkService>)networkServiceForIndexPath:(NSIndexPath *)indexPath;
......
......@@ -137,6 +137,18 @@
return [browser networkServiceForIndex:row];
}
- (BOOL)foundAnythingAtAll
{
NSUInteger serviceCount = _serviceBrowsers.count;
BOOL ret = NO;
for (NSUInteger i = 0; i < serviceCount; i++) {
ret = [_serviceBrowsers[i] numberOfItems] > 0;
if (ret)
break;
}
return ret;
}
#pragma mark - VLCLocalNetworkServiceBrowserDelegate
- (void)localNetworkServiceBrowserDidUpdateServices:(id<VLCLocalNetworkServiceBrowser>)serviceBrowser {
if ([self.delegate respondsToSelector:@selector(discoveryFoundSomethingNew)]) {
......
......@@ -22,7 +22,9 @@
#import <SSKeychain/SSKeychain.h>
@interface VLCServerListTVTableViewController ()
{
UILabel *_nothingFoundLabel;
}
@end
@implementation VLCServerListTVTableViewController
......@@ -35,6 +37,32 @@
UINib *nib = [UINib nibWithNibName:@"VLCLocalNetworkServerTVCell" bundle:nil];
[self.tableView registerNib:nib forCellReuseIdentifier:VLCLocalServerTVCell];
self.tableView.rowHeight = 150;
_nothingFoundLabel = [[UILabel alloc] init];
_nothingFoundLabel.text = NSLocalizedString(@"NO_SERVER_FOUND", nil);
_nothingFoundLabel.textAlignment = NSTextAlignmentCenter;
_nothingFoundLabel.textColor = [UIColor VLCLightTextColor];
_nothingFoundLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle3];
[_nothingFoundLabel sizeToFit];
[_nothingFoundLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:_nothingFoundLabel];
NSLayoutConstraint *yConstraint = [NSLayoutConstraint constraintWithItem:_nothingFoundLabel
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0.0];
[self.view addConstraint:yConstraint];
NSLayoutConstraint *xConstraint = [NSLayoutConstraint constraintWithItem:_nothingFoundLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0];
[self.view addConstraint:xConstraint];
}
- (void)viewDidAppear:(BOOL)animated
......@@ -211,9 +239,12 @@
}
#pragma mark - VLCLocalServerDiscoveryController
- (void)discoveryFoundSomethingNew {
- (void)discoveryFoundSomethingNew
{
[self.tableView reloadData];
NSLog(@"%s",__PRETTY_FUNCTION__);
_nothingFoundLabel.hidden = self.discoveryController.foundAnythingAtAll;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment