Commit 00dcb286 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Add CloudStorage CollectionVC based on the RemoteBrowsing VC

parent 14096336
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCRemoteBrowsingCollectionViewController.h"
#import "VLCCloudStorageController.h"
#import "VLCCloudStorageCollectionViewCell.h"
@interface VLCCloudStorageTVViewController : VLCRemoteBrowsingCollectionViewController
@property (nonatomic, strong) VLCCloudStorageController *controller;
@property (nonatomic, strong) NSString *currentPath;
@property (nonatomic) BOOL authorizationInProgress;
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;
- (void)updateViewAfterSessionChange;
- (void)requestInformationForCurrentPath;
@end
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCCloudStorageTVViewController.h"
#import "VLCCloudStorageCollectionViewCell.h"
@interface VLCCloudStorageTVViewController ()
@end
@implementation VLCCloudStorageTVViewController
- (void)viewDidLoad {
[super viewDidLoad];
_activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_activityIndicator.hidesWhenStopped = YES;
_activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_activityIndicator];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
}
- (void)mediaListUpdated
{
[_activityIndicator stopAnimating];
[self.collectionView reloadData];
}
- (void)updateViewAfterSessionChange
{
if (![self.controller isAuthorized]) {
[_activityIndicator stopAnimating];
return;
}
//reload if we didn't come back from streaming
if (self.currentPath == nil)
self.currentPath = @"";
if([self.controller.currentListFiles count] == 0)
[self requestInformationForCurrentPath];
}
- (void)requestInformationForCurrentPath
{
[_activityIndicator startAnimating];
[self.controller requestDirectoryListingAtPath:self.currentPath];
[_activityIndicator stopAnimating];
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.controller.currentListFiles.count;
}
@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