Marino Faggiana 6 yıl önce
ebeveyn
işleme
a9b17db91c

+ 16 - 0
iOSClient/Trash/NCTrash.storyboard

@@ -82,6 +82,22 @@
                                 <collectionReusableView key="sectionFooterView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="footerMenu" id="KIO-gv-emq" customClass="NCTrashFooterMenu" customModule="Nextcloud" customModuleProvider="target">
                                     <rect key="frame" x="0.0" y="50" width="375" height="50"/>
                                     <autoresizingMask key="autoresizingMask"/>
+                                    <subviews>
+                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5ZS-UE-CHl" userLabel="LabelFooter">
+                                            <rect key="frame" x="10" y="17" width="355" height="16"/>
+                                            <fontDescription key="fontDescription" type="system" pointSize="13"/>
+                                            <nil key="textColor"/>
+                                            <nil key="highlightedColor"/>
+                                        </label>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="5ZS-UE-CHl" firstAttribute="centerY" secondItem="KIO-gv-emq" secondAttribute="centerY" id="5Ip-b9-luC"/>
+                                        <constraint firstAttribute="trailing" secondItem="5ZS-UE-CHl" secondAttribute="trailing" constant="10" id="6rY-5r-1Mf"/>
+                                        <constraint firstItem="5ZS-UE-CHl" firstAttribute="leading" secondItem="KIO-gv-emq" secondAttribute="leading" constant="10" id="JLx-VS-sTx"/>
+                                    </constraints>
+                                    <connections>
+                                        <outlet property="labelFooter" destination="5ZS-UE-CHl" id="zcJ-1o-Jtw"/>
+                                    </connections>
                                 </collectionReusableView>
                                 <connections>
                                     <outlet property="dataSource" destination="EFX-fO-Oip" id="2On-qP-zuG"/>

+ 38 - 1
iOSClient/Trash/NCTrash.swift

@@ -245,7 +245,44 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
         } else {
             
             let trashFooter = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "footerMenu", for: indexPath) as! NCTrashFooterMenu
-
+            
+            trashFooter.labelFooter.textColor = NCBrandColor.sharedInstance.icon
+            
+            var folders: Int = 0, foldersText = ""
+            var files: Int = 0, filesText = ""
+            var size: Double = 0
+            
+            if self.datasource != nil {
+                for record: tableTrash in self.datasource! {
+                    if record.directory {
+                        folders += 1
+                    } else {
+                        files += 1
+                    }
+                    size = size + record.size
+                }
+            }
+            
+            if folders > 1 {
+                foldersText = "\(folders) " + NSLocalizedString("_folders_", comment: "")
+            } else if folders == 1 {
+                foldersText = "1 " + NSLocalizedString("_folder_", comment: "")
+            }
+            
+            if files > 1 {
+                filesText = "\(files) " + NSLocalizedString("_files_", comment: "") + " " + CCUtility.transformedSize(size)
+            } else if folders == 1 {
+                filesText = "1 " + NSLocalizedString("_file_", comment: "") + " " + CCUtility.transformedSize(size)
+            }
+           
+            if foldersText == "" {
+                trashFooter.labelFooter.text = filesText
+            } else if filesText == "" {
+                trashFooter.labelFooter.text = foldersText
+            } else {
+                trashFooter.labelFooter.text = foldersText + ", " + filesText
+            }
+            
             return trashFooter
         }
     }

+ 2 - 0
iOSClient/Trash/NCTrashHeaderFooterMenu.swift

@@ -43,6 +43,8 @@ protocol NCTrashHeaderMenuDelegate {
 
 class NCTrashFooterMenu: UICollectionReusableView {
     
+    @IBOutlet weak var labelFooter: UILabel!
+
     override func awakeFromNib() {
         super.awakeFromNib()