Brion VIBBER has submitted this change and it was merged.
Change subject: Interacting with edit summary interface causes nav bar text to
change.
......................................................................
Interacting with edit summary interface causes nav bar text to change.
Made nav bar say "Describe your edit" when edit summary interface is
dragged or moved above its docking position at the bottom of the screen.
Change-Id: I36273be9ae8431a299ffc443767ce37417d13bdd
---
M Wikipedia-iOS/Base.lproj/Main_iPhone.storyboard
M Wikipedia-iOS/View Controllers/EditSummary/EditSummaryViewController.m
M Wikipedia-iOS/View Controllers/SectionEditor/SectionEditorViewController.m
M Wikipedia-iOS/View Controllers/TopNav/NavController.h
M Wikipedia-iOS/View Controllers/TopNav/NavController.m
M Wikipedia-iOS/en.lproj/Localizable.strings
M Wikipedia-iOS/qqq.lproj/Localizable.strings
7 files changed, 72 insertions(+), 17 deletions(-)
Approvals:
Brion VIBBER: Verified; Looks good to me, approved
diff --git a/Wikipedia-iOS/Base.lproj/Main_iPhone.storyboard
b/Wikipedia-iOS/Base.lproj/Main_iPhone.storyboard
index f2c36bc..26eb00f 100644
--- a/Wikipedia-iOS/Base.lproj/Main_iPhone.storyboard
+++ b/Wikipedia-iOS/Base.lproj/Main_iPhone.storyboard
@@ -533,7 +533,7 @@
<autoresizingMask key="autoresizingMask"
flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textView clipsSubviews="YES"
multipleTouchEnabled="YES" contentMode="scaleToFill"
translatesAutoresizingMaskIntoConstraints="NO" id="ohj-LA-82c">
- <rect key="frame" x="5" y="5" width="310"
height="563"/>
+ <rect key="frame" x="5" y="0.0" width="310"
height="568"/>
<autoresizingMask key="autoresizingMask"
widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1"
alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription"
name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
@@ -543,7 +543,7 @@
<color key="backgroundColor" white="1" alpha="1"
colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="ohj-LA-82c"
firstAttribute="leading" secondItem="Cex-zA-X93" secondAttribute="leading"
constant="5" id="GW3-Ua-a8X"/>
- <constraint firstItem="ohj-LA-82c"
firstAttribute="top" secondItem="Cex-zA-X93" secondAttribute="top" constant="5"
id="NPC-TM-Xq1"/>
+ <constraint firstItem="ohj-LA-82c"
firstAttribute="top" secondItem="Cex-zA-X93" secondAttribute="top"
id="NPC-TM-Xq1"/>
<constraint firstAttribute="trailing"
secondItem="ohj-LA-82c" secondAttribute="trailing" constant="5"
id="aPb-dZ-HOe"/>
<constraint firstAttribute="bottom"
secondItem="ohj-LA-82c" secondAttribute="bottom" id="eMa-8O-6mo"/>
</constraints>
@@ -569,7 +569,7 @@
<rect key="frame" x="0.0" y="0.0" width="320"
height="568"/>
<autoresizingMask key="autoresizingMask"
flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
- <webView clearsContextBeforeDrawing="NO"
contentMode="scaleToFill" allowsInlineMediaPlayback="NO"
mediaPlaybackAllowsAirPlay="NO" translatesAutoresizingMaskIntoConstraints="NO"
id="EhD-15-Yw7" customClass="PreviewWebView">
+ <webView opaque="NO"
clearsContextBeforeDrawing="NO" contentMode="scaleToFill"
allowsInlineMediaPlayback="NO" mediaPlaybackAllowsAirPlay="NO"
translatesAutoresizingMaskIntoConstraints="NO" id="EhD-15-Yw7"
customClass="PreviewWebView">
<rect key="frame" x="0.0" y="0.0" width="320"
height="463"/>
<autoresizingMask key="autoresizingMask"
flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1"
blue="1" alpha="1" colorSpace="calibratedRGB"/>
diff --git a/Wikipedia-iOS/View
Controllers/EditSummary/EditSummaryViewController.m b/Wikipedia-iOS/View
Controllers/EditSummary/EditSummaryViewController.m
index b8abcd1..873e57f 100644
--- a/Wikipedia-iOS/View Controllers/EditSummary/EditSummaryViewController.m
+++ b/Wikipedia-iOS/View Controllers/EditSummary/EditSummaryViewController.m
@@ -1,7 +1,9 @@
// Created by Monte Hurd on 3/10/14.
#import "EditSummaryViewController.h"
+#import "NavController.h"
+#define NAV ((NavController *)self.navigationController)
#define DOCK_DISTANCE_FROM_BOTTOM 68.0f
#define MAX_SUMMARY_LENGTH 255
@@ -118,9 +120,14 @@
if (recognizer.state == UIGestureRecognizerStateChanged)
{
CGPoint translate = [recognizer
translationInView:recognizer.view.superview];
- CGFloat newHeight = originalHeight + translate.y;
- self.topConstraint.constant = newHeight;
+ CGFloat newYOffset = originalHeight + translate.y;
+
+ newYOffset = fminf(newYOffset, [self getDockingYOffset]);
+
+ self.topConstraint.constant = newYOffset;
[self.view setNeedsUpdateConstraints];
+
+ [self updateNavBar];
}
if (recognizer.state == UIGestureRecognizerStateEnded ||
@@ -130,9 +137,28 @@
}
}
+-(void)updateNavBar
+{
+ NavBarMode newNavBarMode = ([self isDockedAtBottom])
+ ? NAVBAR_MODE_EDIT_WIKITEXT_PREVIEW
+ : NAVBAR_MODE_EDIT_WIKITEXT_SUMMARY;
+ if(NAV.navBarMode != newNavBarMode) NAV.navBarMode = newNavBarMode;
+}
+
+-(BOOL)isDockedAtBottom
+{
+ return (self.topConstraint.constant == ([self getDockingYOffset])) ? YES :
NO;
+}
+
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self dockAtLocation:DOCK_TOP];
+}
+
+-(void)viewWillDisappear:(BOOL)animated
+{
+ [self.summaryTextField resignFirstResponder];
+ [super viewWillDisappear:animated];
}
// From: http://stackoverflow.com/a/1773257
@@ -155,7 +181,7 @@
self.topConstraint.constant = 0.0;
break;
case DOCK_BOTTOM:
- self.topConstraint.constant =
self.parentViewController.view.frame.size.height - DOCK_DISTANCE_FROM_BOTTOM;
+ self.topConstraint.constant = [self
getDockingYOffset];
break;
default:
break;
@@ -163,11 +189,17 @@
[self.parentViewController.view layoutIfNeeded];
} completion:^(BOOL done){
}];
+ [self updateNavBar];
+}
+
+-(CGFloat)getDockingYOffset
+{
+ return self.parentViewController.view.frame.size.height -
DOCK_DISTANCE_FROM_BOTTOM;
}
-(void)updateViewConstraints
{
- CGFloat initialDistanceFromTop =
self.parentViewController.view.frame.size.height - DOCK_DISTANCE_FROM_BOTTOM;
+ CGFloat initialDistanceFromTop = [self getDockingYOffset];
if (!self.topConstraint) {
self.topConstraint = [NSLayoutConstraint constraintWithItem: self.view
@@ -200,7 +232,7 @@
// Ensure edit summary isn't scrolled past its vertical limits after
rotate.
[self.view setNeedsUpdateConstraints];
- //[self dockAtLocation:DOCK_BOTTOM];
+ [self dockAtLocation:DOCK_BOTTOM];
}
- (void)didReceiveMemoryWarning
diff --git a/Wikipedia-iOS/View
Controllers/SectionEditor/SectionEditorViewController.m b/Wikipedia-iOS/View
Controllers/SectionEditor/SectionEditorViewController.m
index b5ac698..48e8578 100644
--- a/Wikipedia-iOS/View Controllers/SectionEditor/SectionEditorViewController.m
+++ b/Wikipedia-iOS/View Controllers/SectionEditor/SectionEditorViewController.m
@@ -43,9 +43,6 @@
[self loadLatestWikiTextForSectionFromServer];
- // Change the nav bar layout.
- NAV.navBarMode = NAVBAR_MODE_EDIT_WIKITEXT;
-
if ([self.editTextView respondsToSelector:@selector(keyboardDismissMode)])
{
self.editTextView.keyboardDismissMode =
UIScrollViewKeyboardDismissModeInteractive;
}
@@ -99,6 +96,14 @@
}
}
+-(void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ // Change the nav bar layout.
+ NAV.navBarMode = NAVBAR_MODE_EDIT_WIKITEXT;
+}
+
-(void)viewWillDisappear:(BOOL)animated
{
[self setScrollsToTop:NO];
diff --git a/Wikipedia-iOS/View Controllers/TopNav/NavController.h
b/Wikipedia-iOS/View Controllers/TopNav/NavController.h
index 021ebb7..acebb1e 100644
--- a/Wikipedia-iOS/View Controllers/TopNav/NavController.h
+++ b/Wikipedia-iOS/View Controllers/TopNav/NavController.h
@@ -21,7 +21,8 @@
NAVBAR_MODE_LOGIN = 4,
NAVBAR_MODE_CREATE_ACCOUNT = 5,
NAVBAR_MODE_EDIT_WIKITEXT_PREVIEW = 6,
- NAVBAR_MODE_EDIT_WIKITEXT_CAPTCHA = 7
+ NAVBAR_MODE_EDIT_WIKITEXT_CAPTCHA = 7,
+ NAVBAR_MODE_EDIT_WIKITEXT_SUMMARY = 8
} NavBarMode;
typedef enum {
diff --git a/Wikipedia-iOS/View Controllers/TopNav/NavController.m
b/Wikipedia-iOS/View Controllers/TopNav/NavController.m
index 983b0eb..8bdb608 100644
--- a/Wikipedia-iOS/View Controllers/TopNav/NavController.m
+++ b/Wikipedia-iOS/View Controllers/TopNav/NavController.m
@@ -81,19 +81,26 @@
-(void)updateViewConstraints
{
[super updateViewConstraints];
-
- CGFloat duration = 0.3f;
[self constrainNavBarContainer];
[self constrainNavBarContainerSubViews];
+ [self.navBarContainer layoutIfNeeded];
+
+ // Disabled the animations because they're a little funky with the alpha
tweening... can revisit later if needed.
+ //[self animateNavConstraintChanges];
+}
+
+-(void)animateNavConstraintChanges
+{
+ CGFloat duration = 0.3f;
for (UIView *v in self.navBarContainer.subviews) v.alpha = 0.0f;
- [UIView animateWithDuration:duration delay:0.0f
options:UIViewAnimationOptionTransitionNone animations:^{
+ [UIView animateWithDuration:(duration / 2.0f) delay:0.0f
options:UIViewAnimationOptionTransitionNone animations:^{
for (UIView *v in self.navBarContainer.subviews) v.alpha = 0.7f;
[self.navBarContainer layoutIfNeeded];
} completion:^(BOOL done){
- [UIView animateWithDuration:0.15 delay:0.1f
options:UIViewAnimationOptionTransitionNone animations:^{
+ [UIView animateWithDuration:(duration / 2.0f) delay:0.1f
options:UIViewAnimationOptionTransitionNone animations:^{
for (UIView *v in self.navBarContainer.subviews) v.alpha = 1.0f;
} completion:^(BOOL done){
}];
@@ -164,6 +171,9 @@
]
];
}
+
+ // Return can be uncommented here if we re-enable
"animateNavConstraintChanges" in the future...
+ return;
// Constrain the views not being presently shown so when they are shown
they'll animate from
// the constrained position specified below.
@@ -363,7 +373,12 @@
self.navBarSubViewsHorizontalVFLString =
@"H:|[NAVBAR_BUTTON_ARROW_LEFT(50)][NAVBAR_VERTICAL_LINE_1(singlePixel)]-(10)-[NAVBAR_LABEL]|";
break;
case NAVBAR_MODE_EDIT_WIKITEXT_PREVIEW:
- self.label.text =
NSLocalizedString(@"navbar-title-mode-edit-wikitext-preview", nil);
+ case NAVBAR_MODE_EDIT_WIKITEXT_SUMMARY:
+ self.label.text =
+ (NAVBAR_MODE_EDIT_WIKITEXT_PREVIEW == navBarMode) ?
+ NSLocalizedString(@"navbar-title-mode-edit-wikitext-preview",
nil)
+ :
+ NSLocalizedString(@"navbar-title-mode-edit-wikitext-summary",
nil);
self.navBarSubViewsHorizontalVFLString =
@"H:|[NAVBAR_BUTTON_ARROW_LEFT(50)][NAVBAR_VERTICAL_LINE_1(singlePixel)]-(10)-[NAVBAR_LABEL][NAVBAR_VERTICAL_LINE_2(singlePixel)][NAVBAR_BUTTON_CHECK(50)]|";
break;
case NAVBAR_MODE_EDIT_WIKITEXT_CAPTCHA:
diff --git a/Wikipedia-iOS/en.lproj/Localizable.strings
b/Wikipedia-iOS/en.lproj/Localizable.strings
index 2359e0c..c85d653 100644
--- a/Wikipedia-iOS/en.lproj/Localizable.strings
+++ b/Wikipedia-iOS/en.lproj/Localizable.strings
@@ -74,6 +74,7 @@
"navbar-title-mode-edit-wikitext-disallow" = "Edit issues";
"navbar-title-mode-edit-wikitext-preview" = "Previewing";
"navbar-title-mode-edit-wikitext-captcha" = "Quick Verification needed";
+"navbar-title-mode-edit-wikitext-summary" = "Describe your edit";
"edit-summary-choice-fixed-typos-grammar" = "Fixed typos or grammar";
"edit-summary-choice-linked-words" = "Linked words";
diff --git a/Wikipedia-iOS/qqq.lproj/Localizable.strings
b/Wikipedia-iOS/qqq.lproj/Localizable.strings
index 7a1d590..0ccde02 100644
--- a/Wikipedia-iOS/qqq.lproj/Localizable.strings
+++ b/Wikipedia-iOS/qqq.lproj/Localizable.strings
@@ -69,6 +69,7 @@
"navbar-title-mode-edit-wikitext-disallow" = "Header text shown when an abuse
filter disallow message is displayed";
"navbar-title-mode-edit-wikitext-preview" = "Header text shown when wikitext
changes are being previewed";
"navbar-title-mode-edit-wikitext-captcha" = "Header text shown when wikitext
captcha is displayed";
+"navbar-title-mode-edit-wikitext-summary" = "Header text shown when wikitext
edit summary interface is active";
"edit-summary-choice-fixed-typos-grammar" = "Button text for quick 'fixed
typos' edit summary selection";
"edit-summary-choice-linked-words" = "Button text for quick 'link addition'
edit summary selection";
--
To view, visit https://gerrit.wikimedia.org/r/118362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I36273be9ae8431a299ffc443767ce37417d13bdd
Gerrit-PatchSet: 2
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits