Преглед на файлове

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana преди 2 години
родител
ревизия
126efb21ad

+ 5 - 3
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1883,9 +1883,11 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
 
             if dataSource.numberOfSections() == 1 {
                 let info = dataSource.getFooterInformation()
-                footer.setTitleLabel(directories: info.directories, files: info.files, size: info.size )
+                footer.setTitleLabel(directories: info.directories, files: info.files, size: info.size)
+                footer.separatorIsHidden(true)
             } else {
                 footer.setTitleLabel(text: "")
+                footer.separatorIsHidden(false)
             }
 
             return footer
@@ -1920,7 +1922,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
             }
         }
 
-        if section == 0 && dataSource.numberOfSections() > 1 || isSearching {
+        if section == 0 && dataSource.numberOfSections() > 1 {
             return (getHeaderHeight(), headerRichWorkspace, NCGlobal.shared.heightSection)
         } else if section == 0 && dataSource.numberOfSections() == 1 {
             return (getHeaderHeight(), headerRichWorkspace, 0)
@@ -1945,7 +1947,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
         if section == sections - 1 {
             return CGSize(width: collectionView.frame.width, height: NCGlobal.shared.endHeightFooter)
         } else {
-            return CGSize(width: collectionView.frame.width, height: 0)
+            return CGSize(width: collectionView.frame.width, height: heightFooter)
         }
     }
 }

+ 18 - 6
iOSClient/Main/Section Header Footer/NCSectionFooter.xib

@@ -1,11 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -16,6 +14,14 @@
             <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="s2m-yO-4x0" userLabel="separator">
+                    <rect key="frame" x="10" y="0.0" width="365" height="1"/>
+                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="1" id="FYD-Pc-spZ"/>
+                    </constraints>
+                </view>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn" userLabel="LabelFooter">
                     <rect key="frame" x="10" y="17" width="355" height="16"/>
                     <fontDescription key="fontDescription" type="system" pointSize="13"/>
@@ -23,15 +29,21 @@
                     <nil key="highlightedColor"/>
                 </label>
             </subviews>
+            <viewLayoutGuide key="safeArea" id="EFn-SN-cxu"/>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="gzy-cT-Gjn" secondAttribute="trailing" constant="10" id="QzY-ac-CRO"/>
+                <constraint firstItem="EFn-SN-cxu" firstAttribute="leading" secondItem="s2m-yO-4x0" secondAttribute="leading" constant="-10" id="ai4-Qy-YWi"/>
                 <constraint firstItem="gzy-cT-Gjn" firstAttribute="centerY" secondItem="Vin-9E-7nW" secondAttribute="centerY" id="avP-sX-JB5"/>
+                <constraint firstItem="s2m-yO-4x0" firstAttribute="top" secondItem="EFn-SN-cxu" secondAttribute="top" id="b9q-Zv-YmO"/>
+                <constraint firstItem="EFn-SN-cxu" firstAttribute="trailing" secondItem="s2m-yO-4x0" secondAttribute="trailing" id="dWj-wQ-cfb"/>
                 <constraint firstItem="gzy-cT-Gjn" firstAttribute="leading" secondItem="Vin-9E-7nW" secondAttribute="leading" constant="10" id="hZz-MT-pHg"/>
             </constraints>
-            <viewLayoutGuide key="safeArea" id="EFn-SN-cxu"/>
             <connections>
                 <outlet property="labelSection" destination="gzy-cT-Gjn" id="hhG-DH-GJc"/>
+                <outlet property="separator" destination="s2m-yO-4x0" id="iBM-eM-d33"/>
+                <outlet property="separatorHeightConstraint" destination="FYD-Pc-spZ" id="MBt-D9-VxE"/>
             </connections>
+            <point key="canvasLocation" x="138" y="154"/>
         </collectionReusableView>
     </objects>
 </document>

+ 3 - 16
iOSClient/Main/Section Header Footer/NCSectionHeader.xib

@@ -11,37 +11,24 @@
         <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="NCSectionHeader" 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="20"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn">
-                    <rect key="frame" x="10" y="16" width="355" height="18"/>
+                    <rect key="frame" x="10" y="1" width="355" height="18"/>
                     <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                     <nil key="textColor"/>
                     <nil key="highlightedColor"/>
                 </label>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B46-BA-IKR" userLabel="separator">
-                    <rect key="frame" x="50" y="49" width="325" height="1"/>
-                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                    <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="1" id="Tef-Rk-FCb"/>
-                    </constraints>
-                </view>
             </subviews>
             <viewLayoutGuide key="safeArea" id="EFn-SN-cxu"/>
             <constraints>
-                <constraint firstItem="EFn-SN-cxu" firstAttribute="bottom" secondItem="B46-BA-IKR" secondAttribute="bottom" id="EkR-MJ-zaA"/>
-                <constraint firstItem="EFn-SN-cxu" firstAttribute="leading" secondItem="B46-BA-IKR" secondAttribute="leading" constant="-50" id="PBx-z1-ALr"/>
+                <constraint firstItem="gzy-cT-Gjn" firstAttribute="centerY" secondItem="EFn-SN-cxu" secondAttribute="centerY" id="FhE-3o-krQ"/>
                 <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"/>
-                <constraint firstItem="B46-BA-IKR" firstAttribute="trailing" secondItem="EFn-SN-cxu" secondAttribute="trailing" id="dsu-fv-NmK"/>
                 <constraint firstItem="gzy-cT-Gjn" firstAttribute="leading" secondItem="Vin-9E-7nW" secondAttribute="leading" constant="10" id="hZz-MT-pHg"/>
             </constraints>
             <connections>
                 <outlet property="labelSection" destination="gzy-cT-Gjn" id="gfz-ks-qSP"/>
-                <outlet property="separator" destination="B46-BA-IKR" id="ZeR-MO-lBU"/>
-                <outlet property="separatorHeightConstraint" destination="Tef-Rk-FCb" id="Png-Ox-9YB"/>
             </connections>
             <point key="canvasLocation" x="138" y="154"/>
         </collectionReusableView>

+ 22 - 11
iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift

@@ -48,8 +48,6 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
 
     @IBOutlet weak var textViewRichWorkspace: UITextView!
     @IBOutlet weak var labelSection: UILabel!
-    @IBOutlet weak var separatorSection: UIView!
-    @IBOutlet weak var separatorSectionHeightConstraint: NSLayoutConstraint!
 
     weak var delegate: NCSectionHeaderMenuDelegate?
 
@@ -114,8 +112,6 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
 
         labelSection.text = ""
         viewSectionHeightConstraint.constant = 0
-        separatorSection.backgroundColor = NCBrandColor.shared.separator
-        separatorSectionHeightConstraint.constant = 0.5
     }
 
     override func layoutSublayers(of layer: CALayer) {
@@ -125,18 +121,21 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
 
     override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
         super.traitCollectionDidChange(previousTraitCollection)
+
         setInterfaceColor()
     }
 
     //MARK: - Command
 
     func setStatusButtonsCommand(enable: Bool) {
+
         button1.isEnabled = enable
         button2.isEnabled = enable
         button3.isEnabled = enable
     }
 
     func setButtonsCommand(heigt :CGFloat, imageButton1: UIImage? = nil, titleButton1: String? = nil, imageButton2: UIImage? = nil, titleButton2: String? = nil, imageButton3: UIImage? = nil, titleButton3: String? = nil) {
+
         viewButtonsCommandHeightConstraint.constant = heigt
         if heigt == 0 {
             viewButtonsView.isHidden = true
@@ -169,24 +168,29 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     //MARK: - View
 
     func setStatusButtonsView(enable: Bool) {
+
         buttonSwitch.isEnabled = enable
         buttonOrder.isEnabled = enable
         buttonMore.isEnabled = enable
     }
 
     func buttonMoreIsHidden(_ isHidden: Bool) {
+
         buttonMore.isHidden = isHidden
     }
 
     func setImageSwitchList() {
+
         buttonSwitch.setImage(UIImage(named: "switchList")!.image(color: NCBrandColor.shared.systemGray1, size: 50), for: .normal)
     }
 
     func setImageSwitchGrid() {
+
         buttonSwitch.setImage(UIImage(named: "switchGrid")!.image(color: NCBrandColor.shared.systemGray1, size: 50), for: .normal)
     }
 
     func setButtonsView(heigt :CGFloat) {
+
         viewButtonsViewHeightConstraint.constant = heigt
         if heigt == 0 {
             viewButtonsView.isHidden = true
@@ -206,6 +210,7 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     //MARK: - RichWorkspace
 
     func setRichWorkspaceHeight(_ size: CGFloat) {
+
         viewRichWorkspaceHeightConstraint.constant = size
         if size == 0 {
             viewRichWorkspace.isHidden = true
@@ -215,17 +220,17 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     }
 
     func setInterfaceColor() {
+
         if traitCollection.userInterfaceStyle == .dark {
             gradient.colors = [UIColor(white: 0, alpha: 0).cgColor, UIColor.black.cgColor]
-            //viewSeparator.backgroundColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.0)
         } else {
             gradient.colors = [UIColor(white: 1, alpha: 0).cgColor, UIColor.white.cgColor]
-            //viewSeparator.backgroundColor = UIColor(red: 0.79, green: 0.79, blue: 0.79, alpha: 1.0)
         }
     }
 
     func setRichWorkspaceText(_ text: String?) {
         guard let text = text else { return }
+
         if text != self.richWorkspaceText {
             textViewRichWorkspace.attributedText = markdownParser.parse(text)
             self.richWorkspaceText = text
@@ -235,6 +240,7 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     //MARK: - Section
 
     func setSectionHeight(_ size:CGFloat) {
+
         viewSectionHeightConstraint.constant = size
         if size == 0 {
             viewSection.isHidden = true
@@ -298,29 +304,29 @@ extension NCSectionHeaderMenuDelegate {
 class NCSectionHeader: UICollectionReusableView {
 
     @IBOutlet weak var labelSection: UILabel!
-    @IBOutlet weak var separator: UIView!
-    @IBOutlet weak var separatorHeightConstraint: NSLayoutConstraint!
 
     override func awakeFromNib() {
         super.awakeFromNib()
 
         self.backgroundColor = UIColor.clear
         self.labelSection.text = ""
-
-        separator.backgroundColor = NCBrandColor.shared.separator
-        separatorHeightConstraint.constant = 0.5
     }
 }
 
 class NCSectionFooter: UICollectionReusableView {
 
     @IBOutlet weak var labelSection: UILabel!
+    @IBOutlet weak var separator: UIView!
+    @IBOutlet weak var separatorHeightConstraint: NSLayoutConstraint!
 
     override func awakeFromNib() {
         super.awakeFromNib()
 
         self.backgroundColor = UIColor.clear
         labelSection.textColor = NCBrandColor.shared.gray
+
+        separator.backgroundColor = NCBrandColor.shared.separator
+        separatorHeightConstraint.constant = 0.5
     }
 
     func setTitleLabel(directories: Int, files: Int, size: Int64) {
@@ -353,4 +359,9 @@ class NCSectionFooter: UICollectionReusableView {
 
         labelSection.text = text
     }
+
+    func separatorIsHidden(_ isHidden: Bool) {
+
+        separator.isHidden = isHidden
+    }
 }

+ 5 - 18
iOSClient/Main/Section Header Footer/NCSectionHeaderMenu.xib

@@ -123,7 +123,7 @@
                     </constraints>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NC1-5C-E5z" userLabel="View RichWorkspace">
-                    <rect key="frame" x="0.0" y="111" width="551" height="50"/>
+                    <rect key="frame" x="0.0" y="141" width="551" height="50"/>
                     <subviews>
                         <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="pYo-pF-MGv">
                             <rect key="frame" x="5" y="0.0" width="541" height="50"/>
@@ -142,30 +142,19 @@
                     </constraints>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="f9U-NY-4OS">
-                    <rect key="frame" x="0.0" y="161" width="551" height="50"/>
+                    <rect key="frame" x="0.0" y="191" width="551" height="20"/>
                     <subviews>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mB5-5n-AL9">
-                            <rect key="frame" x="10" y="16" width="531" height="18"/>
+                            <rect key="frame" x="10" y="1" width="531" height="18"/>
                             <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                             <nil key="textColor"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="quO-U8-m9B">
-                            <rect key="frame" x="50" y="50" width="501" height="1"/>
-                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                            <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="1" id="dSE-nA-ELX"/>
-                            </constraints>
-                        </view>
                     </subviews>
                     <constraints>
                         <constraint firstAttribute="trailing" secondItem="mB5-5n-AL9" secondAttribute="trailing" constant="10" id="Cct-8N-ghQ"/>
-                        <constraint firstAttribute="trailing" secondItem="quO-U8-m9B" secondAttribute="trailing" id="L8y-G9-wWa"/>
-                        <constraint firstItem="mB5-5n-AL9" firstAttribute="centerY" secondItem="f9U-NY-4OS" secondAttribute="centerY" id="Uom-oG-Fd7"/>
-                        <constraint firstItem="quO-U8-m9B" firstAttribute="top" secondItem="f9U-NY-4OS" secondAttribute="bottom" id="Y2Z-4C-qQt"/>
-                        <constraint firstAttribute="height" constant="50" id="ZcL-Wd-xhN"/>
-                        <constraint firstItem="quO-U8-m9B" firstAttribute="leading" secondItem="f9U-NY-4OS" secondAttribute="leading" constant="50" id="jd8-j4-wwL"/>
+                        <constraint firstAttribute="height" constant="20" id="ZcL-Wd-xhN"/>
+                        <constraint firstItem="mB5-5n-AL9" firstAttribute="centerY" secondItem="f9U-NY-4OS" secondAttribute="centerY" id="ca2-J7-HaE"/>
                         <constraint firstItem="mB5-5n-AL9" firstAttribute="leading" secondItem="f9U-NY-4OS" secondAttribute="leading" constant="10" id="xQp-zk-G00"/>
                     </constraints>
                 </view>
@@ -196,8 +185,6 @@
                 <outlet property="buttonOrder" destination="0bo-yl-t5k" id="Kbw-BG-73C"/>
                 <outlet property="buttonSwitch" destination="1LD-cd-zhc" id="Ec2-cM-CoY"/>
                 <outlet property="labelSection" destination="mB5-5n-AL9" id="uxf-bN-nZA"/>
-                <outlet property="separatorSection" destination="quO-U8-m9B" id="xoD-zk-vFV"/>
-                <outlet property="separatorSectionHeightConstraint" destination="dSE-nA-ELX" id="TRp-JD-C7F"/>
                 <outlet property="textViewRichWorkspace" destination="pYo-pF-MGv" id="2h4-LP-T1z"/>
                 <outlet property="viewButtonsCommand" destination="4m9-yf-RbB" id="d1a-Pc-ujo"/>
                 <outlet property="viewButtonsCommandHeightConstraint" destination="aJx-Rv-Dc0" id="58a-bd-5ri"/>

+ 2 - 1
iOSClient/NCGlobal.swift

@@ -184,7 +184,8 @@ class NCGlobal: NSObject {
     // Standard height sections header/footer
     let heightButtonsCommand: CGFloat               = 50
     let heightButtonsView: CGFloat                  = 50
-    let heightSection: CGFloat                      = 50
+    let heightSection: CGFloat                      = 30
+    let heightFooter: CGFloat                       = 20
     let endHeightFooter: CGFloat                    = 80
 
     // Text -  OnlyOffice - Collabora - QuickLook