diff --git a/XBMC Remote/DetailViewController.h b/XBMC Remote/DetailViewController.h index acd29d76d..31dc2f0df 100644 --- a/XBMC Remote/DetailViewController.h +++ b/XBMC Remote/DetailViewController.h @@ -90,7 +90,7 @@ BOOL enableDiskCache; CGFloat iOSYDelta; __weak IBOutlet UIToolbar *buttonsViewBgToolbar; - BOOL isViewDidLoad; + BOOL loadAndPresentDataOnViewDidAppear; BOOL forceMusicAlbumMode; NSMutableDictionary *epgDict; NSMutableArray *epgDownloadQueue; diff --git a/XBMC Remote/DetailViewController.m b/XBMC Remote/DetailViewController.m index b44bba115..c21867627 100644 --- a/XBMC Remote/DetailViewController.m +++ b/XBMC Remote/DetailViewController.m @@ -5551,16 +5551,16 @@ - (void)viewDidAppear:(BOOL)animated { else { self.navigationController.navigationBar.tintColor = ICON_TINT_COLOR; } - if (isViewDidLoad) { + + // We load data only in viewDidAppear as loading/presenting is tightly coupled and we want + // the layout to be ready. We do not want to repeat loading/presenting, if we re-enter the + // same controller instance from another view, e.g. when coming back from detail view. + if (loadAndPresentDataOnViewDidAppear) { [self initIpadCornerInfo]; - if (globalSearchView) { - [self retrieveGlobalData:NO]; - } - else { - [self startRetrieveDataWithRefresh:NO]; - } - isViewDidLoad = NO; + [self startRetrieveDataWithRefresh:NO]; + loadAndPresentDataOnViewDidAppear = NO; } + if (channelListView || channelGuideView) { [channelListUpdateTimer invalidate]; // Set up a timer that will always trigger at the start of each local minute. This supports @@ -5949,7 +5949,7 @@ - (void)viewDidLoad { NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; hiddenLabel = [userDefaults boolForKey:@"hidden_label_preference"]; noItemsLabel.text = LOCALIZED_STR(@"No items found."); - isViewDidLoad = YES; + loadAndPresentDataOnViewDidAppear = YES; sectionHeight = LIST_SECTION_HEADER_HEIGHT; epglockqueue = dispatch_queue_create("com.epg.arrayupdate", DISPATCH_QUEUE_SERIAL); epgDict = [NSMutableDictionary new]; @@ -6198,7 +6198,19 @@ - (void)checkUpdateRecordingState:(NSMutableArray*)source dataInfo:(NSDictionary - (void)initIpadCornerInfo { mainMenu *menuItem = self.detailItem; if (IS_IPAD && menuItem.enableSection) { - titleView = [[UIView alloc] initWithFrame:CGRectMake(STACKSCROLL_WIDTH - FIXED_SPACE_WIDTH, 0, FIXED_SPACE_WIDTH - 5, buttonsView.frame.size.height)]; + // Add a reserved fixed space which is used for iPad corner info + for (UILabel *view in buttonsView.subviews) { + if ([view isKindOfClass:[UIToolbar class]]) { + UIToolbar *toolbar = (UIToolbar*)view; + UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; + fixedSpace.width = FIXED_SPACE_WIDTH; + toolbar.items = [toolbar.items arrayByAddingObject:fixedSpace]; + break; + } + } + + // Add the corner info view + titleView = [[UIView alloc] initWithFrame:CGRectMake(buttonsView.frame.size.width - FIXED_SPACE_WIDTH, 0, FIXED_SPACE_WIDTH - 5, buttonsView.frame.size.height)]; titleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; topNavigationLabel.textAlignment = NSTextAlignmentRight; topNavigationLabel.font = [UIFont boldSystemFontOfSize:14]; @@ -6207,17 +6219,6 @@ - (void)initIpadCornerInfo { [buttonsView addSubview:titleView]; [self checkFullscreenButton:NO]; } - else { - // Remove the reserved fixed space which is only used for iPad corner info - for (UILabel *view in buttonsView.subviews) { - if ([view isKindOfClass:[UIToolbar class]]) { - UIToolbar *bar = (UIToolbar*)view; - NSMutableArray *items = [NSMutableArray arrayWithArray:bar.items]; - [items removeObjectAtIndex:15]; - [bar setItems:items animated:NO]; - } - } - } } - (void)checkFullscreenButton:(BOOL)forceHide { diff --git a/XBMC Remote/DetailViewController.xib b/XBMC Remote/DetailViewController.xib index 0d4e702b8..ebea58c92 100644 --- a/XBMC Remote/DetailViewController.xib +++ b/XBMC Remote/DetailViewController.xib @@ -75,7 +75,7 @@ @@ -173,13 +173,12 @@ - diff --git a/XBMC Remote/ShowInfoViewController.h b/XBMC Remote/ShowInfoViewController.h index 28bbc0ffb..bf11caa0c 100644 --- a/XBMC Remote/ShowInfoViewController.h +++ b/XBMC Remote/ShowInfoViewController.h @@ -82,7 +82,6 @@ UIColor *foundTintColor; UILabel *viewTitle; __weak IBOutlet UIImageView *bottomShadow; - BOOL isViewDidLoad; UIImageView *isRecording; LogoBackgroundType logoBackgroundMode; UIBarButtonItem *doneButton; diff --git a/XBMC Remote/ShowInfoViewController.m b/XBMC Remote/ShowInfoViewController.m index 4c0b87825..de502e030 100644 --- a/XBMC Remote/ShowInfoViewController.m +++ b/XBMC Remote/ShowInfoViewController.m @@ -577,6 +577,10 @@ - (void)setIOS7barTintColor:(UIColor*)tintColor { } - (void)createInfo { + // Use mainLabel0 to check, if the info view already has been created + if (mainLabel0) { + return; + } // NEED TO BE OPTIMIZED. IT WORKS BUT THERE ARE TOO MANY IFS! NSMutableDictionary *item = self.detailItem; NSString *placeHolderImage = @"coverbox_back"; @@ -1877,10 +1881,7 @@ - (void)viewWillAppear:(BOOL)animated { viewTitle.textAlignment = NSTextAlignmentCenter; bottomShadow.hidden = YES; } - if (isViewDidLoad) { - [self createInfo]; - isViewDidLoad = NO; - } + [self createInfo]; } - (void)viewDidAppear:(BOOL)animated { @@ -1952,7 +1953,6 @@ - (void)disableScrollsToTopPropertyOnAllSubviewsOf:(UIView*)view { - (void)viewDidLoad { [super viewDidLoad]; - isViewDidLoad = YES; fanartView.tag = FANART_FULLSCREEN_DISABLE; fanartView.userInteractionEnabled = YES; UITapGestureRecognizer *touchOnKenView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showBackground:)];