Browse Source

set activityindicator position in gdrive and dropboxcontroller correctly when rotating device. Fix bug where not all files in a gdrive folder where displayed

Carola Nitz 10 years ago
parent
commit
3456dd8c08

+ 4 - 7
Sources/VLCDropboxTableViewController.m

@@ -104,8 +104,11 @@
 
     _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)viewWillAppear:(BOOL)animated
@@ -116,12 +119,6 @@
     [self updateViewAfterSessionChange];
     [super viewWillAppear:animated];
 
-    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.cloudStorageLogo sizeToFit];
     self.cloudStorageLogo.center = self.view.center;
 }

+ 2 - 1
Sources/VLCGoogleDriveController.m

@@ -128,7 +128,8 @@
 
     query = [GTLQueryDrive queryForFilesList];
     query.pageToken = _nextPageToken;
-    query.maxResults = 100;
+    //the results don't come in alphabetical order when paging. So the maxresult (default 100) is set to INT_max in order to get all files at once.
+    query.maxResults = INT_MAX;
     if (![_folderId isEqualToString:@""]) {
         query.q = [NSString stringWithFormat:@"'%@' in parents", [_folderId lastPathComponent]];
     }

+ 4 - 7
Sources/VLCGoogleDriveTableViewController.m

@@ -103,8 +103,11 @@
 
     _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]];
 }
 
 - (GTMOAuth2ViewControllerTouch *)createAuthController
@@ -137,12 +140,6 @@
     [self updateViewAfterSessionChange];
     [super viewWillAppear:animated];
 
-    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.cloudStorageLogo sizeToFit];
     self.cloudStorageLogo.center = self.view.center;
 }