Commit cd1b81ae authored by Felix Paul Kühne's avatar Felix Paul Kühne

Dropbox: add activity indicator when requesting folder listings

parent 70cdc5f3
......@@ -22,6 +22,8 @@
UIBarButtonItem *_progressBarButtonItem;
UIBarButtonItem *_downloadingBarLabel;
UIProgressView *_progressView;
UIActivityIndicatorView *_activityIndicator;
}
@end
......@@ -69,6 +71,17 @@
self.navigationController.toolbarHidden = NO;
self.navigationController.toolbar.barStyle = UIBarStyleBlack;
[self _showProgressInToolbar:NO];
_activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_activityIndicator.hidesWhenStopped = YES;
CGRect aiFrame = _activityIndicator.frame;
CGSize tvSize = self.tableView.frame.size;
aiFrame.origin.x = (tvSize.width - aiFrame.size.width) / 2.;
aiFrame.origin.y = (tvSize.height - aiFrame.size.height) / 2.;
_activityIndicator.frame = aiFrame;
[self.view addSubview:_activityIndicator];
}
- (void)_showProgressInToolbar:(BOOL)value
......@@ -81,6 +94,12 @@
}
}
- (void)_requestInformationForCurrentPath
{
[_activityIndicator startAnimating];
[_dropboxController requestDirectoryListingAtPath:_currentPath];
}
- (void)viewWillAppear:(BOOL)animated
{
[self updateViewAfterSessionChange];
......@@ -94,7 +113,7 @@
- (IBAction)folderUp:(id)sender
{
_currentPath = [_currentPath stringByDeletingLastPathComponent];
[_dropboxController requestDirectoryListingAtPath:_currentPath];
[self _requestInformationForCurrentPath];
}
#pragma mark - Table view data source
......@@ -133,7 +152,7 @@
} else {
/* dive into subdirectory */
_currentPath = [_currentPath stringByAppendingFormat:@"/%@", selectedFile.filename];
[_dropboxController requestDirectoryListingAtPath:_currentPath];
[self _requestInformationForCurrentPath];
}
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
......@@ -143,6 +162,8 @@
- (void)mediaListUpdated
{
[_activityIndicator stopAnimating];
[self.tableView reloadData];
NSUInteger count = _dropboxController.currentListFiles.count;
......@@ -178,7 +199,7 @@
[self.loginToDropboxView removeFromSuperview];
_currentPath = @"/";
[_dropboxController requestDirectoryListingAtPath:_currentPath];
[self _requestInformationForCurrentPath];
}
#pragma mark - login dialog
......
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