Update UI theme

* new dark UI
* new app lists
This commit is contained in:
Yuki MIZUNO
2014-12-04 18:41:01 +09:00
parent 79e51defe1
commit 582dda5727
8 changed files with 162 additions and 70 deletions

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Limelight-logo.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

View File

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

View File

@@ -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"]];

View File

@@ -15,8 +15,8 @@
#import "AppManager.h"
#import "SWRevealViewController.h"
@interface MainFrameViewController : UIViewController <MDNSCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate>
@property (strong, nonatomic) IBOutlet UIBarButtonItem *settingsSidebarButton;
@interface MainFrameViewController : UICollectionViewController <MDNSCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate>
@property (strong, nonatomic) IBOutlet UIButton *limelightLogoButton;
+ (StreamConfiguration*) getStreamConfiguration;

View File

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