diff --git a/Limelight/Images.xcassets/Logo.imageset/Contents.json b/Limelight/Images.xcassets/Logo.imageset/Contents.json new file mode 100644 index 0000000..a87a79d --- /dev/null +++ b/Limelight/Images.xcassets/Logo.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Limelight-logo.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Limelight/Images.xcassets/Logo.imageset/Limelight-logo.pdf b/Limelight/Images.xcassets/Logo.imageset/Limelight-logo.pdf new file mode 100644 index 0000000..dd841bd Binary files /dev/null and b/Limelight/Images.xcassets/Logo.imageset/Limelight-logo.pdf differ diff --git a/Limelight/UIAppView.m b/Limelight/UIAppView.m index 645d65d..de9cfa9 100644 --- a/Limelight/UIAppView.m +++ b/Limelight/UIAppView.m @@ -26,6 +26,9 @@ static int LABEL_DY = 20; [_appButton setBackgroundImage:[UIImage imageNamed:@"NoAppImage"] forState:UIControlStateNormal]; [_appButton sizeToFit]; [_appButton addTarget:self action:@selector(appClicked) forControlEvents:UIControlEventTouchUpInside]; + + // Remove Shadow and label + /* _appButton.layer.shadowColor = [[UIColor blackColor] CGColor]; _appButton.layer.shadowOffset = CGSizeMake(5,8); _appButton.layer.shadowOpacity = 0.7; @@ -36,9 +39,11 @@ static int LABEL_DY = 20; _appLabel.center = CGPointMake(_appButton.bounds.origin.x + (_appButton.bounds.size.width / 2), _appButton.bounds.origin.y + _appButton.bounds.size.height + LABEL_DY); [self updateBounds]; - [self addSubview:_appButton]; [self addSubview:_appLabel]; + */ + [self addSubview:_appButton]; + [self sizeToFit]; return self; } @@ -56,6 +61,8 @@ static int LABEL_DY = 20; - (void) updateAppImage { if (_app.appImage != nil) { + _appButton.frame = CGRectMake(0, 0, _app.appImage.size.width / 2, _app.appImage.size.height / 2); + self.frame = CGRectMake(0, 0, _app.appImage.size.width / 2, _app.appImage.size.height / 2); [_appButton setBackgroundImage:_app.appImage forState:UIControlStateNormal]; [self setNeedsDisplay]; } diff --git a/Limelight/UIComputerView.m b/Limelight/UIComputerView.m index b97b91e..7cc7245 100644 --- a/Limelight/UIComputerView.m +++ b/Limelight/UIComputerView.m @@ -40,6 +40,7 @@ static int LABEL_DY = 20; [_hostLabel setText:[_computer displayName]]; [_hostLabel sizeToFit]; + _hostLabel.textColor = [UIColor whiteColor]; [_hostButton addTarget:self action:@selector(hostClicked) forControlEvents:UIControlEventTouchUpInside]; _hostLabel.center = CGPointMake(_hostButton.frame.origin.x + (_hostButton.frame.size.width / 2), _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY); [self updateBounds]; @@ -66,6 +67,7 @@ static int LABEL_DY = 20; [_hostLabel setText:@"Add Host"]; [_hostLabel sizeToFit]; + _hostLabel.textColor = [UIColor whiteColor]; _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"]]; diff --git a/Limelight/ViewControllers/MainFrameViewController.h b/Limelight/ViewControllers/MainFrameViewController.h index cc8a15b..43d1df8 100644 --- a/Limelight/ViewControllers/MainFrameViewController.h +++ b/Limelight/ViewControllers/MainFrameViewController.h @@ -15,8 +15,8 @@ #import "AppManager.h" #import "SWRevealViewController.h" -@interface MainFrameViewController : UIViewController -@property (strong, nonatomic) IBOutlet UIBarButtonItem *settingsSidebarButton; +@interface MainFrameViewController : UICollectionViewController +@property (strong, nonatomic) IBOutlet UIButton *limelightLogoButton; + (StreamConfiguration*) getStreamConfiguration; diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 9c992e6..3cf3a9a 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -29,10 +29,10 @@ UIAlertView* _pairAlert; UIScrollView* hostScrollView; - UIScrollView* appScrollView; } static NSString* deviceName = @"roth"; static NSMutableSet* hostList; +static NSArray* appList; static StreamConfiguration* streamConfig; + (StreamConfiguration*) getStreamConfiguration { @@ -67,19 +67,16 @@ static StreamConfiguration* streamConfig; HttpManager* hMan = [[HttpManager alloc] initWithHost:_selectedHost.hostName uniqueId:_uniqueId deviceName:deviceName cert:_cert]; NSData* appListResp = [hMan executeRequestSynchronously:[hMan newAppListRequest]]; - NSArray* appList = [HttpManager getAppListFromXML:appListResp]; + appList = [HttpManager getAppListFromXML:appListResp]; dispatch_async(dispatch_get_main_queue(), ^{ - [self updateApps:appList]; + [self updateApps]; }); [AppManager retrieveAppAssets:appList withManager:hMan andCallback:self]; }); } - (void) receivedAssetForApp:(App*)app { - NSArray* subviews = [appScrollView subviews]; - for (UIAppView* appView in subviews) { - [appView updateAppImage]; - } + [self.collectionView reloadData]; } - (void)displayDnsFailedDialog { @@ -161,12 +158,8 @@ static StreamConfiguration* streamConfig; { [super viewDidLoad]; - // Change button color - _settingsSidebarButton.tintColor = [UIColor colorWithRed:.2 green:.9 blue:0.f alpha:1.f]; - // Set the side bar button action. When it's tapped, it'll show up the sidebar. - _settingsSidebarButton.target = self.revealViewController; - _settingsSidebarButton.action = @selector(revealToggle:); + [_limelightLogoButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown]; // Set the gesture [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer]; @@ -191,20 +184,21 @@ static StreamConfiguration* streamConfig; hostScrollView.frame = CGRectMake(0, self.navigationController.navigationBar.frame.origin.y + self.navigationController.navigationBar.frame.size.height, self.view.frame.size.width, self.view.frame.size.height / 2); [hostScrollView setShowsHorizontalScrollIndicator:NO]; - appScrollView = [[UIScrollView alloc] init]; - appScrollView.frame = CGRectMake(0, hostScrollView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height / 2); - [appScrollView setShowsHorizontalScrollIndicator:NO]; - [self retrieveSavedHosts]; [self updateHosts:[hostList allObjects]]; [self.view addSubview:hostScrollView]; - [self.view addSubview:appScrollView]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.navigationController setNavigationBarHidden:NO animated:YES]; + + // Hide 1px border line + UIImage* fakeImage = [[UIImage alloc] init]; + [self.navigationController.navigationBar setShadowImage:fakeImage]; + [self.navigationController.navigationBar setBackgroundImage:fakeImage forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; + _mDNSManager = [[MDNSManager alloc] initWithCallback:self]; [_mDNSManager searchForHosts]; } @@ -255,29 +249,36 @@ static StreamConfiguration* streamConfig; } } -- (void) updateApps:(NSArray*)apps { - [[appScrollView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; - App* fakeApp = [[App alloc] init]; - fakeApp.appName = @"No App Name"; - UIAppView* noAppImage = [[UIAppView alloc] initWithApp:fakeApp andCallback:nil]; - float prevEdge = -1; - UIAppView* appView; - for (App* app in apps) { - appView = [[UIAppView alloc] initWithApp:app andCallback:self]; - prevEdge = [self getAppViewX:appView noApp:noAppImage prevEdge:prevEdge]; - appView.center = CGPointMake(prevEdge, appScrollView.frame.size.height / 2); - prevEdge = appView.frame.origin.x + appView.frame.size.width; - [appScrollView addSubview:appView]; - } - [appScrollView setContentSize:CGSizeMake(prevEdge + noAppImage.frame.size.width, appScrollView.frame.size.height)]; +- (void) updateApps { + [hostScrollView removeFromSuperview]; + [self.collectionView reloadData]; } -- (float) getAppViewX:(UIAppView*)app noApp:(UIAppView*)noAppImage prevEdge:(float)prevEdge { - if (prevEdge == -1) { - return appScrollView.frame.origin.x + app.frame.size.width / 2 + noAppImage.frame.size.width / 2; - } else { - return prevEdge + app.frame.size.width / 2 + noAppImage.frame.size.width / 2; +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AppCell" forIndexPath:indexPath]; + + App* app = appList[indexPath.row]; + UIAppView* appView = [[UIAppView alloc] initWithApp:app andCallback:self]; + [appView updateAppImage]; + + if (appView.bounds.size.width > 10.0) { + CGFloat scale = cell.bounds.size.width / appView.bounds.size.width; + [appView setCenter:CGPointMake(appView.bounds.size.width / 2 * scale, appView.bounds.size.height / 2 * scale)]; + appView.transform = CGAffineTransformMakeScale(scale, scale); } + + [cell.subviews.firstObject removeFromSuperview]; // Remove a view that was previously added + [cell addSubview:appView]; + + return cell; +} + +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 1; // App collection only +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return appList.count; } - (BOOL)validatePcSelected { diff --git a/iPad.storyboard b/iPad.storyboard index 6aeb903..6e1f439 100644 --- a/iPad.storyboard +++ b/iPad.storyboard @@ -8,17 +8,48 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -38,25 +69,26 @@ - + + @@ -66,6 +98,7 @@ + @@ -74,9 +107,10 @@ + - + @@ -114,7 +148,7 @@ - + @@ -165,7 +199,7 @@ - + diff --git a/iPhone.storyboard b/iPhone.storyboard index 81d1251..b69acb1 100644 --- a/iPhone.storyboard +++ b/iPhone.storyboard @@ -8,19 +8,49 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - + @@ -58,34 +88,36 @@ + - + + @@ -95,9 +127,10 @@ + - + @@ -116,9 +149,12 @@ - + + + + @@ -166,7 +202,7 @@ - +