Brion VIBBER has submitted this change and it was merged.
Change subject: Upload button only appears on My Uploads if images ready to be
uploaded.
......................................................................
Upload button only appears on My Uploads if images ready to be uploaded.
Also made taps on grayed out Details page upload button (or blank parts of nav
bar) cause keyboard to focus on title or description boxes (depending on which
one is blank) as a hint that text needs to be entered.
Change-Id: I6dfe8289af12cf00fd408c5e824b4698187d266c
---
M Commons-iOS/AppDelegate.m
M Commons-iOS/CommonsApp.m
M Commons-iOS/DetailScrollViewController.m
M Commons-iOS/MyUploadsViewController.m
M Commons-iOS/en.lproj/MainStoryboard.storyboard
5 files changed, 31 insertions(+), 34 deletions(-)
Approvals:
Brion VIBBER: Verified; Looks good to me, approved
diff --git a/Commons-iOS/AppDelegate.m b/Commons-iOS/AppDelegate.m
index b51b9e0..b234283 100644
--- a/Commons-iOS/AppDelegate.m
+++ b/Commons-iOS/AppDelegate.m
@@ -112,6 +112,14 @@
UITextAttributeTextShadowColor: [UIColor clearColor],
}
forState:UIControlStateNormal];
+
+ [[UIBarButtonItem appearance] setTitleTextAttributes:
+ @{
+ UITextAttributeFont: [UIFont boldSystemFontOfSize:16],
+ UITextAttributeTextColor: [UIColor lightGrayColor],
+ UITextAttributeTextShadowColor: [UIColor clearColor],
+ }
+ forState:UIControlStateDisabled];
[[UIButton appearance] setTitleShadowColor:[UIColor clearColor]
forState:UIControlStateNormal];
diff --git a/Commons-iOS/CommonsApp.m b/Commons-iOS/CommonsApp.m
index 542f12a..e2afcf4 100644
--- a/Commons-iOS/CommonsApp.m
+++ b/Commons-iOS/CommonsApp.m
@@ -1483,9 +1483,6 @@
style:UIBarButtonItemStyleBordered
target:target
action:action];
-
-
- [button setBackgroundImage:[UIImage imageNamed:@"clear.png"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
return button;
}
diff --git a/Commons-iOS/DetailScrollViewController.m
b/Commons-iOS/DetailScrollViewController.m
index fcb540f..f3db0fd 100644
--- a/Commons-iOS/DetailScrollViewController.m
+++ b/Commons-iOS/DetailScrollViewController.m
@@ -747,17 +747,10 @@
-(void)addNavBarBackgroundViewForTouchDetection
{
- CGRect f = self.navigationController.navigationBar.bounds;
- // Set size to just encompass the upload button in the center of the screen
- f = CGRectInset(f, (f.size.width / 2.0f) - 60.0f, 0.0f);
- navBackgroundView_ = [[UIView alloc] initWithFrame:f];
- navBackgroundView_.backgroundColor = [UIColor colorWithWhite:1.0f
alpha:0.0f];
- navBackgroundView_.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin
|
- UIViewAutoresizingFlexibleRightMargin |
- UIViewAutoresizingFlexibleLeftMargin |
- UIViewAutoresizingFlexibleTopMargin |
- UIViewAutoresizingFlexibleHeight |
- UIViewAutoresizingFlexibleBottomMargin;
+ // Add view to nav bar for touch detection
+ navBackgroundView_ = [[UIView alloc]
initWithFrame:self.navigationController.navigationBar.bounds];
+ navBackgroundView_.backgroundColor = [UIColor clearColor];
+ navBackgroundView_.autoresizingMask = UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth;
[self.navigationController.navigationBar addSubview:navBackgroundView_];
[self.navigationController.navigationBar
sendSubviewToBack:navBackgroundView_];
navBackgroundView_.userInteractionEnabled = YES;
diff --git a/Commons-iOS/MyUploadsViewController.m
b/Commons-iOS/MyUploadsViewController.m
index 64b981e..900a865 100644
--- a/Commons-iOS/MyUploadsViewController.m
+++ b/Commons-iOS/MyUploadsViewController.m
@@ -169,6 +169,9 @@
[self.refreshControl addTarget:self action:@selector(refreshButtonPushed:)
forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:self.refreshControl];
+
+ // Keep track of upload button state so it can be hidden from the My
Uploads page whenever disabled
+ [self.uploadButton addObserver:self forKeyPath:@"enabled"
options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld |
NSKeyValueObservingOptionPrior context:NULL];
//[self.view randomlyColorSubviews];
}
@@ -291,6 +294,21 @@
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
+ // Hide the upload button on the My Uploads page if no images are ready
for upload
+ // (It's a little wonky as UIBarButtonItem doesn't have a "hidden"
property so it
+ // actually has to be removed / re-added to
self.navigationItem.rightBarButtonItem)
+ if (object == self.uploadButton) {
+ if ([keyPath isEqualToString:@"enabled"]) {
+ if (self.uploadButton.enabled) {
+ if (self.navigationItem.rightBarButtonItem !=
self.uploadButton) {
+ self.navigationItem.rightBarButtonItem = self.uploadButton;
+ }
+ }else{
+ self.navigationItem.rightBarButtonItem = nil;
+ }
+ }
+ }
+
// Don't take action on observations if the view controller's view is no
longer visible
if (self.navigationController.topViewController != self) return;
@@ -300,8 +318,6 @@
CommonsApp *app = [CommonsApp singleton];
if (object == app.fetchDataURLQueue && [keyPath
isEqualToString:@"operationCount"]) {
[self raiseDowloadPriorityForImagesOfOnscreenCells];
- }else{
- [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
}
}
@@ -387,19 +403,6 @@
}
#pragma mark - Interface Items
-
-- (UIBarButtonItem *)uploadButton {
-
- if (!_uploadButton) {
-
- _uploadButton = [[UIBarButtonItem alloc] initWithTitle:[MWMessage
forKey:@"details-upload-button"].text
-
style:UIBarButtonItemStylePlain
- target:self
-
action:@selector(uploadButtonPushed:)];
- }
-
- return _uploadButton;
-}
- (UIBarButtonItem *)cancelButton {
return [[UIBarButtonItem alloc] initWithTitle:@"Cancel"
@@ -1203,10 +1206,6 @@
UIBarButtonItem *shareButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:detailVC_
action:@selector(shareButtonPushed:)];
-
- // Remove the outline around the button to make iOS button look more iOS
7ish
- [shareButton setBackgroundImage:[UIImage imageNamed:@"clear.png"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
-
if (!self.selectedRecord.complete.boolValue) {
imageScrollVC_.navigationItem.rightBarButtonItem = self.uploadButton;
}else{
diff --git a/Commons-iOS/en.lproj/MainStoryboard.storyboard
b/Commons-iOS/en.lproj/MainStoryboard.storyboard
index ef6f271..49248c7 100644
--- a/Commons-iOS/en.lproj/MainStoryboard.storyboard
+++ b/Commons-iOS/en.lproj/MainStoryboard.storyboard
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version="3.0" toolsVersion="4510" systemVersion="12F37"
targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier"
propertyAccessControl="none" useAutolayout="YES"
initialViewController="TTI-Hz-lQf">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version="3.0" toolsVersion="4510" systemVersion="12F45"
targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier"
propertyAccessControl="none" useAutolayout="YES"
initialViewController="TTI-Hz-lQf">
<dependencies>
<deployment version="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version="3742"/>
--
To view, visit https://gerrit.wikimedia.org/r/89381
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6dfe8289af12cf00fd408c5e824b4698187d266c
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/commons
Gerrit-Branch: master
Gerrit-Owner: Mhurd <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits