Marino Faggiana 6 éve
szülő
commit
c66b5c3230

+ 41 - 13
iOSClient/Offline/NCOffline.swift

@@ -37,8 +37,11 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
     var listLayout: ListLayoutOffline!
     var gridLayout: GridLayoutOffline!
     
-    private let highHeader: CGFloat = 50
-    
+    private let headerMenuHeight: CGFloat = 50
+    private let sectionHeaderMenuHeight: CGFloat = 100
+    private let sectionHeaderHeight: CGFloat = 20
+    private let footerHeight: CGFloat = 50
+
     private let refreshControl = UIRefreshControl()
 
     override func viewDidLoad() {
@@ -331,10 +334,25 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
                     }
             case 1: switch indexPath.row {
                 
-                    case 0: CCUtility.setGroupBySettings("alphabetic")
-                    case 1: CCUtility.setGroupBySettings("typefile")
-                    case 2: CCUtility.setGroupBySettings("date")
-
+                    case 0:
+                    if CCUtility.getGroupBySettings() == "alphabetic" {
+                        CCUtility.setGroupBySettings("none")
+                    } else {
+                        CCUtility.setGroupBySettings("alphabetic")
+                    }
+                    case 1:
+                    if CCUtility.getGroupBySettings() == "typefile" {
+                        CCUtility.setGroupBySettings("none")
+                    } else {
+                        CCUtility.setGroupBySettings("typefile")
+                    }
+                    case 2:
+                    if CCUtility.getGroupBySettings() == "date" {
+                        CCUtility.setGroupBySettings("none")
+                    } else {
+                        CCUtility.setGroupBySettings("date")
+                    }
+    
                     default: ()
                     }
             case 2: if CCUtility.getDirectoryOnTop() {
@@ -462,24 +480,34 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
-        return CGSize(width: collectionView.frame.width, height: highHeader)
+        if section == 0 {
+            if CCUtility.getGroupBySettings() == "none" {
+                return CGSize(width: collectionView.frame.width, height: headerMenuHeight)
+            } else {
+                return CGSize(width: collectionView.frame.width, height: sectionHeaderMenuHeight)
+            }
+        } else {
+            return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
+        }
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
-        return CGSize(width: collectionView.frame.width, height: highHeader)
+        let sections = sectionDatasource.sectionArrayRow.allKeys.count
+        if (section == sections - 1) {
+            return CGSize(width: collectionView.frame.width, height: footerHeight)
+        } else {
+            return CGSize(width: collectionView.frame.width, height: 0)
+        }
     }
     
     func numberOfSections(in collectionView: UICollectionView) -> Int {
-        
         let sections = sectionDatasource.sectionArrayRow.allKeys.count
         return sections
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        
         let key = sectionDatasource.sections.object(at: section)
         let datasource = sectionDatasource.sectionArrayRow.object(forKey: key) as! [tableMetadata]
-        
         return datasource.count
     }
     
@@ -671,7 +699,7 @@ class ListLayoutOffline: UICollectionViewFlowLayout {
         minimumLineSpacing = 1
         
         self.scrollDirection = .vertical
-        self.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)
+        self.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
     }
     
     required init?(coder aDecoder: NSCoder) {
@@ -711,7 +739,7 @@ class GridLayoutOffline: UICollectionViewFlowLayout {
         minimumLineSpacing = 1
 
         self.scrollDirection = .vertical
-        self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 10, right:  marginLeftRight)
+        self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 0, right:  marginLeftRight)
     }
     
     required init?(coder aDecoder: NSCoder) {

+ 2 - 0
iOSClient/Offline/Section/NCOfflineHeaderFooter.swift

@@ -111,6 +111,8 @@ class NCOfflineSectionHeader: UICollectionReusableView {
     
     override func awakeFromNib() {
         super.awakeFromNib()
+        
+        self.backgroundColor = NCBrandColor.sharedInstance.brand.withAlphaComponent(0.2)
     }
 }
 

+ 5 - 5
iOSClient/Offline/Section/NCOfflineSectionHeader.xib

@@ -13,17 +13,16 @@
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <collectionReusableView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="sectionHeader" id="Vin-9E-7nW" customClass="NCOfflineSectionHeader" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+            <rect key="frame" x="0.0" y="0.0" width="375" height="34"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
-                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LabelSectionHeader" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn" userLabel="Label Section">
-                    <rect key="frame" x="10" y="17" width="355" height="16"/>
-                    <fontDescription key="fontDescription" type="system" pointSize="13"/>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LabelSectionHeader" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn" userLabel="Label Section">
+                    <rect key="frame" x="10" y="10" width="355" height="14.5"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="12"/>
                     <nil key="textColor"/>
                     <nil key="highlightedColor"/>
                 </label>
             </subviews>
-            <color key="backgroundColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="gzy-cT-Gjn" secondAttribute="trailing" constant="10" id="QzY-ac-CRO"/>
                 <constraint firstItem="gzy-cT-Gjn" firstAttribute="centerY" secondItem="Vin-9E-7nW" secondAttribute="centerY" id="avP-sX-JB5"/>
@@ -33,6 +32,7 @@
             <connections>
                 <outlet property="labelSection" destination="gzy-cT-Gjn" id="yG6-wJ-CmI"/>
             </connections>
+            <point key="canvasLocation" x="40.799999999999997" y="39.580209895052477"/>
         </collectionReusableView>
     </objects>
 </document>