소스 검색

Library: implement correct navigation for music albums and TV shows

Felix Paul Kühne 12 년 전
부모
커밋
0a0f22c4f7
1개의 변경된 파일16개의 추가작업 그리고 3개의 파일을 삭제
  1. 16 3
      AspenProject/VLCPlaylistViewController.m

+ 16 - 3
AspenProject/VLCPlaylistViewController.m

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