Commit 0a0f22c4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Library: implement correct navigation for music albums and TV shows

parent 57aabe99
......@@ -24,6 +24,7 @@
@interface VLCPlaylistViewController () <AQGridViewDataSource, AQGridViewDelegate, UITableViewDataSource, UITableViewDelegate> {
NSMutableArray *_foundMedia;
NSUInteger _libraryMode;
UIBarButtonItem *_menuButton;
}
@end
......@@ -56,7 +57,7 @@
{
[super viewDidLoad];
UIBarButtonItem *addButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(leftButtonAction:)];
_menuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(leftButtonAction:)];
/* After day 354 of the year, the usual VLC cone is replaced by another cone
* wearing a Father Xmas hat.
......@@ -67,9 +68,9 @@
[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
if (dayOfYear >= 354)
addButton.image = [UIImage imageNamed:@"vlc-xmas"];
_menuButton.image = [UIImage imageNamed:@"vlc-xmas"];
self.navigationItem.leftBarButtonItem = addButton;
self.navigationItem.leftBarButtonItem = _menuButton;
[self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"button"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
......@@ -259,9 +260,15 @@
NSManagedObject *currentObject = _foundMedia[indexPath.row];
if ([currentObject isKindOfClass:[MLAlbum class]]) {
_foundMedia = [NSMutableArray arrayWithArray:[[(MLAlbum *)currentObject tracks] allObjects]];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(backToAllItems:)];
[self.navigationItem.leftBarButtonItem setTitle:NSLocalizedString(@"LIBRARY_MUSIC", @"")];
self.title = [(MLAlbum*)currentObject name];
[self updateViewContents];
} else if ([currentObject isKindOfClass:[MLShow class]]) {
_foundMedia = [NSMutableArray arrayWithArray:[[(MLShow *)currentObject episodes] allObjects]];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(backToAllItems:)];
[self.navigationItem.leftBarButtonItem setTitle:NSLocalizedString(@"LIBRARY_SERIES", @"")];
self.title = [(MLShow*)currentObject name];
[self updateViewContents];
} else {
if (!self.movieViewController)
......@@ -351,6 +358,12 @@
[[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
}
- (IBAction)backToAllItems:(id)sender
{
self.navigationItem.leftBarButtonItem = _menuButton;
[self setLibraryMode:_libraryMode];
}
/* deprecated in iOS 6 */
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
......
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