Browse Source

add share image

Marino Faggiana 6 years ago
parent
commit
a9cfe6bc15

+ 46 - 0
iOSClient/Main/Cell/NCGridCell.swift

@@ -36,6 +36,9 @@ class NCGridCell: UICollectionViewCell {
     @IBOutlet weak var labelTitle: UILabel!
     @IBOutlet weak var labelTitleTrailing: NSLayoutConstraint!
 
+    @IBOutlet weak var imageShare: UIImageView!
+    @IBOutlet weak var imageShareTrailing: NSLayoutConstraint!
+
     @IBOutlet weak var buttonMore: UIButton!
 
     var delegate: NCGridCellDelegate?
@@ -43,6 +46,9 @@ class NCGridCell: UICollectionViewCell {
     var fileID = ""
     var indexPath = IndexPath()
     
+    let labelTitleTrailingConstant: CGFloat = 55
+    let imageShareTrailingConstant: CGFloat = 25
+    
     override func awakeFromNib() {
         super.awakeFromNib()
        
@@ -53,6 +59,46 @@ class NCGridCell: UICollectionViewCell {
         delegate?.tapMoreGridItem(with: fileID, sender: sender)
     }
     
+    func hide(buttonMore: Bool, imageShare: Bool) {
+        
+        if buttonMore && imageShare {
+            
+            self.buttonMore.isHidden = true
+            self.buttonMore.isEnabled = false
+            self.imageShare.isHidden = true
+            
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = imageShareTrailingConstant
+            
+        } else if buttonMore && !imageShare {
+            
+            self.buttonMore.isHidden = true
+            self.buttonMore.isEnabled = false
+            self.imageShare.isHidden = false
+            
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = 10
+            
+        } else if !buttonMore && imageShare {
+            
+            self.buttonMore.isHidden = false
+            self.buttonMore.isEnabled = true
+            self.imageShare.isHidden = true
+            
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = 25
+            
+        } else if !buttonMore && !imageShare {
+            
+            self.buttonMore.isHidden = false
+            self.buttonMore.isEnabled = true
+            self.imageShare.isHidden = false
+            
+            imageShareTrailing.constant = labelTitleTrailingConstant
+            labelTitleTrailing.constant = labelTitleTrailingConstant
+        }
+    }
+    
     func hideButtonMore() {
         buttonMore.isHidden = true
         buttonMore.isEnabled = false

+ 13 - 2
iOSClient/Main/Cell/NCGridCell.xib

@@ -23,7 +23,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
                     </imageView>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eU3-lY-fKr" userLabel="labelTitle">
-                        <rect key="frame" x="0.0" y="230" width="195" height="15"/>
+                        <rect key="frame" x="0.0" y="230" width="165" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <nil key="textColor"/>
                         <nil key="highlightedColor"/>
@@ -67,13 +67,21 @@
                             <constraint firstAttribute="width" constant="15" id="xLe-lb-N1p"/>
                         </constraints>
                     </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-9M-s4G" userLabel="imageShare">
+                        <rect key="frame" x="170" y="225" width="25" height="25"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="25" id="cug-BZ-vli"/>
+                            <constraint firstAttribute="height" constant="25" id="whK-zg-83S"/>
+                        </constraints>
+                    </imageView>
                 </subviews>
             </view>
             <constraints>
                 <constraint firstItem="DHy-Up-3Bh" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="1T3-8p-uIW"/>
                 <constraint firstItem="AYs-f2-vve" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="3e3-0A-NSl"/>
                 <constraint firstItem="eU3-lY-fKr" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="10" id="4Yq-Nh-z1l"/>
-                <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="eU3-lY-fKr" secondAttribute="trailing" constant="25" id="5SO-rO-DnZ"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="eU3-lY-fKr" secondAttribute="trailing" constant="55" id="5SO-rO-DnZ"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="nZn-9M-s4G" secondAttribute="trailing" constant="25" id="645-Kw-aJh"/>
                 <constraint firstItem="EJs-Ro-nbe" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="5" id="89Q-77-ulE"/>
                 <constraint firstItem="DHy-Up-3Bh" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" constant="5" id="ESV-qE-tbO"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Ouj-ZD-UFm"/>
@@ -82,6 +90,7 @@
                 <constraint firstItem="81G-wH-fjN" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="-20" id="aEb-vq-8sk"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" id="cHT-cP-NN6"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="45" id="eEC-eB-alE"/>
+                <constraint firstItem="nZn-9M-s4G" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="5" id="fIY-O8-dnI"/>
                 <constraint firstItem="eU3-lY-fKr" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="gZe-FC-8XQ"/>
                 <constraint firstItem="81G-wH-fjN" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="nFH-Pc-end"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="qT3-WD-iTV"/>
@@ -96,6 +105,8 @@
                 <outlet property="imageItem" destination="5Ci-V1-hf5" id="xky-Nw-NUb"/>
                 <outlet property="imageLocal" destination="81G-wH-fjN" id="bqj-wQ-CBV"/>
                 <outlet property="imageSelect" destination="DHy-Up-3Bh" id="mo9-rP-P4I"/>
+                <outlet property="imageShare" destination="nZn-9M-s4G" id="F94-RD-QXu"/>
+                <outlet property="imageShareTrailing" destination="645-Kw-aJh" id="aRF-kg-ujJ"/>
                 <outlet property="imageStatus" destination="a0p-rj-jnV" id="6Dg-tf-evd"/>
                 <outlet property="labelTitle" destination="eU3-lY-fKr" id="0P7-yM-Asb"/>
                 <outlet property="labelTitleTrailing" destination="5SO-rO-DnZ" id="peA-RW-j2u"/>

+ 50 - 0
iOSClient/Main/Cell/NCListCell.swift

@@ -39,6 +39,9 @@ class NCListCell: UICollectionViewCell {
 
     @IBOutlet weak var labelInfo: UILabel!
 
+    @IBOutlet weak var imageShare: UIImageView!
+    @IBOutlet weak var imageShareTrailing: NSLayoutConstraint!
+
     @IBOutlet weak var imageMore: UIImageView!
     @IBOutlet weak var buttonMore: UIButton!
     
@@ -49,6 +52,9 @@ class NCListCell: UICollectionViewCell {
     var fileID = ""
     var indexPath = IndexPath()
 
+    let labelTitleTrailingConstant: CGFloat = 75
+    let imageShareTrailingConstant: CGFloat = 45
+    
     override func awakeFromNib() {
         super.awakeFromNib()
        
@@ -61,6 +67,50 @@ class NCListCell: UICollectionViewCell {
         delegate?.tapMoreListItem(with: fileID, sender: sender)
     }
     
+    func hide(buttonMore: Bool, imageShare: Bool) {
+        
+        if buttonMore && imageShare {
+            
+            self.buttonMore.isHidden = true
+            self.buttonMore.isEnabled = false
+            self.imageMore.isHidden = true
+            self.imageShare.isHidden = true
+            
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = 25
+            
+        } else if buttonMore && !imageShare {
+            
+            self.buttonMore.isHidden = true
+            self.buttonMore.isEnabled = false
+            self.imageMore.isHidden = true
+            self.imageShare.isHidden = false
+            
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = 10
+            
+        } else if !buttonMore && imageShare {
+            
+            self.buttonMore.isHidden = false
+            self.buttonMore.isEnabled = true
+            self.imageMore.isHidden = false
+            self.imageShare.isHidden = true
+
+            imageShareTrailing.constant = 0
+            labelTitleTrailing.constant = 25
+            
+        } else if !buttonMore && !imageShare {
+            
+            self.buttonMore.isHidden = false
+            self.buttonMore.isEnabled = true
+            self.imageMore.isHidden = false
+            self.imageShare.isHidden = false
+            
+            imageShareTrailing.constant = labelTitleTrailingConstant
+            labelTitleTrailing.constant = labelTitleTrailingConstant
+        }
+    }
+    
     func hideButtonMore() {
         buttonMore.isHidden = true
         buttonMore.isEnabled = false

+ 15 - 4
iOSClient/Main/Cell/NCListCell.xib

@@ -41,13 +41,13 @@
                         </constraints>
                     </imageView>
                     <label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UtT-L6-mgW" userLabel="labelTitle">
-                        <rect key="frame" x="95" y="13" width="455" height="18"/>
+                        <rect key="frame" x="95" y="13" width="430" height="18"/>
                         <fontDescription key="fontDescription" type="system" pointSize="15"/>
                         <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <nil key="highlightedColor"/>
                     </label>
                     <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AXX-71-9Q6" userLabel="labelInfo">
-                        <rect key="frame" x="95" y="31" width="455" height="15"/>
+                        <rect key="frame" x="95" y="31" width="430" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
                         <nil key="highlightedColor"/>
@@ -91,9 +91,17 @@
                             <constraint firstAttribute="height" constant="15" id="N8h-3R-JpE"/>
                         </constraints>
                     </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jc6-Vg-TaS" userLabel="imageShare">
+                        <rect key="frame" x="530" y="17.5" width="25" height="25"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="25" id="Cvy-nZ-zyD"/>
+                            <constraint firstAttribute="width" constant="25" id="jfe-Fg-vA8"/>
+                        </constraints>
+                    </imageView>
                 </subviews>
             </view>
             <constraints>
+                <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="jc6-Vg-TaS" secondAttribute="trailing" constant="45" id="4YU-yn-33L"/>
                 <constraint firstItem="H4E-G2-C1H" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="-10" id="6fN-Jc-WID"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="bottom" secondItem="Egg-cb-EhZ" secondAttribute="bottom" id="81D-sw-EaX"/>
                 <constraint firstItem="yhy-xd-w5C" firstAttribute="leading" secondItem="dgL-g5-Nkc" secondAttribute="trailing" constant="-25" id="980-6s-ave"/>
@@ -104,7 +112,7 @@
                 <constraint firstItem="AXX-71-9Q6" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="Qvq-r5-AX9"/>
                 <constraint firstItem="AyA-hP-r6w" firstAttribute="leading" secondItem="Gu8-oz-zWa" secondAttribute="leading" constant="10" id="RYl-cO-cCN"/>
                 <constraint firstItem="C4K-Nv-phA" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="-10" id="Sof-wy-toF"/>
-                <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="UtT-L6-mgW" secondAttribute="trailing" constant="50" id="Tq4-bB-YMV"/>
+                <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="UtT-L6-mgW" secondAttribute="trailing" constant="75" id="Tq4-bB-YMV"/>
                 <constraint firstItem="H4E-G2-C1H" firstAttribute="top" secondItem="w2m-Vw-hpd" secondAttribute="bottom" constant="-10" id="UWI-r9-vcA"/>
                 <constraint firstItem="7Q9-Tv-9yo" firstAttribute="top" secondItem="w2m-Vw-hpd" secondAttribute="bottom" constant="-10" id="XbB-4a-WpA"/>
                 <constraint firstItem="yhy-xd-w5C" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="ZO7-Ny-L3I"/>
@@ -113,10 +121,11 @@
                 <constraint firstItem="w2m-Vw-hpd" firstAttribute="leading" secondItem="Gu8-oz-zWa" secondAttribute="leading" constant="45" id="mBb-ff-7HD"/>
                 <constraint firstItem="w2m-Vw-hpd" firstAttribute="leading" secondItem="7Q9-Tv-9yo" secondAttribute="trailing" constant="-10" id="mon-aq-gcP"/>
                 <constraint firstItem="UtT-L6-mgW" firstAttribute="top" secondItem="Gu8-oz-zWa" secondAttribute="top" constant="13" id="nrY-2F-QZ2"/>
+                <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="AXX-71-9Q6" secondAttribute="trailing" constant="75" id="p0M-zU-aDG"/>
                 <constraint firstItem="w2m-Vw-hpd" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="qKl-4Y-m5t"/>
-                <constraint firstItem="yhy-xd-w5C" firstAttribute="leading" secondItem="AXX-71-9Q6" secondAttribute="trailing" constant="10" id="qem-j1-9RR"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="yhy-xd-w5C" secondAttribute="trailing" id="s2S-RP-cw5"/>
                 <constraint firstItem="AyA-hP-r6w" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="sJp-0x-bdC"/>
+                <constraint firstItem="jc6-Vg-TaS" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="sp2-s7-rxZ"/>
             </constraints>
             <viewLayoutGuide key="safeArea" id="Gu8-oz-zWa"/>
             <size key="customSize" width="650" height="58"/>
@@ -128,6 +137,8 @@
                 <outlet property="imageLocal" destination="H4E-G2-C1H" id="waX-r5-viX"/>
                 <outlet property="imageMore" destination="dgL-g5-Nkc" id="r7x-Ib-4nz"/>
                 <outlet property="imageSelect" destination="AyA-hP-r6w" id="c1t-yz-HBg"/>
+                <outlet property="imageShare" destination="jc6-Vg-TaS" id="uca-x2-wak"/>
+                <outlet property="imageShareTrailing" destination="p0M-zU-aDG" id="O55-nu-gbB"/>
                 <outlet property="imageStatus" destination="7Q9-Tv-9yo" id="Qug-Q7-rRZ"/>
                 <outlet property="labelInfo" destination="AXX-71-9Q6" id="krb-tZ-UQ7"/>
                 <outlet property="labelTitle" destination="UtT-L6-mgW" id="Xv6-zM-2v1"/>