Brion VIBBER has submitted this change and it was merged. Change subject: Made login use back arrow if presented in editing workflow. ......................................................................
Made login use back arrow if presented in editing workflow. Account creation uses back arrow if presented in login workflow. Save and login workflows now use new check button styling from mockups. Change-Id: I9e404f68c3754926d38cb860ecd2fd7b9a3d3f74 --- M wikipedia/MenuLabel/MenuLabel.m M wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m M wikipedia/View Controllers/Login/LoginViewController.m M wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m M wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m M wikipedia/View Controllers/WebView/WebViewController.m 6 files changed, 62 insertions(+), 31 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/wikipedia/MenuLabel/MenuLabel.m b/wikipedia/MenuLabel/MenuLabel.m index e008d52..1c41045 100755 --- a/wikipedia/MenuLabel/MenuLabel.m +++ b/wikipedia/MenuLabel/MenuLabel.m @@ -2,6 +2,7 @@ // Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license; please copy and modify! #import "MenuLabel.h" +#import "WikiGlyph_Chars.h" @interface MenuLabel () @@ -64,12 +65,24 @@ -(void)setText:(NSString *)text { UIFont *font = (self.fontBold) ? [UIFont boldSystemFontOfSize:self.fontSize] : [UIFont systemFontOfSize:self.fontSize]; - NSDictionary *attributes = + + NSMutableDictionary *attributes = @{ NSFontAttributeName: font, NSForegroundColorAttributeName : self.color - }; - + }.mutableCopy; + + // Quick hack to allow WikiGlyph check character buttons. + // (Would be nice to have a "isWikiGlyph" function which would determine if a + // single character string was a WikiGlyph rather than using isEqualToString.) + if ([text isEqualToString:WIKIGLYPH_TICK]) { + self.adjustsFontSizeToFitWidth = NO; + attributes[NSFontAttributeName] = [UIFont fontWithName:@"WikiFont-Glyphs" size:self.fontSize]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.alignment = NSTextAlignmentCenter; + attributes[NSParagraphStyleAttributeName] = paragraphStyle; + } + self.attributedText = [[NSAttributedString alloc] initWithString: text attributes: attributes]; diff --git a/wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m b/wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m index 718eb99..6c1dea2 100644 --- a/wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m +++ b/wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m @@ -115,10 +115,7 @@ -(void)highlightCheckButton:(BOOL)highlight { WikiGlyphButton *checkButton = (WikiGlyphButton *)[ROOT.topMenuViewController getNavBarItem:NAVBAR_BUTTON_CHECK]; - - checkButton.backgroundColor = highlight ? WMF_COLOR_BLUE : [UIColor clearColor]; - - checkButton.color = highlight ? [UIColor whiteColor] : [UIColor blackColor]; + checkButton.enabled = highlight; } -(void)prepopulateTextFieldsForDebugging @@ -137,6 +134,8 @@ ROOT.topMenuViewController.navBarMode = NAVBAR_MODE_DEFAULT; [self highlightCheckButton:NO]; + + [self showAlert:@""]; [super viewWillDisappear:animated]; } @@ -251,6 +250,7 @@ case NAVBAR_BUTTON_CHECK: [self save]; break; + case NAVBAR_BUTTON_X: case NAVBAR_BUTTON_ARROW_LEFT: [self hide]; break; diff --git a/wikipedia/View Controllers/Login/LoginViewController.m b/wikipedia/View Controllers/Login/LoginViewController.m index b25620a..cc123b9 100644 --- a/wikipedia/View Controllers/Login/LoginViewController.m +++ b/wikipedia/View Controllers/Login/LoginViewController.m @@ -79,10 +79,7 @@ -(void)highlightCheckButton:(BOOL)highlight { WikiGlyphButton *checkButton = (WikiGlyphButton *)[ROOT.topMenuViewController getNavBarItem:NAVBAR_BUTTON_CHECK]; - - checkButton.backgroundColor = highlight ? WMF_COLOR_GREEN : [UIColor clearColor]; - - checkButton.color = highlight ? [UIColor whiteColor] : [UIColor blackColor]; + checkButton.enabled = highlight; } // Handle nav bar taps. diff --git a/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m b/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m index 1fac254..defc03e 100644 --- a/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m +++ b/wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m @@ -36,6 +36,7 @@ #import "UIViewController+StatusBarHeight.h" #import "MenuButton.h" +#import "LoginViewController.h" @interface TopMenuViewController (){ @@ -46,7 +47,6 @@ @property (strong, nonatomic) WikiGlyphButton *buttonW; @property (strong, nonatomic) WikiGlyphButton *buttonTOC; @property (strong, nonatomic) WikiGlyphButton *buttonPencil; -@property (strong, nonatomic) WikiGlyphButton *buttonCheck; @property (strong, nonatomic) WikiGlyphButton *buttonX; @property (strong, nonatomic) WikiGlyphButton *buttonEye; @property (strong, nonatomic) WikiGlyphButton *buttonArrowLeft; @@ -58,6 +58,7 @@ @property (strong, nonatomic) MenuButton *buttonNext; @property (strong, nonatomic) MenuButton *buttonSave; @property (strong, nonatomic) MenuButton *buttonDone; +@property (strong, nonatomic) MenuButton *buttonCheck; @property (strong, nonatomic) UILabel *label; @@ -246,7 +247,6 @@ CGFloat baselineOffset = 2.0; self.buttonPencil = getWikiGlyphButton(WIKIGLYPH_PENCIL, NAVBAR_BUTTON_PENCIL, size, baselineOffset); - self.buttonCheck = getWikiGlyphButton(WIKIGLYPH_TICK, NAVBAR_BUTTON_CHECK, size, baselineOffset); self.buttonX = getWikiGlyphButton(WIKIGLYPH_X, NAVBAR_BUTTON_X, size - 4, baselineOffset - 0.5); self.buttonEye = getWikiGlyphButton(WIKIGLYPH_EYE, NAVBAR_BUTTON_EYE, size, baselineOffset); self.buttonArrowLeft = getWikiGlyphButton(WIKIGLYPH_CARET_LEFT, NAVBAR_BUTTON_ARROW_LEFT, size, baselineOffset - 2.0); @@ -260,15 +260,15 @@ self.buttonCancel.label.font = [UIFont systemFontOfSize:17.0]; self.buttonCancel.label.text = MWLocalizedString(@"search-cancel", nil); - MenuButton *(^getMenuButton)(NSString *, NavBarItemTag, CGFloat, UIColor *) = - ^MenuButton *(NSString *string, NavBarItemTag tag, CGFloat size, UIColor *color) { + MenuButton *(^getMenuButton)(NSString *, NavBarItemTag, CGFloat, UIColor *, UIEdgeInsets, UIEdgeInsets) = + ^MenuButton *(NSString *string, NavBarItemTag tag, CGFloat size, UIColor *color, UIEdgeInsets padding, UIEdgeInsets margin) { MenuButton *button = [[MenuButton alloc] initWithText: string fontSize: size bold: YES color: color - padding: UIEdgeInsetsMake(0, 16, 0, 16) - margin: UIEdgeInsetsMake(8, 9, 7, 10)]; + padding: padding + margin: margin]; [button addGestureRecognizer: [[UITapGestureRecognizer alloc] initWithTarget: self @@ -280,13 +280,17 @@ UIColor *blueColor = [UIColor colorWithRed:0.03 green:0.48 blue:0.92 alpha:1.0]; UIColor *greenColor = [UIColor colorWithRed:0.08 green:0.64 blue:0.46 alpha:1.0]; + UIEdgeInsets padding = UIEdgeInsetsMake(0, 16, 0, 16); + UIEdgeInsets margin = UIEdgeInsetsMake(8, 9, 7, 10); self.buttonNext = - getMenuButton(MWLocalizedString(@"button-next", nil), NAVBAR_BUTTON_NEXT, 14, blueColor); + getMenuButton(MWLocalizedString(@"button-next", nil), NAVBAR_BUTTON_NEXT, 14, blueColor, padding, margin); self.buttonSave = - getMenuButton(MWLocalizedString(@"button-save", nil), NAVBAR_BUTTON_SAVE, 14, greenColor); + getMenuButton(MWLocalizedString(@"button-save", nil), NAVBAR_BUTTON_SAVE, 14, greenColor, padding, margin); self.buttonDone = - getMenuButton(MWLocalizedString(@"button-done", nil), NAVBAR_BUTTON_DONE, 14, blueColor); + getMenuButton(MWLocalizedString(@"button-done", nil), NAVBAR_BUTTON_DONE, 14, blueColor, padding, margin); + self.buttonCheck = + getMenuButton(WIKIGLYPH_TICK, NAVBAR_BUTTON_CHECK, 25, blueColor, UIEdgeInsetsMake(0, 0, 2, 0), UIEdgeInsetsMake(9, 0, 9, 8)); // Ensure the cancel button content is hugged more tightly than the search text box. // Otherwise on iOS 6 the cancel button is super wide. @@ -321,7 +325,7 @@ self.label.text = @""; self.label.translatesAutoresizingMaskIntoConstraints = NO; self.label.tag = NAVBAR_LABEL; - self.label.font = [UIFont systemFontOfSize:21.0]; + self.label.font = [UIFont systemFontOfSize:19.0]; self.label.textAlignment = NSTextAlignmentCenter; self.label.adjustsFontSizeToFitWidth = YES; @@ -391,6 +395,7 @@ _navBarMode = navBarMode; PreviewAndSaveViewController *previewAndSaveVC = [NAV searchNavStackForViewControllerOfClass:[PreviewAndSaveViewController class]]; + LoginViewController *loginVC = [NAV searchNavStackForViewControllerOfClass:[LoginViewController class]]; switch (navBarMode) { case NAVBAR_MODE_EDIT_WIKITEXT: @@ -399,13 +404,15 @@ @"H:|-(4)-[NAVBAR_BUTTON_ARROW_LEFT(50)]-(10)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_NEXT(50@250)]|"; break; case NAVBAR_MODE_LOGIN: - self.label.text = (!previewAndSaveVC) ? - MWLocalizedString(@"navbar-title-mode-login", nil) - : - MWLocalizedString(@"navbar-title-mode-login-and-save", nil) - ; - self.navBarSubViewsHorizontalVFLString = - @"H:|[NAVBAR_BUTTON_X(50)]-(10)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(50)]|"; + if(!previewAndSaveVC){ + self.label.text = MWLocalizedString(@"navbar-title-mode-login", nil); + self.navBarSubViewsHorizontalVFLString = + @"H:|-(4)-[NAVBAR_BUTTON_X(50)]-(16)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(60)]|"; + }else{ + self.label.text = MWLocalizedString(@"navbar-title-mode-login-and-save", nil); + self.navBarSubViewsHorizontalVFLString = + @"H:|-(4)-[NAVBAR_BUTTON_ARROW_LEFT(50)]-(16)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(60)]|"; + } break; case NAVBAR_MODE_EDIT_WIKITEXT_SAVE: self.label.text = MWLocalizedString(@"navbar-title-mode-edit-wikitext-save", nil); @@ -418,13 +425,19 @@ : MWLocalizedString(@"navbar-title-mode-create-account-and-save", nil) ; - self.navBarSubViewsHorizontalVFLString = - @"H:|[NAVBAR_BUTTON_ARROW_LEFT(50)]-(10)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(50)]|"; + if(loginVC){ + self.navBarSubViewsHorizontalVFLString = + @"H:|-(4)-[NAVBAR_BUTTON_ARROW_LEFT(50)]-(16)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(60)]|"; + }else{ + self.navBarSubViewsHorizontalVFLString = + @"H:|-(4)-[NAVBAR_BUTTON_X(50)]-(16)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(60)]|"; + } + break; case NAVBAR_MODE_EDIT_WIKITEXT_WARNING: self.label.text = MWLocalizedString(@"navbar-title-mode-edit-wikitext-warning", nil); self.navBarSubViewsHorizontalVFLString = - @"H:|-(4)-[NAVBAR_BUTTON_X(50)]-(10)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(50)]|"; + @"H:|-(4)-[NAVBAR_BUTTON_X(50)]-(16)-[NAVBAR_LABEL]-(10)-[NAVBAR_BUTTON_CHECK(60)]|"; break; case NAVBAR_MODE_EDIT_WIKITEXT_DISALLOW: self.label.text = MWLocalizedString(@"navbar-title-mode-edit-wikitext-disallow", nil); diff --git a/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m b/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m index 1995921..e402651 100644 --- a/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m +++ b/wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m @@ -111,6 +111,7 @@ UIView *tappedItem = userInfo[@"tappedItem"]; switch (tappedItem.tag) { + case NAVBAR_BUTTON_X: case NAVBAR_BUTTON_ARROW_LEFT: [ROOT popViewControllerAnimated:YES]; diff --git a/wikipedia/View Controllers/WebView/WebViewController.m b/wikipedia/View Controllers/WebView/WebViewController.m index c857519..8c8fda9 100644 --- a/wikipedia/View Controllers/WebView/WebViewController.m +++ b/wikipedia/View Controllers/WebView/WebViewController.m @@ -54,6 +54,7 @@ #import "CoreDataHousekeeping.h" #import "Article+Convenience.h" #import "NSDate-Utilities.h" +//#import "AccountCreationViewController.h" #define TOC_TOGGLE_ANIMATION_DURATION @0.3f @@ -1040,6 +1041,12 @@ { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. + + /* + AccountCreationViewController *createAcctVC = [self.navigationController.storyboard instantiateViewControllerWithIdentifier:@"AccountCreationViewController"]; + + [ROOT pushViewController:createAcctVC animated:YES]; + */ //CoreDataHousekeeping *imageHousekeeping = [[CoreDataHousekeeping alloc] init]; //[imageHousekeeping performHouseKeeping]; -- To view, visit https://gerrit.wikimedia.org/r/140941 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9e404f68c3754926d38cb860ecd2fd7b9a3d3f74 Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Mhurd <mh...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits