Brion VIBBER has submitted this change and it was merged. Change subject: Moved delete button to bottom of details slider. ......................................................................
Moved delete button to bottom of details slider. This made room for moving the uploads button to the right of the navigation bar which is better as having the upload button centered made it look more like a title than an actionable item. (per Jared & Vibha) Change-Id: I0bc19f682e6fdbe099e7864da5a8cecfdea970ce --- M Commons-iOS/DetailScrollViewController.h M Commons-iOS/DetailScrollViewController.m M Commons-iOS/GalleryMultiSelectCollectionVC.m M Commons-iOS/MyUploadsViewController.m M Commons-iOS/en.lproj/MainStoryboard.storyboard M Commons-iOS/messages/messages-en.json M Commons-iOS/messages/messages-qqq.json 7 files changed, 100 insertions(+), 25 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/Commons-iOS/DetailScrollViewController.h b/Commons-iOS/DetailScrollViewController.h index dd18ff0..e4bcccd 100644 --- a/Commons-iOS/DetailScrollViewController.h +++ b/Commons-iOS/DetailScrollViewController.h @@ -30,7 +30,6 @@ @property (weak, nonatomic) IBOutlet UILabelDynamicHeight *descriptionTextLabel; @property (weak, nonatomic) IBOutlet UILabel *descriptionLabel; @property (weak, nonatomic) IBOutlet UILabel *descriptionPlaceholder; -@property (weak, nonatomic) IBOutlet UIBarButtonItem *deleteButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *actionButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *uploadButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *shareButton; @@ -47,11 +46,14 @@ @property (weak, nonatomic) IBOutlet UILabelDynamicHeight *categoryDefaultLabel; @property (weak, nonatomic) IBOutlet UILabelDynamicHeight *licenseDefaultLabel; +@property (weak, nonatomic) IBOutlet UILabel *deleteLabel; +@property (weak, nonatomic) IBOutlet UILabelDynamicHeight *deleteButton; @property (weak, nonatomic) IBOutlet UIView *titleContainer; @property (weak, nonatomic) IBOutlet UIView *descriptionContainer; @property (weak, nonatomic) IBOutlet UIView *licenseContainer; @property (weak, nonatomic) IBOutlet UIView *categoryContainer; +@property (weak, nonatomic) IBOutlet UIView *deleteContainer; @property (weak, nonatomic) IBOutlet UIView *scrollContainer; diff --git a/Commons-iOS/DetailScrollViewController.m b/Commons-iOS/DetailScrollViewController.m index 9e3b7f0..1e726d1 100644 --- a/Commons-iOS/DetailScrollViewController.m +++ b/Commons-iOS/DetailScrollViewController.m @@ -146,6 +146,9 @@ self.licenseLabel.text = [MWMessage forKey:@"details-license-label"].text; self.categoryLabel.text = [MWMessage forKey:@"details-category-label"].text; + + self.deleteLabel.text = [MWMessage forKey:@"details-deletion-label"].text; + self.deleteButton.text = [MWMessage forKey:@"details-deletion-button"].text; self.descriptionTextView.backgroundColor = DETAIL_EDITABLE_TEXTBOX_BACKGROUND_COLOR; self.descriptionTextLabel.backgroundColor = [UIColor clearColor]; @@ -189,6 +192,7 @@ self.titleLabel.textColor = DETAIL_LABEL_COLOR; self.licenseLabel.textColor = DETAIL_LABEL_COLOR; self.categoryLabel.textColor = DETAIL_LABEL_COLOR; + self.deleteLabel.textColor = DETAIL_LABEL_COLOR; [self.view setMultipleTouchEnabled:NO]; @@ -236,6 +240,7 @@ self.descriptionContainer.backgroundColor = containerColor; self.licenseContainer.backgroundColor = containerColor; self.categoryContainer.backgroundColor = containerColor; + self.deleteContainer.backgroundColor = containerColor; // Show "Loading..." label for licenses self.licenseDefaultLabel.text = [MWMessage forKey:@"details-license-loading"].text; @@ -248,6 +253,8 @@ // Apply the style used by category labels to the category "Loading..." placeholder [self styleDetailsLabel:self.categoryDefaultLabel]; + + [self configureDeleteButton]; //[self.view randomlyColorSubviews]; } @@ -592,7 +599,6 @@ [self.titleTextField removeConstraint:self.titleTextFieldHeightConstraint]; self.descriptionTextLabel.hidden = NO; - self.deleteButton.enabled = NO; // fixme in future, support deleting uploaded items self.actionButton.enabled = YES; // open link or share on the web self.uploadButton.enabled = NO; // fixme either hide or replace with action button? @@ -607,6 +613,7 @@ self.ccByImage.hidden = YES; self.ccSaImage.hidden = YES; + [self hideDeleteButton]; // either use HTML http://commons.wikimedia.org/wiki/Commons:Machine-readable_data // or pick apart the standard templates } else { @@ -620,7 +627,10 @@ self.descriptionTextView.hidden = NO; self.descriptionTextLabel.hidden = YES; - self.deleteButton.enabled = (record.progress.floatValue == 0.0f); // don't allow delete _during_ upload + if (record.progress.floatValue != 0.0f){ + // don't allow delete _during_ upload + [self hideDeleteButton]; + } self.actionButton.enabled = NO; self.descriptionLabel.hidden = NO; @@ -641,6 +651,24 @@ #pragma mark - Buttons +- (void)configureDeleteButton +{ + UITapGestureRecognizer *tapDeleteGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(deleteButtonPushed:)]; + [self.deleteButton addGestureRecognizer:tapDeleteGesture]; + + [self styleDetailsLabel:self.deleteButton]; + self.deleteButton.paddingColor = [UIColor redColor]; + self.deleteButton.paddingColor = [UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.5f]; +} + +- (void)hideDeleteButton +{ + if (self.deleteContainer.superview == nil) return; + // Only show delete button for already uploaded images + [self.deleteContainer removeFromSuperview]; + [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[categoryContainer]-|" options:0 metrics:nil views:@{@"categoryContainer": self.categoryContainer}]]; +} + - (void)updateUploadButton { FileUpload *record = self.selectedRecord; diff --git a/Commons-iOS/GalleryMultiSelectCollectionVC.m b/Commons-iOS/GalleryMultiSelectCollectionVC.m index b09b2f0..e5fde51 100644 --- a/Commons-iOS/GalleryMultiSelectCollectionVC.m +++ b/Commons-iOS/GalleryMultiSelectCollectionVC.m @@ -167,6 +167,14 @@ UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:[MWMessage forKey:@"gallery-cancel-button"].text style:UIBarButtonItemStyleDone target:self action:@selector(dismiss)]; + + [rightButton setTitleTextAttributes:@{ + UITextAttributeFont: [UIFont boldSystemFontOfSize:16] + } forState:UIControlStateNormal]; + + // Remove the outline around the button to make iOS button look more iOS 7ish + [rightButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:[MWMessage forKey:@"gallery-album-title"].text]; item.rightBarButtonItem = rightButton; [navBar_ pushNavigationItem:item animated:NO]; diff --git a/Commons-iOS/MyUploadsViewController.m b/Commons-iOS/MyUploadsViewController.m index 32f116f..8135750 100644 --- a/Commons-iOS/MyUploadsViewController.m +++ b/Commons-iOS/MyUploadsViewController.m @@ -394,6 +394,12 @@ target:self action:@selector(uploadButtonPushed:)]; } + + [_uploadButton setTitleTextAttributes:@{ + UITextAttributeFont: [UIFont boldSystemFontOfSize:16] + } forState:UIControlStateNormal]; + + [_uploadButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; return _uploadButton; } @@ -404,6 +410,13 @@ style:UIBarButtonItemStylePlain target:self action:@selector(cancelButtonPushed:)]; + + [btn setTitleTextAttributes:@{ + UITextAttributeFont: [UIFont boldSystemFontOfSize:16] + } forState:UIControlStateNormal]; + + [btn setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + return btn; } @@ -1207,30 +1220,14 @@ UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:detailVC_ action:@selector(shareButtonPushed:)]; - - UIBarButtonItem *deleteButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash - 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]; + // Remove the outline around the button to make iOS button look more iOS 7ish + [shareButton setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - UIBarButtonItem *spacerItemFlexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace - target:nil - action:nil]; - - // These fake buttons trick the navigation bar into automatically centering the upload and openWiki buttons - UIBarButtonItem *fakeButton1 = [[UIBarButtonItem alloc] initWithCustomView:[[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]]; - UIBarButtonItem *fakeButton2 = [[UIBarButtonItem alloc] initWithCustomView:[[UIView alloc] initWithFrame:CGRectMake(0, 0, 9, 1)]]; - if (!self.selectedRecord.complete.boolValue) { - [imageScrollVC_.navigationItem setRightBarButtonItems: - @[deleteButton, fakeButton2, spacerItemFlexible, self.uploadButton, spacerItemFlexible,fakeButton1] - animated:YES]; + imageScrollVC_.navigationItem.rightBarButtonItem = self.uploadButton; }else{ - [imageScrollVC_.navigationItem setRightBarButtonItems: - @[shareButton, spacerItemFlexible, fakeButton1] - animated:YES]; + imageScrollVC_.navigationItem.rightBarButtonItem = shareButton; } } diff --git a/Commons-iOS/en.lproj/MainStoryboard.storyboard b/Commons-iOS/en.lproj/MainStoryboard.storyboard index 0fc202f..6b3cb57 100644 --- a/Commons-iOS/en.lproj/MainStoryboard.storyboard +++ b/Commons-iOS/en.lproj/MainStoryboard.storyboard @@ -1232,7 +1232,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ehb-uI-yRM" userLabel="Scroll Container"> - <rect key="frame" x="0.0" y="0.0" width="320" height="556"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="650"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jhZ-zd-ki7" userLabel="Title Container"> @@ -1392,6 +1392,36 @@ <constraint firstAttribute="bottom" secondItem="dyF-FO-sE1" secondAttribute="bottom" constant="20" symbolic="YES" id="ytA-ja-q5t"/> </constraints> </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zMN-gT-FuM" userLabel="Delete Container"> + <rect key="frame" x="20" y="544" width="280" height="86"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Deletion" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="240" translatesAutoresizingMaskIntoConstraints="NO" id="COf-gZ-FUh"> + <rect key="frame" x="20" y="20" width="240" height="21"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delete This Image" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="240" translatesAutoresizingMaskIntoConstraints="NO" id="tnu-rV-ymq" customClass="UILabelDynamicHeight"> + <rect key="frame" x="20" y="49" width="240" height="17"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> + <constraints> + <constraint firstItem="COf-gZ-FUh" firstAttribute="top" secondItem="zMN-gT-FuM" secondAttribute="top" constant="20" symbolic="YES" id="HnD-2T-aEE"/> + <constraint firstAttribute="trailing" secondItem="COf-gZ-FUh" secondAttribute="trailing" constant="20" symbolic="YES" id="MB1-RH-U3S"/> + <constraint firstItem="tnu-rV-ymq" firstAttribute="leading" secondItem="zMN-gT-FuM" secondAttribute="leading" constant="20" symbolic="YES" id="RBH-Lj-JdP"/> + <constraint firstItem="COf-gZ-FUh" firstAttribute="leading" secondItem="zMN-gT-FuM" secondAttribute="leading" constant="20" symbolic="YES" id="WOE-RU-kuX"/> + <constraint firstItem="tnu-rV-ymq" firstAttribute="top" secondItem="COf-gZ-FUh" secondAttribute="bottom" constant="8" symbolic="YES" id="dKh-TP-l61"/> + <constraint firstAttribute="trailing" secondItem="tnu-rV-ymq" secondAttribute="trailing" constant="20" symbolic="YES" id="jo7-sE-stT"/> + <constraint firstAttribute="bottom" secondItem="tnu-rV-ymq" secondAttribute="bottom" constant="20" symbolic="YES" id="yF4-hi-JnT"/> + </constraints> + </view> </subviews> <color key="backgroundColor" red="0.0" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <constraints> @@ -1400,15 +1430,18 @@ <constraint firstItem="jhZ-zd-ki7" firstAttribute="leading" secondItem="ehb-uI-yRM" secondAttribute="leading" constant="20" symbolic="YES" id="CDd-Mo-qUd"/> <constraint firstItem="jhZ-zd-ki7" firstAttribute="top" secondItem="ehb-uI-yRM" secondAttribute="top" constant="20" symbolic="YES" id="FrG-tc-PV1"/> <constraint firstItem="0OK-Zl-28Q" firstAttribute="leading" secondItem="ehb-uI-yRM" secondAttribute="leading" constant="20" symbolic="YES" id="LcE-El-EfB"/> + <constraint firstItem="zMN-gT-FuM" firstAttribute="top" secondItem="fx9-U5-jNG" secondAttribute="bottom" constant="8" symbolic="YES" id="MUV-BJ-tih"/> <constraint firstItem="fx9-U5-jNG" firstAttribute="top" secondItem="0OK-Zl-28Q" secondAttribute="bottom" constant="8" symbolic="YES" id="OZ5-bo-3nu"/> <constraint firstItem="ChD-4f-cDJ" firstAttribute="leading" secondItem="ehb-uI-yRM" secondAttribute="leading" constant="20" symbolic="YES" id="Qdx-Fe-QHc"/> <constraint firstAttribute="width" constant="320" placeholder="YES" id="RiN-tx-Eqg"/> <constraint firstAttribute="trailing" secondItem="fx9-U5-jNG" secondAttribute="trailing" constant="20" symbolic="YES" id="aqk-zd-f06"/> <constraint firstAttribute="trailing" secondItem="jhZ-zd-ki7" secondAttribute="trailing" constant="20" symbolic="YES" id="ayw-wb-VSx"/> <constraint firstAttribute="trailing" secondItem="0OK-Zl-28Q" secondAttribute="trailing" constant="20" symbolic="YES" id="gXz-1p-pLj"/> - <constraint firstAttribute="bottom" secondItem="fx9-U5-jNG" secondAttribute="bottom" constant="20" symbolic="YES" id="igR-ew-cNX"/> <constraint firstItem="fx9-U5-jNG" firstAttribute="leading" secondItem="ehb-uI-yRM" secondAttribute="leading" constant="20" symbolic="YES" id="kXG-4H-AT8"/> <constraint firstItem="0OK-Zl-28Q" firstAttribute="top" secondItem="ChD-4f-cDJ" secondAttribute="bottom" constant="8" symbolic="YES" id="ksp-3g-XaT"/> + <constraint firstItem="zMN-gT-FuM" firstAttribute="leading" secondItem="ehb-uI-yRM" secondAttribute="leading" constant="20" symbolic="YES" id="mFR-2g-qdV"/> + <constraint firstAttribute="trailing" secondItem="zMN-gT-FuM" secondAttribute="trailing" constant="20" symbolic="YES" id="rzN-YP-yWK"/> + <constraint firstAttribute="bottom" secondItem="zMN-gT-FuM" secondAttribute="bottom" constant="20" symbolic="YES" id="uZj-YH-8pr"/> </constraints> </view> </subviews> @@ -1425,6 +1458,9 @@ <outlet property="categoryContainer" destination="fx9-U5-jNG" id="e2I-cl-ZSs"/> <outlet property="categoryDefaultLabel" destination="dyF-FO-sE1" id="OXj-iy-LDf"/> <outlet property="categoryLabel" destination="jUg-Wa-cMl" id="8yR-OG-vWN"/> + <outlet property="deleteButton" destination="tnu-rV-ymq" id="XL3-yG-uXx"/> + <outlet property="deleteContainer" destination="zMN-gT-FuM" id="tmh-TQ-NlA"/> + <outlet property="deleteLabel" destination="COf-gZ-FUh" id="ETn-ZN-dfB"/> <outlet property="descriptionContainer" destination="ChD-4f-cDJ" id="Kag-oJ-QIL"/> <outlet property="descriptionLabel" destination="CZQ-bf-MDt" id="5Ys-xU-tlY"/> <outlet property="descriptionPlaceholder" destination="7ez-E3-hMg" id="Lmn-FU-s50"/> diff --git a/Commons-iOS/messages/messages-en.json b/Commons-iOS/messages/messages-en.json index 890e7d0..4eca7f9 100644 --- a/Commons-iOS/messages/messages-en.json +++ b/Commons-iOS/messages/messages-en.json @@ -54,6 +54,8 @@ "details-category-select": "Select...", "details-category-loading": "Loading...", "details-category-none-found": "No Categories Found", + "details-deletion-label": "Deletion", + "details-deletion-button": "Delete this Image", "web-open-in": "Open in $1", "web-cancel": "Cancel", diff --git a/Commons-iOS/messages/messages-qqq.json b/Commons-iOS/messages/messages-qqq.json index f022264..f12c606 100644 --- a/Commons-iOS/messages/messages-qqq.json +++ b/Commons-iOS/messages/messages-qqq.json @@ -54,6 +54,8 @@ "details-category-select": "Placeholder for category short list on image detail page when no categories are present. Should be short and encourage tapping to open the category selector.\n{{Identical|Select}}", "details-category-loading": "Loading message for categories on photo details.\n{{Identical|Loading}}", "details-category-none-found": "No categories found message for photo details.", + "details-deletion-label": "Deletion label above delete button", + "details-deletion-button": "Button text for image deletion button", "web-open-in": "Button text for opening web page in a given browser. Parameters:\n* $1 - the application name such as 'Safari' or 'Opera'", "web-cancel": "Button text for cancel button.\n{{Identical|Cancel}}", "login-title": "Title for the button that brings the user back to the login page. Note that PLURAL will be supported, but is not yet.\n{{Identical|Account}}", -- To view, visit https://gerrit.wikimedia.org/r/88173 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0bc19f682e6fdbe099e7864da5a8cecfdea970ce 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