From 582dda57272cc5ea4bb141c3c16ca033cd673196 Mon Sep 17 00:00:00 2001 From: Yuki MIZUNO Date: Thu, 4 Dec 2014 18:41:01 +0900 Subject: [PATCH] Update UI theme * new dark UI * new app lists --- .../Logo.imageset/Contents.json | 12 +++ .../Logo.imageset/Limelight-logo.pdf | Bin 0 -> 3890 bytes Limelight/UIAppView.m | 9 ++- Limelight/UIComputerView.m | 2 + .../ViewControllers/MainFrameViewController.h | 4 +- .../ViewControllers/MainFrameViewController.m | 75 +++++++++--------- iPad.storyboard | 62 +++++++++++---- iPhone.storyboard | 68 ++++++++++++---- 8 files changed, 162 insertions(+), 70 deletions(-) create mode 100644 Limelight/Images.xcassets/Logo.imageset/Contents.json create mode 100644 Limelight/Images.xcassets/Logo.imageset/Limelight-logo.pdf 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 0000000000000000000000000000000000000000..dd841bdaa4cfd6007e1f3f790ca193bc50fee9fc GIT binary patch literal 3890 zcmcgvYitx%6ec0qun-$wZ6pD%*ix!=o;$BvK-g_-E0(1#bprw&cZc1D?anegi-ijE zh!~&Q`-F`Bl5G?2<8ks38fqiHC#p*%t&ph2h)KvPH{C7wGw({8)`FtK!UGmmrb zx%Yhce)pU+=`Lqp7ERb~>Bs(Tcw}P{h19o}*>Z9aIY$ZkbU(6#sMv-OBJ%=4UD4nf zly$|acvP=qn=!){(KSV`uvLEiNzJU#FVx7~2ie0&SJ~&@&DnWxEJ|HGC*|yr+`p1* z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IAppView.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 @@ - +