[MediaWiki-commits] [Gerrit] Prework for Save Button - change (apps...wikipedia)

2015-06-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Prework for Save Button
..


Prework for Save Button

Bug 103888
Add ability for button type to be applied to button created in IB
Rename enum (Boyscout while implementing)

Change-Id: Ief53e35d67eb591d6627d671f1c71bd9c1234562
---
M Wikipedia/UI-V5/UIButton+WMFButton.h
M Wikipedia/UI-V5/UIButton+WMFButton.m
M Wikipedia/View Controllers/About/AboutViewController.m
M Wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m
M Wikipedia/View Controllers/EditSummary/EditSummaryViewController.m
M Wikipedia/View Controllers/History/HistoryViewController.m
M Wikipedia/View Controllers/Languages/LanguagesViewController.m
M Wikipedia/View Controllers/Login/LoginViewController.m
M Wikipedia/View Controllers/Navigation/Primary/PrimaryMenuViewController.m
M Wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m
M Wikipedia/View Controllers/Nearby/NearbyViewController.m
M Wikipedia/View Controllers/PageHistory/PageHistoryViewController.m
M Wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
M Wikipedia/View Controllers/SavedPages/SavedPagesViewController.m
M Wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m
M Wikipedia/View Controllers/WebView/WebViewController.m
16 files changed, 114 insertions(+), 109 deletions(-)

Approvals:
  Mhurd: Looks good to me, approved
  Bgerstle: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/Wikipedia/UI-V5/UIButton+WMFButton.h 
b/Wikipedia/UI-V5/UIButton+WMFButton.h
index 5a0d29e..634f9e7 100644
--- a/Wikipedia/UI-V5/UIButton+WMFButton.h
+++ b/Wikipedia/UI-V5/UIButton+WMFButton.h
@@ -4,19 +4,19 @@
 #import 
 
 typedef NS_ENUM (NSInteger, WMFButtonType) {
-WMF_BUTTON_W,
-WMF_BUTTON_SHARE,
-WMF_BUTTON_FORWARD,
-WMF_BUTTON_BACKWARD,
-WMF_BUTTON_HEART,
-WMF_BUTTON_TOC,
-WMF_BUTTON_X,
-WMF_BUTTON_X_WHITE,
-WMF_BUTTON_TRASH,
-WMF_BUTTON_TRANSLATE,
-WMF_BUTTON_MAGNIFY,
-WMF_BUTTON_RELOAD,
-WMF_BUTTON_CARET_LEFT
+WMFButtonTypeW,
+WMFButtonTypeShare,
+WMFButtonTypeForward,
+WMFButtonTypeBackward,
+WMFButtonTypeHeart,
+WMFButtonTypeTableOfContents,
+WMFButtonTypeX,
+WMFButtonTypeXWhite,
+WMFButtonTypeTrash,
+WMFButtonTypeTranslate,
+WMFButtonTypeMagnify,
+WMFButtonTypeReload,
+WMFButtonTypeCaretLeft
 };
 
 @interface UIButton (WMFGlyph)
@@ -24,4 +24,6 @@
 + (UIButton*)wmf_buttonType:(WMFButtonType)type
 handler:(void (^)(id sender))action;
 
+- (void)wmf_setButtonType:(WMFButtonType)type;
+
 @end
