Brion VIBBER has submitted this change and it was merged. Change subject: Made nav back buttons more consistent between iOS 6 and 7. ......................................................................
Made nav back buttons more consistent between iOS 6 and 7. Change-Id: I0d76c2f223694c82840c7d2aacbf053330a297bc --- M Commons-iOS.xcodeproj/project.pbxproj M Commons-iOS/CategorySearchTableViewController.m M Commons-iOS/CommonsApp.h M Commons-iOS/CommonsApp.m M Commons-iOS/GalleryMultiSelectCollectionVC.m M Commons-iOS/ImageScrollViewController.m M Commons-iOS/LoginViewController.m M Commons-iOS/MyUploadsViewController.m M Commons-iOS/SettingsViewController.m A Commons-iOS/clear.png 10 files changed, 74 insertions(+), 67 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/Commons-iOS.xcodeproj/project.pbxproj b/Commons-iOS.xcodeproj/project.pbxproj index e01e242..dde04d0 100644 --- a/Commons-iOS.xcodeproj/project.pbxproj +++ b/Commons-iOS.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 0417D9E417698AF200081D8C /* PictureOfDayCycler.m in Sources */ = {isa = PBXBuildFile; fileRef = 0417D9E317698AF200081D8C /* PictureOfDayCycler.m */; }; 0417D9EA176E666B00081D8C /* GalleryMultiSelectCollectionVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0417D9E9176E666B00081D8C /* GalleryMultiSelectCollectionVC.m */; }; 0417D9F0176EB00100081D8C /* GalleryMultiSelectAlbumCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0417D9EF176EB00100081D8C /* GalleryMultiSelectAlbumCell.m */; }; + 0438EF0517FE20BA005F8BF5 /* clear.png in Resources */ = {isa = PBXBuildFile; fileRef = 0438EF0417FE20BA005F8BF5 /* clear.png */; }; 044A0C3C170F6504003395DD /* GradientButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 044A0C3B170F6504003395DD /* GradientButton.m */; }; 0451C8621739A2CC00C2D03B /* FetchImageOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0451C8611739A2CC00C2D03B /* FetchImageOperation.m */; }; 0451C865173B3D3800C2D03B /* SpeedGovernor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0451C864173B3D3800C2D03B /* SpeedGovernor.m */; }; @@ -341,7 +342,8 @@ 0417D9E9176E666B00081D8C /* GalleryMultiSelectCollectionVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryMultiSelectCollectionVC.m; sourceTree = "<group>"; }; 0417D9EE176EB00000081D8C /* GalleryMultiSelectAlbumCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryMultiSelectAlbumCell.h; sourceTree = "<group>"; }; 0417D9EF176EB00100081D8C /* GalleryMultiSelectAlbumCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryMultiSelectAlbumCell.m; sourceTree = "<group>"; }; - 0438EF0317FCCB96005F8BF5 /* FileUpload 4.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = file; path = "FileUpload 4.xcdatamodel"; sourceTree = "<group>"; }; + 0438EF0317FCCB96005F8BF5 /* FileUpload 4.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "FileUpload 4.xcdatamodel"; sourceTree = "<group>"; }; + 0438EF0417FE20BA005F8BF5 /* clear.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = clear.png; path = "Commons-iOS/clear.png"; sourceTree = SOURCE_ROOT; }; 044A0C3A170F6504003395DD /* GradientButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GradientButton.h; sourceTree = "<group>"; }; 044A0C3B170F6504003395DD /* GradientButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GradientButton.m; sourceTree = "<group>"; }; 0451C8601739A2CC00C2D03B /* FetchImageOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchImageOperation.h; sourceTree = "<group>"; }; @@ -954,6 +956,7 @@ isa = PBXGroup; children = ( 04AC5A7517A1D66800A06997 /* Bundled Pictures of Day */, + 0438EF0417FE20BA005F8BF5 /* clear.png */, 048C8B9E17FB71520082EB28 /* categoryHamburger.png */, 04E6617917614AB0003F35AD /* copyl...@2x.png */, 04E6617A17614AB0003F35AD /* copyleft.png */, @@ -1463,6 +1466,7 @@ 04E6617C17614AB0003F35AD /* copyleft.png in Resources */, 30DC441B178D42E60081555A /* cc-by-white.png in Resources */, 30DC441C178D42E60081555A /* cc-by-wh...@2x.png in Resources */, + 0438EF0517FE20BA005F8BF5 /* clear.png in Resources */, 30DC441D178D42E60081555A /* cc-sa-white.png in Resources */, 30DC441E178D42E60081555A /* cc-sa-wh...@2x.png in Resources */, 04AC5A8A17A1D66800A06997 /* POTD-2007-06-15.dict in Resources */, diff --git a/Commons-iOS/CategorySearchTableViewController.m b/Commons-iOS/CategorySearchTableViewController.m index 7ed974a..bac1ac5 100644 --- a/Commons-iOS/CategorySearchTableViewController.m +++ b/Commons-iOS/CategorySearchTableViewController.m @@ -37,10 +37,7 @@ [super viewDidLoad]; // Change back button to be an arrow - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[[CommonsApp singleton] getBackButtonString] - style:UIBarButtonItemStyleBordered - target:self - action:@selector(backButtonPressed:)]; + self.navigationItem.leftBarButtonItem = [[CommonsApp singleton] getBackButtonItemWithTarget:self action:@selector(backButtonPressed:)]; self.recentCats = [self recentCategories]; // don't need a live view, it won't change while we're viewing self.searchCats = @[]; diff --git a/Commons-iOS/CommonsApp.h b/Commons-iOS/CommonsApp.h index 1b92266..98dde31 100644 --- a/Commons-iOS/CommonsApp.h +++ b/Commons-iOS/CommonsApp.h @@ -94,6 +94,8 @@ - (float)getStatusBarHeight; - (NSString *)getBackButtonString; +- (UIBarButtonItem *)getBackButtonItemWithTarget:(id)target action:(SEL)action; + - (void)roundCorners:(UIRectCorner)corners ofView:(UIView *)view toRadius:(float)radius; @end diff --git a/Commons-iOS/CommonsApp.m b/Commons-iOS/CommonsApp.m index 907c52d..316040a 100644 --- a/Commons-iOS/CommonsApp.m +++ b/Commons-iOS/CommonsApp.m @@ -1467,6 +1467,18 @@ return @"\U000025C0\U0000FE0E"; } +-(UIBarButtonItem *)getBackButtonItemWithTarget:(id)target action:(SEL)action +{ + UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:[self getBackButtonString] + style:UIBarButtonItemStyleBordered + target:target + action:action]; + + + [button setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + return button; +} + -(void)roundCorners:(UIRectCorner)corners ofView:(UIView *)view toRadius:(float)radius { // Use for rounding *specific* corners of a UIView. // Based on http://stackoverflow.com/a/5826745/135557 diff --git a/Commons-iOS/GalleryMultiSelectCollectionVC.m b/Commons-iOS/GalleryMultiSelectCollectionVC.m index f80a4d3..01fef2b 100644 --- a/Commons-iOS/GalleryMultiSelectCollectionVC.m +++ b/Commons-iOS/GalleryMultiSelectCollectionVC.m @@ -176,8 +176,7 @@ { UINavigationItem *thisItem = navBar_.items[0]; if (visible) { - NSString *backArrowStr = [[CommonsApp singleton] getBackButtonString]; - thisItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:backArrowStr style:UIBarButtonItemStylePlain target:self action:@selector(returnToAlbums)]; + thisItem.leftBarButtonItem = [[CommonsApp singleton] getBackButtonItemWithTarget:self action:@selector(returnToAlbums)]; thisItem.hidesBackButton = NO; }else{ thisItem.hidesBackButton = YES; diff --git a/Commons-iOS/ImageScrollViewController.m b/Commons-iOS/ImageScrollViewController.m index 974207c..feff553 100644 --- a/Commons-iOS/ImageScrollViewController.m +++ b/Commons-iOS/ImageScrollViewController.m @@ -113,10 +113,8 @@ self.wantsFullScreenLayout = YES; // Change back button to be an arrow - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[[CommonsApp singleton] getBackButtonString] - style:UIBarButtonItemStyleBordered - target:self - action:@selector(backButtonPressed:)]; + self.navigationItem.leftBarButtonItem = [[CommonsApp singleton] getBackButtonItemWithTarget:self action:@selector(backButtonPressed:)]; + [self setupOverlayView]; [self setupImageScrollingViews]; diff --git a/Commons-iOS/LoginViewController.m b/Commons-iOS/LoginViewController.m index 6601d66..50c4026 100644 --- a/Commons-iOS/LoginViewController.m +++ b/Commons-iOS/LoginViewController.m @@ -150,7 +150,6 @@ [self.logoutButton useWhiteStyle]; // l10n - self.navigationItem.title = [MWMessage forKey:@"login-title"].text; self.usernameField.placeholder = [MWMessage forKey:@"settings-username-placeholder"].text; self.passwordField.placeholder = [MWMessage forKey:@"settings-password-placeholder"].text; [self.loginButton setTitle:[MWMessage forKey:@"login-button"].text forState:UIControlStateNormal]; @@ -344,19 +343,6 @@ } -(void)viewWillDisappear:(BOOL)animated{ - - UIBarButtonItem *backButton = [[UIBarButtonItem alloc] - initWithTitle: [[CommonsApp singleton] getBackButtonString] - style: UIBarButtonItemStyleBordered - target:nil action: nil]; - - [backButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - [UIColor colorWithRed:1 green:1 blue:1 alpha:1], UITextAttributeTextColor, - [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 0.0f)], UITextAttributeTextShadowOffset, - nil] forState:UIControlStateNormal]; - - [self.navigationItem setBackBarButtonItem: backButton]; - [self.pictureOfDayCycler stop]; [super viewWillDisappear:animated]; diff --git a/Commons-iOS/MyUploadsViewController.m b/Commons-iOS/MyUploadsViewController.m index c3838fd..32f116f 100644 --- a/Commons-iOS/MyUploadsViewController.m +++ b/Commons-iOS/MyUploadsViewController.m @@ -43,15 +43,11 @@ UITapGestureRecognizer *imageDoubleTapRecognizer_; } -- (void)animateTakeAndChoosePhotoButtons; -- (void)refreshImages; -- (BOOL)isOpCellOnScreen:(FetchImageOperation *)op; -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context; -- (void)raiseDowloadPriorityForImagesOfOnscreenCells; - @end @implementation MyUploadsViewController + +#pragma mark - Init - (id)initWithCoder:(NSCoder *)coder { @@ -62,6 +58,8 @@ } return self; } + +#pragma mark - View lifecycle -(void)viewDidAppear:(BOOL)animated { @@ -166,25 +164,10 @@ self.automaticallyAdjustsScrollViewInsets = NO; } + // Change back button to be an arrow + self.navigationItem.leftBarButtonItem = [[CommonsApp singleton] getBackButtonItemWithTarget:self action:@selector(backButtonPressed:)]; + //[self.view randomlyColorSubviews]; -} - --(BOOL)hasCamera -{ - return [UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]; -} - --(void)reachabilityChange:(NSNotification*)note { - Reachability * reach = [note object]; - NetworkStatus netStatus = [reach currentReachabilityStatus]; - if (netStatus == ReachableViaWiFi || netStatus == ReachableViaWWAN) - { - self.uploadButton.enabled = [[CommonsApp singleton] firstUploadRecord] ? YES : NO;; - } - else if (netStatus == NotReachable) - { - self.uploadButton.enabled = NO; - } } - (void)viewWillAppear:(BOOL)animated { @@ -229,6 +212,31 @@ // Prevent the overlay message from flickering as the view disappears [self.welcomeOverlayView showMessage:WELCOME_MESSAGE_NONE]; } + + +#pragma mark - Camera + +-(BOOL)hasCamera +{ + return [UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]; +} + +#pragma mark - Reachability + +-(void)reachabilityChange:(NSNotification*)note { + Reachability * reach = [note object]; + NetworkStatus netStatus = [reach currentReachabilityStatus]; + if (netStatus == ReachableViaWiFi || netStatus == ReachableViaWWAN) + { + self.uploadButton.enabled = [[CommonsApp singleton] firstUploadRecord] ? YES : NO;; + } + else if (netStatus == NotReachable) + { + self.uploadButton.enabled = NO; + } +} + +#pragma mark - Memory - (void)didReceiveMemoryWarning { @@ -400,6 +408,11 @@ } #pragma mark - Interface Actions + +-(void)backButtonPressed:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} - (IBAction)uploadButtonPushed:(id)sender { @@ -1125,23 +1138,7 @@ #pragma mark Details segue methods - (void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender -{ - /* - if ([segue.identifier isEqualToString:@"DetailSegue"]) { - DetailTableViewController *detailVC = [segue destinationViewController]; - detailVC.selectedRecord = self.selectedRecord; - - // Change back button to be arrow - self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[[CommonsApp singleton] getBackButtonString] style:UIBarButtonItemStyleBordered target:self action:nil]; - - // Make the table view's background transparent - UIView *backView = [[UIView alloc] initWithFrame:CGRectZero]; - backView.backgroundColor = [UIColor clearColor]; - detailVC.tableView.backgroundView = backView; - } - return; - */ - +{ if ([segue.identifier isEqualToString:@"OpenImageSegue"]) { if (self.selectedRecord) { @@ -1215,7 +1212,9 @@ target:detailVC_ action:@selector(deleteButtonPushed:)]; - + // Remove the outline around the trash can icon on iOS 6 + [deleteButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + UIBarButtonItem *spacerItemFlexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; diff --git a/Commons-iOS/SettingsViewController.m b/Commons-iOS/SettingsViewController.m index 6d07b94..3c3635e 100644 --- a/Commons-iOS/SettingsViewController.m +++ b/Commons-iOS/SettingsViewController.m @@ -204,6 +204,9 @@ self.scrollView.delegate = self; + // Change back button to be an arrow + self.navigationItem.leftBarButtonItem = [[CommonsApp singleton] getBackButtonItemWithTarget:self action:@selector(backButtonPressed:)]; + //[self.view randomlyColorSubviews]; } @@ -232,6 +235,13 @@ [myUploadsViewController.collectionView.collectionViewLayout invalidateLayout]; } +#pragma mark - Back button + +-(void)backButtonPressed:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} + #pragma mark - Gestures -(void)addTapGestureRecognizersToButtons diff --git a/Commons-iOS/clear.png b/Commons-iOS/clear.png new file mode 100644 index 0000000..1074531 --- /dev/null +++ b/Commons-iOS/clear.png Binary files differ -- To view, visit https://gerrit.wikimedia.org/r/88170 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0d76c2f223694c82840c7d2aacbf053330a297bc Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/commons Gerrit-Branch: master Gerrit-Owner: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Mhurd <mh...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits