Browse Source

dev select view

Marino Faggiana 6 years ago
parent
commit
60b56f5aa5

+ 14 - 4
iOSClient/Main/Cell/NCGridCell.swift

@@ -27,24 +27,34 @@ import UIKit
 class NCGridCell: UICollectionViewCell {
     
     @IBOutlet weak var imageItem: UIImageView!
+    
     @IBOutlet weak var imageSelect: UIImageView!
+    
     @IBOutlet weak var labelTitle: UILabel!
-    @IBOutlet weak var buttonMoreGrid: UIButton!
+    @IBOutlet weak var labelTitleTrailing: NSLayoutConstraint!
+
+    @IBOutlet weak var buttonMore: UIButton!
 
     var delegate: NCGridCellDelegate?
     
     var fileID = ""
     var indexPath = IndexPath()
-
+    
     override func awakeFromNib() {
         super.awakeFromNib()
        
-        buttonMoreGrid.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem), for: UIControl.State.normal)
+        buttonMore.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem), for: UIControl.State.normal)
     }
     
-    @IBAction func touchUpInsideMoreGrid(_ sender: Any) {
+    @IBAction func touchUpInsideMore(_ sender: Any) {
         delegate?.tapMoreGridItem(with: fileID, sender: sender)
     }
+    
+    func hideButtonMore() {
+        buttonMore.isHidden = true
+        buttonMore.isEnabled = false
+        labelTitleTrailing.constant = 10
+    }
 }
 
 protocol NCGridCellDelegate {

+ 5 - 4
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="190" height="15"/>
+                        <rect key="frame" x="0.0" y="230" width="195" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <nil key="textColor"/>
                         <nil key="highlightedColor"/>
@@ -36,7 +36,7 @@
                         </constraints>
                         <state key="normal" image="more"/>
                         <connections>
-                            <action selector="touchUpInsideMoreGrid:" destination="vf1-Kf-9uL" eventType="touchUpInside" id="bg0-Yq-0J6"/>
+                            <action selector="touchUpInsideMore:" destination="vf1-Kf-9uL" eventType="touchUpInside" id="I1O-F9-0Sh"/>
                         </connections>
                     </button>
                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="DHy-Up-3Bh" userLabel="imageSelect">
@@ -51,9 +51,9 @@
             <constraints>
                 <constraint firstItem="DHy-Up-3Bh" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="1T3-8p-uIW"/>
                 <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="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="EJs-Ro-nbe" firstAttribute="leading" secondItem="eU3-lY-fKr" secondAttribute="trailing" constant="5" id="FPP-2I-eKr"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Ouj-ZD-UFm"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="EJs-Ro-nbe" secondAttribute="trailing" id="Pfe-J0-t9I"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" id="cHT-cP-NN6"/>
@@ -64,10 +64,11 @@
             <viewLayoutGuide key="safeArea" id="VXh-sQ-LeX"/>
             <size key="customSize" width="220" height="260"/>
             <connections>
-                <outlet property="buttonMoreGrid" destination="EJs-Ro-nbe" id="sUc-vE-XKf"/>
+                <outlet property="buttonMore" destination="EJs-Ro-nbe" id="BdI-ay-LuX"/>
                 <outlet property="imageItem" destination="5Ci-V1-hf5" id="xky-Nw-NUb"/>
                 <outlet property="imageSelect" destination="DHy-Up-3Bh" id="mo9-rP-P4I"/>
                 <outlet property="labelTitle" destination="eU3-lY-fKr" id="0P7-yM-Asb"/>
+                <outlet property="labelTitleTrailing" destination="5SO-rO-DnZ" id="peA-RW-j2u"/>
             </connections>
             <point key="canvasLocation" x="88" y="141.67916041979012"/>
         </collectionViewCell>

+ 13 - 3
iOSClient/Main/Cell/NCListCell.swift

@@ -28,11 +28,14 @@ class NCListCell: UICollectionViewCell {
     
     @IBOutlet weak var imageItem: UIImageView!
     @IBOutlet weak var imageItemLeftConstraint: NSLayoutConstraint!
+    
     @IBOutlet weak var imageSelect: UIImageView!
 
     @IBOutlet weak var labelTitle: UILabel!
+    @IBOutlet weak var labelTitleTrailing: NSLayoutConstraint!
+
     @IBOutlet weak var labelInfo: UILabel!
-    
+
     @IBOutlet weak var imageMore: UIImageView!
     @IBOutlet weak var buttonMore: UIButton!
     
@@ -52,10 +55,17 @@ class NCListCell: UICollectionViewCell {
     }
     
     @IBAction func touchUpInsideMore(_ sender: Any) {
-        delegate?.tapMoreItem(with: fileID, sender: sender)
+        delegate?.tapMoreListItem(with: fileID, sender: sender)
+    }
+    
+    func hideButtonMore() {
+        buttonMore.isHidden = true
+        buttonMore.isEnabled = false
+        imageMore.isHidden = true
+        labelTitleTrailing.constant = 10
     }
 }
 
 protocol NCListCellDelegate {
-    func tapMoreItem(with fileID: String, sender: Any)
+    func tapMoreListItem(with fileID: String, sender: Any)
 }

+ 2 - 1
iOSClient/Main/Cell/NCListCell.xib

@@ -75,12 +75,12 @@
             <constraints>
                 <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"/>
-                <constraint firstItem="yhy-xd-w5C" firstAttribute="leading" secondItem="UtT-L6-mgW" secondAttribute="trailing" constant="10" id="Db3-6O-kdP"/>
                 <constraint firstItem="Egg-cb-EhZ" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" id="JCm-UU-Pxu"/>
                 <constraint firstItem="dgL-g5-Nkc" firstAttribute="centerY" secondItem="yhy-xd-w5C" secondAttribute="centerY" id="OMy-Cu-HAx"/>
                 <constraint firstItem="UtT-L6-mgW" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="PQ8-0b-fLa"/>
                 <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="Gu8-oz-zWa" firstAttribute="trailing" secondItem="UtT-L6-mgW" secondAttribute="trailing" constant="50" id="Tq4-bB-YMV"/>
                 <constraint firstItem="yhy-xd-w5C" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="ZO7-Ny-L3I"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="bottom" secondItem="AXX-71-9Q6" secondAttribute="bottom" constant="14" id="d06-sn-I3Y"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="Egg-cb-EhZ" secondAttribute="trailing" id="k8f-bU-D6I"/>
@@ -101,6 +101,7 @@
                 <outlet property="imageSelect" destination="AyA-hP-r6w" id="c1t-yz-HBg"/>
                 <outlet property="labelInfo" destination="AXX-71-9Q6" id="krb-tZ-UQ7"/>
                 <outlet property="labelTitle" destination="UtT-L6-mgW" id="Xv6-zM-2v1"/>
+                <outlet property="labelTitleTrailing" destination="Tq4-bB-YMV" id="uMJ-4w-tx5"/>
                 <outlet property="separator" destination="Egg-cb-EhZ" id="uhq-Nc-z8K"/>
             </connections>
             <point key="canvasLocation" x="97.599999999999994" y="129.53523238380811"/>

+ 1 - 1
iOSClient/Offline/NCOffline.swift

@@ -242,7 +242,7 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
         
     }
     
-    func tapMoreItem(with fileID: String, sender: Any) {
+    func tapMoreListItem(with fileID: String, sender: Any) {
         tapMoreGridItem(with: fileID, sender: sender)
     }
     

+ 5 - 4
iOSClient/Select/NCSelect.swift

@@ -288,7 +288,7 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
         
     }
     
-    func tapMoreItem(with fileID: String, sender: Any) {
+    func tapMoreListItem(with fileID: String, sender: Any) {
         tapMoreGridItem(with: fileID, sender: sender)
     }
     
@@ -639,8 +639,8 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
             let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
             cell.delegate = self
             
-            cell.buttonMore.isHidden = true
-            cell.imageMore.isHidden = true
+            // hide button more
+            cell.hideButtonMore()
             
             cell.fileID = metadata.fileID
             cell.indexPath = indexPath
@@ -686,7 +686,8 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
             let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
             cell.delegate = self
             
-            cell.buttonMoreGrid.isHidden = true
+            // hide button more
+            cell.hideButtonMore()
             
             cell.fileID = metadata.fileID
             cell.indexPath = indexPath

+ 4 - 4
iOSClient/Trash/Cell/NCTrashListCell.swift

@@ -56,15 +56,15 @@ class NCTrashListCell: UICollectionViewCell {
     }
     
     @IBAction func touchUpInsideMore(_ sender: Any) {
-        delegate?.tapMoreItem(with: fileID, sender: sender)
+        delegate?.tapMoreListItem(with: fileID, sender: sender)
     }
     
     @IBAction func touchUpInsideRestore(_ sender: Any) {
-        delegate?.tapRestoreItem(with: fileID, sender: sender)
+        delegate?.tapRestoreListItem(with: fileID, sender: sender)
     }
 }
 
 protocol NCTrashListCellDelegate {
-    func tapRestoreItem(with fileID: String, sender: Any)
-    func tapMoreItem(with fileID: String, sender: Any)
+    func tapRestoreListItem(with fileID: String, sender: Any)
+    func tapMoreListItem(with fileID: String, sender: Any)
 }

+ 2 - 2
iOSClient/Trash/NCTrash.swift

@@ -245,7 +245,7 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
         menuView?.showMenu()
     }
     
-    func tapRestoreItem(with fileID: String, sender: Any) {
+    func tapRestoreListItem(with fileID: String, sender: Any) {
         
         if !isEditMode {
             restoreItem(with: fileID)
@@ -256,7 +256,7 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
         }
     }
     
-    func tapMoreItem(with fileID: String, sender: Any) {
+    func tapMoreListItem(with fileID: String, sender: Any) {
 
         if !isEditMode {
             var items = [ActionSheetItem]()