\ No newline at end of file
diff --git a/Wikipedia/UI-V5/UIButton+WMFButton.m 
b/Wikipedia/UI-V5/UIButton+WMFButton.m
index a510cc6..1bdc3f4 100644
--- a/Wikipedia/UI-V5/UIButton+WMFButton.m
+++ b/Wikipedia/UI-V5/UIButton+WMFButton.m
@@ -12,67 +12,9 @@
 
 + (UIButton*)wmf_buttonType:(WMFButtonType)type handler:(void (^)(id 
sender))action {
 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
-
 button.frame = (CGRect){{0, 0}, {40, 40}};
 
-void (^ configForState)(UIControlState, WMFGlyphs, NSNumber*, UIColor*) = 
^void (UIControlState state, WMFGlyphs glyph, NSNumber* offset, UIColor* color) 
{
-[button setAttributedTitle:[self attributedStringForGlyph:glyph 
baselineOffset:offset color:color]
-  forState:state];
-};
-
-switch (type) {
-case WMF_BUTTON_W:
-configForState(UIControlStateNormal, WMF_GLYPH_W, @(2.0), nil);
-break;
-case WMF_BUTTON_SHARE:
-configForState(UIControlStateNormal, WMF_GLYPH_SHARE, @(0.2), nil);
-break;
-case WMF_BUTTON_FORWARD:
-configForState(UIControlStateNormal, WMF_GLYPH_FORWARD, nil, nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_FORWARD, nil, 
[UIColor lightGrayColor]);
-break;
-case WMF_BUTTON_BACKWARD:
-configForState(UIControlStateNormal, WMF_GLYPH_BACKWARD, nil, nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_BACKWARD, nil, 
[UIColor lightGrayColor]);
-break;
-case WMF_BUTTON_HEART:
-configForState(UIControlStateNormal, WMF_GLYPH_HEART_OUTLINE, nil, 
nil);
-configForState(UIControlStateSelected, WMF_GLYPH_HEART, nil, 
[UIColor redColor]);
-break;
-case WMF_BUTTON_TOC:
-configForState(UIControlStateNormal, WMF_GLYPH_TOC_COLLAPSED, 
@(2.0), nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_TOC_COLLAPSED, 
@(2.0), [UIColor lightGrayColor]);
-configForState(UIControlStateSelected, WMF_GLYPH_TOC_EXPANDED, 
@(2.0), nil);
-break;
-case WMF_BUTTON_X:
-configForState(UIControlStateNormal, WMF_GLYPH_X, @(2.8), nil);
-break;
-case WMF_

[MediaWiki-commits] [Gerrit] Prework for Save Button - change (apps...wikipedia)

2015-06-25 Thread Fjalapeno (Code Review)
Fjalapeno has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/220961

Change subject: Prework for Save Button
..

Prework for Save Button

Bug 103888
Add ability for button type to be applied to button created in IB
Rename enum (Boyscout while implementing)

Change-Id: Ief53e35d67eb591d6627d671f1c71bd9c1234562
---
M Wikipedia/UI-V5/UIButton+WMFButton.h
M Wikipedia/UI-V5/UIButton+WMFButton.m
M Wikipedia/View Controllers/About/AboutViewController.m
M Wikipedia/View Controllers/AccountCreation/AccountCreationViewController.m
M Wikipedia/View Controllers/EditSummary/EditSummaryViewController.m
M Wikipedia/View Controllers/History/HistoryViewController.m
M Wikipedia/View Controllers/Languages/LanguagesViewController.m
M Wikipedia/View Controllers/Login/LoginViewController.m
M Wikipedia/View Controllers/Navigation/Primary/PrimaryMenuViewController.m
M Wikipedia/View Controllers/Navigation/Secondary/SecondaryMenuViewController.m
M Wikipedia/View Controllers/Nearby/NearbyViewController.m
M Wikipedia/View Controllers/PageHistory/PageHistoryViewController.m
M Wikipedia/View Controllers/Preview/PreviewAndSaveViewController.m
M Wikipedia/View Controllers/SavedPages/SavedPagesViewController.m
M Wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m
M Wikipedia/View Controllers/WebView/WebViewController.m
16 files changed, 114 insertions(+), 108 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/61/220961/1

diff --git a/Wikipedia/UI-V5/UIButton+WMFButton.h 
b/Wikipedia/UI-V5/UIButton+WMFButton.h
index 5a0d29e..634f9e7 100644
--- a/Wikipedia/UI-V5/UIButton+WMFButton.h
+++ b/Wikipedia/UI-V5/UIButton+WMFButton.h
@@ -4,19 +4,19 @@
 #import 
 
 typedef NS_ENUM (NSInteger, WMFButtonType) {
-WMF_BUTTON_W,
-WMF_BUTTON_SHARE,
-WMF_BUTTON_FORWARD,
-WMF_BUTTON_BACKWARD,
-WMF_BUTTON_HEART,
-WMF_BUTTON_TOC,
-WMF_BUTTON_X,
-WMF_BUTTON_X_WHITE,
-WMF_BUTTON_TRASH,
-WMF_BUTTON_TRANSLATE,
-WMF_BUTTON_MAGNIFY,
-WMF_BUTTON_RELOAD,
-WMF_BUTTON_CARET_LEFT
+WMFButtonTypeW,
+WMFButtonTypeShare,
+WMFButtonTypeForward,
+WMFButtonTypeBackward,
+WMFButtonTypeHeart,
+WMFButtonTypeTableOfContents,
+WMFButtonTypeX,
+WMFButtonTypeXWhite,
+WMFButtonTypeTrash,
+WMFButtonTypeTranslate,
+WMFButtonTypeMagnify,
+WMFButtonTypeReload,
+WMFButtonTypeCaretLeft
 };
 
 @interface UIButton (WMFGlyph)
@@ -24,4 +24,6 @@
 + (UIButton*)wmf_buttonType:(WMFButtonType)type
 handler:(void (^)(id sender))action;
 
+- (void)wmf_setButtonType:(WMFButtonType)type;
+
 @end
\ No newline at end of file
diff --git a/Wikipedia/UI-V5/UIButton+WMFButton.m 
b/Wikipedia/UI-V5/UIButton+WMFButton.m
index a510cc6..5c496ca 100644
--- a/Wikipedia/UI-V5/UIButton+WMFButton.m
+++ b/Wikipedia/UI-V5/UIButton+WMFButton.m
@@ -15,64 +15,7 @@
 
 button.frame = (CGRect){{0, 0}, {40, 40}};
 
-void (^ configForState)(UIControlState, WMFGlyphs, NSNumber*, UIColor*) = 
^void (UIControlState state, WMFGlyphs glyph, NSNumber* offset, UIColor* color) 
{
-[button setAttributedTitle:[self attributedStringForGlyph:glyph 
baselineOffset:offset color:color]
-  forState:state];
-};
-
-switch (type) {
-case WMF_BUTTON_W:
-configForState(UIControlStateNormal, WMF_GLYPH_W, @(2.0), nil);
-break;
-case WMF_BUTTON_SHARE:
-configForState(UIControlStateNormal, WMF_GLYPH_SHARE, @(0.2), nil);
-break;
-case WMF_BUTTON_FORWARD:
-configForState(UIControlStateNormal, WMF_GLYPH_FORWARD, nil, nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_FORWARD, nil, 
[UIColor lightGrayColor]);
-break;
-case WMF_BUTTON_BACKWARD:
-configForState(UIControlStateNormal, WMF_GLYPH_BACKWARD, nil, nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_BACKWARD, nil, 
[UIColor lightGrayColor]);
-break;
-case WMF_BUTTON_HEART:
-configForState(UIControlStateNormal, WMF_GLYPH_HEART_OUTLINE, nil, 
nil);
-configForState(UIControlStateSelected, WMF_GLYPH_HEART, nil, 
[UIColor redColor]);
-break;
-case WMF_BUTTON_TOC:
-configForState(UIControlStateNormal, WMF_GLYPH_TOC_COLLAPSED, 
@(2.0), nil);
-configForState(UIControlStateDisabled, WMF_GLYPH_TOC_COLLAPSED, 
@(2.0), [UIColor lightGrayColor]);
-configForState(UIControlStateSelected, WMF_GLYPH_TOC_EXPANDED, 
@(2.0), nil);
-break;
-case WMF_BUTTON_X:
-configForState(UIControlStateNormal, WMF_GLYPH_X, @(2.8), nil);
-break;
-case WMF_BUTTON_X_WHITE:
-configForState(UIControlStateNormal, WMF_GLYPH_X, @(2.8), [UIColor 
whiteColor]);
-break;
-case WMF_BUTTON_TRASH:
-