Brion VIBBER has submitted this change and it was merged.

Change subject: Made title use a label instead of textbox if already uploaded.
......................................................................


Made title use a label instead of textbox if already uploaded.

Gives more control over the padding and wrapping by using UILabelDynamicHeight.

Change-Id: I5f7dd14b3f27a8d761551dd49aa0221cc16ddffc
---
M Commons-iOS/DetailScrollViewController.h
M Commons-iOS/DetailScrollViewController.m
M Commons-iOS/en.lproj/MainStoryboard.storyboard
3 files changed, 26 insertions(+), 2 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved



diff --git a/Commons-iOS/DetailScrollViewController.h 
b/Commons-iOS/DetailScrollViewController.h
index 7da66ba..be57d4d 100644
--- a/Commons-iOS/DetailScrollViewController.h
+++ b/Commons-iOS/DetailScrollViewController.h
@@ -9,6 +9,8 @@
 #import <UIKit/UIKit.h>
 #import "FileUpload.h"
 
+@class UILabelDynamicHeight;
+
 @protocol DetailScrollViewControllerDelegate <NSObject>
     // Protocol for notifying other view controllers, such as 
ImageScrollViewController,
     // that the Details view has been scrolled. The ImageScrollViewController 
uses this
@@ -23,6 +25,7 @@
 
 @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
 @property (weak, nonatomic) IBOutlet UITextField *titleTextField;
+@property (weak, nonatomic) IBOutlet UILabelDynamicHeight *titleTextLabel;
 @property (weak, nonatomic) IBOutlet UITextView *descriptionTextView;
 @property (weak, nonatomic) IBOutlet UILabel *descriptionLabel;
 @property (weak, nonatomic) IBOutlet UILabel *descriptionPlaceholder;
diff --git a/Commons-iOS/DetailScrollViewController.m 
b/Commons-iOS/DetailScrollViewController.m
index ff1e9b9..4cadccb 100644
--- a/Commons-iOS/DetailScrollViewController.m
+++ b/Commons-iOS/DetailScrollViewController.m
@@ -125,7 +125,11 @@
     
     self.descriptionTextView.backgroundColor = 
DETAIL_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
     self.titleTextField.backgroundColor = 
DETAIL_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
-    
+    self.titleTextLabel.backgroundColor = [UIColor clearColor];
+    self.titleTextLabel.borderColor = [UIColor clearColor];
+    self.titleTextLabel.paddingColor = 
DETAIL_NON_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
+    [self.titleTextLabel setPaddingInsets:UIEdgeInsetsMake(5.0f, 5.0f, 5.0f, 
5.0f)];
+
     // Add a bit of left and right padding to the text box
     self.titleTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 
0, 8, 20)];
     self.titleTextField.leftViewMode = UITextFieldViewModeAlways;
@@ -308,6 +312,7 @@
         self.categoryList = [record.categoryList mutableCopy];
         [self updateCategoryContainer];
         self.titleTextField.text = record.title;
+        self.titleTextLabel.text = record.title;
         self.descriptionTextView.text = record.desc;
         self.descriptionPlaceholder.hidden = (record.desc.length > 0);
 
