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 00000000..a87a79d7 --- /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 zcmY!laB>PvZJN_v`n(E)q9CH;r$$sd3dflb_53K`^UgJ_ZCMA5QQAsa!*|{A$+yw`f9yLi7 zB}Ob)nG&MVV-*pwqM>?LM5FkbGkU^_=c;dpT)tc~Lw4__#J&~UchqWJA6>i28LTq> z*18aduv4*T%+#*#75%j8LiKXDYVlyN`5RyGU)SU-)-U~fMBeJmy2V>8&o_Rx|1kf9 zxl51gvsqd$fA{S5lD$^N|2|&upUs26h0zZRx#h(YCf$lYZqhd4>qDUe=S(9H6F)JL zzmwZkjvR3PaB3P&IN zmo{%@n7XatbB5{r8=G~@t~I}UQZ}*ck!1F=2YYpv=N7DJPJhv(9CvGe!W6lUbu%?D zzLfjAI;?)-x7nAs^Ss=hFkAd)iI++LR`$^6rd-dW6xWscnpaY+0JZ}xr z7l3R^u7nADDwGtJg53a8y1GA^$ zH`IHEU};kWLrXJ51p_^ELvu3|a|HuELjy|-0~4qrehP+2u7Ej00SrJ+fyOt&C14o^ zedqj~{G#B3#N<>opTgzyi&Baeq7{rR&GpQT&CM;$6-+G6^-Rr;Obw9*jVz4xj4aKK z4U8ZzQUC)i{soIG=(|>wq~@h4M1#W{LV*1Xm4*eK0ysdyWu<}wDE&ag8I(vt!3lqrG7+YFGeQ0QDX{ca?5QTWr)Y6hJJ_O}GD*MpT(oE0D*xb<40_sB}BLhEcCDBB!|*O${-9NVjAPDk`b$Lt`@|JwsD-3q&NE8Y&P;z)ZmyAqw@QnE`#$DY#yvxgU)zvH8)!f?Gq5ng2m?a{BMdhi8<}Ca&)C=!$&Qku#LS%3B5=1h zII}7h6!xGtb5MSMiGm?04#BN9eb2nKd -@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 9c992e6f..3cf3a9a3 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 6aeb9034..6e1f4392 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 81d12511..b69acb14 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 @@ - +