Commit 6a08098a authored by Felix Paul Kühne's avatar Felix Paul Kühne

Unify menu behavior for pad and phone form factors

parent c72e8c36
...@@ -24,11 +24,8 @@ ...@@ -24,11 +24,8 @@
[contributeButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [contributeButton setBackgroundImage:[UIImage imageNamed:@"button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[contributeButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; [contributeButton setBackgroundImage:[UIImage imageNamed:@"buttonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { self.navigationItem.rightBarButtonItem = contributeButton;
self.navigationItem.rightBarButtonItem = contributeButton; self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
} else
self.navigationItem.leftBarButtonItem = contributeButton;
NSMutableString *htmlContent = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil]; NSMutableString *htmlContent = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil];
[htmlContent replaceOccurrencesOfString:@"ASPENVERSION" withString:[[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename] options:NSLiteralSearch range:NSMakeRange(0, 1000)]; [htmlContent replaceOccurrencesOfString:@"ASPENVERSION" withString:[[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename] options:NSLiteralSearch range:NSMakeRange(0, 1000)];
......
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
_backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)]; _backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
_backToMenuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)]; _backToMenuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) self.navigationItem.leftBarButtonItem = _backToMenuButton;
self.navigationItem.leftBarButtonItem = _backToMenuButton;
self.tableView.rowHeight = [VLCDropboxTableViewCell heightOfCell]; self.tableView.rowHeight = [VLCDropboxTableViewCell heightOfCell];
self.tableView.separatorColor = [UIColor colorWithWhite:.122 alpha:1.]; self.tableView.separatorColor = [UIColor colorWithWhite:.122 alpha:1.];
...@@ -117,10 +116,7 @@ ...@@ -117,10 +116,7 @@
[_activityIndicator startAnimating]; [_activityIndicator startAnimating];
[_dropboxController requestDirectoryListingAtPath:_currentPath]; [_dropboxController requestDirectoryListingAtPath:_currentPath];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) self.navigationItem.leftBarButtonItem = ![_currentPath isEqualToString:@"/"] ? _backButton : _backToMenuButton;
self.navigationItem.leftBarButtonItem = ![_currentPath isEqualToString:@"/"] ? _backButton : nil;
else
self.navigationItem.leftBarButtonItem = ![_currentPath isEqualToString:@"/"] ? _backButton : _backToMenuButton;
} }
#pragma mark - interface interaction #pragma mark - interface interaction
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
{ {
[self.downloadButton setTitle:NSLocalizedString(@"BUTTON_DOWNLOAD",@"") forState:UIControlStateNormal]; [self.downloadButton setTitle:NSLocalizedString(@"BUTTON_DOWNLOAD",@"") forState:UIControlStateNormal];
_currentDownloads = [[NSMutableArray alloc] init]; _currentDownloads = [[NSMutableArray alloc] init];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.title = NSLocalizedString(@"DOWNLOAD_FROM_HTTP", @""); self.title = NSLocalizedString(@"DOWNLOAD_FROM_HTTP", @"");
[super viewDidLoad]; [super viewDidLoad];
} }
......
...@@ -123,8 +123,7 @@ ...@@ -123,8 +123,7 @@
if (!self.settingsViewController) { if (!self.settingsViewController) {
self.settingsViewController = [[IASKAppSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; self.settingsViewController = [[IASKAppSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
self.settingsController.viewController = self.settingsViewController; self.settingsController.viewController = self.settingsViewController;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) self.settingsViewController.navigationItem.leftBarButtonItem = [UIBarButtonItem themedBackButtonWithTarget:self.settingsViewController andSelector:@selector(dismiss:)];
self.settingsViewController.navigationItem.leftBarButtonItem = [UIBarButtonItem themedBackButtonWithTarget:self.settingsViewController andSelector:@selector(dismiss:)];
} }
self.settingsViewController.modalPresentationStyle = UIModalPresentationFormSheet; self.settingsViewController.modalPresentationStyle = UIModalPresentationFormSheet;
...@@ -164,24 +163,12 @@ ...@@ -164,24 +163,12 @@
- (void)_presentViewController:(UIViewController *)viewController - (void)_presentViewController:(UIViewController *)viewController
{ {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; [navController loadTheme];
[navController loadTheme];
navController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:navController animated:YES];
if (viewController.navigationItem.rightBarButtonItem == nil) {
UIBarButtonItem *doneButton = [UIBarButtonItem themedDoneButtonWithTarget:self andSelector:@selector(_dismissModalViewController)];
viewController.navigationItem.rightBarButtonItem = doneButton;
}
} else {
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[navController loadTheme];
GHRevealViewController *ghVC = [(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController]; GHRevealViewController *ghVC = [(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController];
ghVC.contentViewController = navController; ghVC.contentViewController = navController;
[ghVC toggleSidebar:NO duration:kGHRevealSidebarDefaultAnimationDuration]; [ghVC toggleSidebar:NO duration:kGHRevealSidebarDefaultAnimationDuration];
}
} }
#pragma mark - shake to support #pragma mark - shake to support
......
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
[self.openButton setTitle:NSLocalizedString(@"BUTTON_OPEN", @"") forState:UIControlStateNormal]; [self.openButton setTitle:NSLocalizedString(@"BUTTON_OPEN", @"") forState:UIControlStateNormal];
[self.privateModeLabel setText:NSLocalizedString(@"PRIVATE_PLAYBACK_TOGGLE", @"")]; [self.privateModeLabel setText:NSLocalizedString(@"PRIVATE_PLAYBACK_TOGGLE", @"")];
self.title = NSLocalizedString(@"OPEN_NETWORK", @""); self.title = NSLocalizedString(@"OPEN_NETWORK", @"");
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
......
...@@ -45,10 +45,7 @@ ...@@ -45,10 +45,7 @@
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender - (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender
{ {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) [[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
[[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
else
[self.viewController.navigationController dismissModalViewControllerAnimated:YES];
} }
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForSpecifier:(IASKSpecifier*)specifier { - (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForSpecifier:(IASKSpecifier*)specifier {
......
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