@@ -326,6 +331,8 @@
             if (record.complete.boolValue) {
                 // Completed upload...
                 self.titleTextField.enabled = NO;
+                self.titleTextField.hidden = YES;
+                self.titleTextLabel.hidden = NO;
                 self.descriptionTextView.editable = NO;
                 self.deleteButton.enabled = NO; // fixme in future, support 
deleting uploaded items
                 self.actionButton.enabled = YES; // open link or share on the 
web
@@ -345,13 +352,15 @@
                 self.ccSaImage.hidden = YES;
 
                                self.descriptionTextView.backgroundColor = 
DETAIL_NON_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
-                               self.titleTextField.backgroundColor = 
DETAIL_NON_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
+                               //self.titleTextField.backgroundColor = 
DETAIL_NON_EDITABLE_TEXTBOX_BACKGROUND_COLOR;
 
                 // either use HTML 
http://commons.wikimedia.org/wiki/Commons:Machine-readable_data
                 // or pick apart the standard templates
             } else {
                 // Locally queued file...
                 self.titleTextField.enabled = YES;
+                self.titleTextField.hidden = NO;
+                self.titleTextLabel.hidden = YES;
                 self.descriptionTextView.editable = YES;
                 self.deleteButton.enabled = (record.progress.floatValue == 
0.0f); // don't allow delete _during_ upload
                 self.actionButton.enabled = NO;
diff --git a/Commons-iOS/en.lproj/MainStoryboard.storyboard 
b/Commons-iOS/en.lproj/MainStoryboard.storyboard
index 43f6ae8..9d2c4f2 100644
--- a/Commons-iOS/en.lproj/MainStoryboard.storyboard
+++ b/Commons-iOS/en.lproj/MainStoryboard.storyboard
@@ -1253,15 +1253,26 @@
                                                 <fontDescription 
key="fontDescription" type="system" pointSize="14"/>
                                                 <textInputTraits 
key="textInputTraits"/>
                                             </textField>
+                                            <label hidden="YES" opaque="NO" 
clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" 
horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" 
lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" 
adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="240" 
translatesAutoresizingMaskIntoConstraints="NO" id="r2g-Wc-vb5" userLabel="Title 
Text Label" 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" red="0.0" 
green="0.45882352939999999" blue="0.67450980390000004" alpha="1" 
colorSpace="deviceRGB"/>
                                         <constraints>
                                             <constraint firstItem="8ha-ZZ-I4k" 
firstAttribute="top" secondItem="2bq-vj-2xO" secondAttribute="bottom" 
constant="8" symbolic="YES" id="0Il-0g-D2S"/>
                                             <constraint 
firstAttribute="trailing" secondItem="2bq-vj-2xO" secondAttribute="trailing" 
constant="20" symbolic="YES" id="8uy-II-c36"/>
+                                            <constraint 
firstAttribute="bottom" secondItem="r2g-Wc-vb5" secondAttribute="bottom" 
constant="20" symbolic="YES" id="9hr-iu-vFt"/>
                                             <constraint firstItem="2bq-vj-2xO" 
firstAttribute="leading" secondItem="jhZ-zd-ki7" secondAttribute="leading" 
constant="20" symbolic="YES" id="K8i-Xp-tlx"/>
                                             <constraint 
firstAttribute="trailing" secondItem="8ha-ZZ-I4k" secondAttribute="trailing" 
constant="20" symbolic="YES" id="Nox-TZ-qJa"/>
                                             <constraint 
firstAttribute="bottom" secondItem="8ha-ZZ-I4k" secondAttribute="bottom" 
constant="20" symbolic="YES" id="bBw-wB-Fdj"/>
+                                            <constraint 
firstAttribute="trailing" secondItem="r2g-Wc-vb5" secondAttribute="trailing" 
constant="20" symbolic="YES" id="dUV-GF-0df"/>
                                             <constraint firstItem="8ha-ZZ-I4k" 
firstAttribute="leading" secondItem="jhZ-zd-ki7" secondAttribute="leading" 
constant="20" symbolic="YES" id="lEF-pj-nw1"/>
+                                            <constraint firstItem="r2g-Wc-vb5" 
firstAttribute="leading" secondItem="jhZ-zd-ki7" secondAttribute="leading" 
constant="20" symbolic="YES" id="mkO-PU-4UL"/>
+                                            <constraint firstItem="r2g-Wc-vb5" 
firstAttribute="top" secondItem="2bq-vj-2xO" secondAttribute="bottom" 
constant="8" symbolic="YES" id="rLj-z3-xog"/>
                                             <constraint firstItem="2bq-vj-2xO" 
firstAttribute="top" secondItem="jhZ-zd-ki7" secondAttribute="top" 
constant="20" symbolic="YES" id="vLz-ss-A42"/>
                                         </constraints>
                                     </view>
@@ -1386,6 +1397,7 @@
                         <outlet property="titleContainer" 
destination="jhZ-zd-ki7" id="ZIb-2a-ay0"/>
                         <outlet property="titleLabel" destination="2bq-vj-2xO" 
id="ZNe-Lu-57P"/>
                         <outlet property="titleTextField" 
destination="8ha-ZZ-I4k" id="RSQ-5R-Ogc"/>
+                        <outlet property="titleTextLabel" 
destination="r2g-Wc-vb5" id="NwJ-ob-j4X"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" 
id="W0W-ri-2SE" userLabel="First Responder" sceneMemberID="firstResponder"/>

-- 
To view, visit https://gerrit.wikimedia.org/r/88155
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5f7dd14b3f27a8d761551dd49aa0221cc16ddffc
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/commons
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to