Commit a1617b83 authored by Vincent L. Cone's avatar Vincent L. Cone Committed by Felix Paul Kühne

tvOS: Remove collection view focus recovery workaround since we no longer...

tvOS: Remove collection view focus recovery workaround since we no longer perform reloads, instead use inserts and deletes if the content changes
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 5a1b44f1
......@@ -20,8 +20,6 @@
@interface VLCServerBrowsingTVViewController ()
{
UILabel *_nothingFoundLabel;
NSIndexPath *_currentFocus;
BOOL _focusChangeAllowed;
}
@property (nonatomic) VLCServerBrowsingController *browsingController;
@property (nonatomic) NSArray<id <VLCNetworkServerBrowserItem>> *items;
......@@ -42,9 +40,6 @@
self.title = serverBrowser.title;
self.downloadArtwork = [[NSUserDefaults standardUserDefaults] boolForKey:kVLCSettingDownloadArtwork];
_currentFocus = [NSIndexPath indexPathForRow:0 inSection:0];
_focusChangeAllowed = YES;
}
return self;
}
......@@ -189,27 +184,4 @@
[self didSelectItem:item index:row singlePlayback:singlePlayback];
}
#pragma mark - focus recovery workaround
- (void)collectionView:(UICollectionView *)collectionView didUpdateFocusInContext:(UICollectionViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
if (context.previouslyFocusedIndexPath == nil && context.nextFocusedIndexPath != nil)
[self setNeedsFocusUpdate];
if (context.previouslyFocusedIndexPath != nil && context.nextFocusedIndexPath != nil)
_currentFocus = context.nextFocusedIndexPath;
_focusChangeAllowed = context.nextFocusedIndexPath != nil;
}
- (BOOL)collectionView:(UICollectionView *)collectionView canFocusItemAtIndexPath:(NSIndexPath *)indexPath
{
return _focusChangeAllowed || [_currentFocus compare:indexPath] == NSOrderedSame;
}
- (NSIndexPath *)indexPathForPreferredFocusedViewInCollectionView:(UICollectionView *)collectionView
{
return _currentFocus;
}
@end
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