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

Add 'Play All' button for network shares

Only exposed on iOS so far

(cherry picked from commit 8bd8ee30)
parent 357d372b
......@@ -18,6 +18,7 @@ extern NSString *VLCNetworkListCellIdentifier;
@property (nonatomic, strong) UITableView *tableView;
- (IBAction)playAllAction:(id)sender;
- (void)tableView:(UITableView *)tableView willDisplayCell:(VLCNetworkListCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
@end
......@@ -77,7 +77,11 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
_tapTwiceGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwiceGestureAction:)];
[_tapTwiceGestureRecognizer setNumberOfTapsRequired:2];
self.navigationItem.rightBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(menuButtonAction:)];
UIBarButtonItem *playAllButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(playAllAction:)];
playAllButton.accessibilityLabel = NSLocalizedString(@"PLAY_ALL_BUTTON", nil);
playAllButton.isAccessibilityElement = YES;
self.navigationItem.rightBarButtonItems = @[[UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(menuButtonAction:)],
playAllButton];
_searchData = [[NSMutableArray alloc] init];
[_searchData removeAllObjects];
......@@ -108,6 +112,11 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
[self setEditing:NO animated:YES];
}
- (IBAction)playAllAction:(id)sender
{
// to be implemented by subclass
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
......
......@@ -123,6 +123,26 @@
}
}
- (void)playAllAction:(id)sender
{
VLCMediaList *fullMediaList = self.serverBrowser.mediaList;
NSUInteger count = fullMediaList.count;
NSMutableArray *fileList = [[NSMutableArray alloc] init];
for (NSUInteger x = count - 1; x > 0; x--) {
VLCMedia *media = [fullMediaList mediaAtIndex:x];
VLCMediaType mediaType = media.mediaType;
if (mediaType == VLCMediaTypeFile || mediaType == VLCMediaTypeStream || mediaType == VLCMediaTypeUnknown) {
[fileList addObject:media];
}
}
if (fileList.count > 0) {
VLCMediaList *fileMediaList = [[VLCMediaList alloc] initWithArray:fileList];
[self.browsingController configureSubtitlesInMediaList:fileMediaList];
[self.browsingController streamMediaList:fileMediaList startingAtIndex:0];
}
}
#pragma mark - table view data source, for more see super
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
......
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