|
@@ -19,6 +19,8 @@
|
|
|
@interface VLCServerBrowsingTVViewController ()
|
|
|
{
|
|
|
UILabel *_nothingFoundLabel;
|
|
|
+ NSIndexPath *_currentFocus;
|
|
|
+ BOOL _focusChangeAllowed;
|
|
|
}
|
|
|
@property (nonatomic, readonly) id<VLCNetworkServerBrowser>serverBrowser;
|
|
|
@property (nonatomic) VLCServerBrowsingController *browsingController;
|
|
@@ -38,6 +40,9 @@
|
|
|
self.title = serverBrowser.title;
|
|
|
|
|
|
self.downloadArtwork = [[NSUserDefaults standardUserDefaults] boolForKey:kVLCSettingDownloadArtwork];
|
|
|
+
|
|
|
+ _currentFocus = [NSIndexPath indexPathForRow:0 inSection:0];
|
|
|
+ _focusChangeAllowed = YES;
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
@@ -156,4 +161,27 @@
|
|
|
[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
|