소스 검색

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 년 전
부모
커밋
5d83ea748d

+ 8 - 8
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -54,7 +54,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     internal var listLayout: NCListLayout!
     internal var gridLayout: NCGridLayout!
 
-    let headerCommand: CGFloat = 50
+    let headerCommands: CGFloat = 50 + 40 + 10 // (50 Layout + 40 Button + 10 space)
     let headerSection: CGFloat = 50
 
     private let footerHeight: CGFloat = 0
@@ -122,7 +122,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         }
 
         // Empty
-        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: headerCommand, delegate: self)
+        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: headerCommands, delegate: self)
 
         // Long Press on CollectionView
         let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressCollecationView(_:)))
@@ -677,21 +677,21 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         return userAlias
     }
 
-    func getHeaderHeight(section:Int) -> (heightHeaderCommand: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
+    func getHeaderHeight(section:Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
 
         var headerRichWorkspace: CGFloat = 0
 
         if let richWorkspaceText = richWorkspaceText {
             let trimmed = richWorkspaceText.trimmingCharacters(in: .whitespaces)
             if trimmed.count > 0 && !isSearching {
-                headerRichWorkspace = UIScreen.main.bounds.size.height / 4
+                headerRichWorkspace = UIScreen.main.bounds.size.height / 6
             }
         }
 
         if section == 0 && dataSource.numberOfSections() > 1 {
-            return (headerCommand, headerRichWorkspace, headerSection)
+            return (headerCommands, headerRichWorkspace, headerSection)
         } else if section == 0 && dataSource.numberOfSections() == 1 {
-            return (headerCommand, headerRichWorkspace, 0)
+            return (headerCommands, headerRichWorkspace, 0)
         } else if section > 0 && dataSource.numberOfSections() > 1 {
             return (0, 0, headerSection)
         } else {
@@ -1852,9 +1852,9 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
 
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
 
-        let (heightHeaderCommand, heightHeaderRichWorkspace, heightHeaderSection) = getHeaderHeight(section: section)
+        let (heightHeaderCommands, heightHeaderRichWorkspace, heightHeaderSection) = getHeaderHeight(section: section)
 
-        return CGSize(width: collectionView.frame.width, height: heightHeaderCommand + heightHeaderRichWorkspace + heightHeaderSection)
+        return CGSize(width: collectionView.frame.width, height: heightHeaderCommands + heightHeaderRichWorkspace + heightHeaderSection)
     }
 
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {

+ 14 - 0
iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift

@@ -29,6 +29,8 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     @IBOutlet weak var buttonMore: UIButton!
     @IBOutlet weak var buttonSwitch: UIButton!
     @IBOutlet weak var buttonOrder: UIButton!
+    @IBOutlet weak var buttonUpload: UIButton!
+
     @IBOutlet weak var buttonOrderWidthConstraint: NSLayoutConstraint!
     @IBOutlet weak var viewRichWorkspace: UIView!
     @IBOutlet weak var textViewRichWorkspace: UITextView!
@@ -58,6 +60,14 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         buttonOrder.setTitleColor(.systemBlue, for: .normal)
         buttonMore.setImage(UIImage(named: "more")!.image(color: NCBrandColor.shared.gray, size: 25), for: .normal)
 
+        buttonUpload.backgroundColor = .red
+        buttonUpload.setTitleColor(NCBrandColor.shared.brandElement, for: .normal)
+        buttonUpload.setTitle(NSLocalizedString("_upload_", comment: ""), for: .normal)
+        buttonUpload.layer.borderColor = UIColor.yellow.cgColor
+        buttonUpload.layer.borderWidth = 0.5
+        buttonUpload.layer.cornerRadius = 5
+        buttonUpload.setImage( UIImage(named: "file_photo")!.image(color: NCBrandColor.shared.brandElement, size: 25), for: .normal)
+
         // Gradient
         gradient.startPoint = CGPoint(x: 0, y: 0.50)
         gradient.endPoint = CGPoint(x: 0, y: 1)
@@ -155,6 +165,10 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         delegate?.tapOrderHeader(sender: sender)
     }
 
+    @IBAction func touchUpInsideButtonUpload(_ sender: Any) {
+       
+    }
+
     @objc func touchUpInsideViewRichWorkspace(_ sender: Any) {
         delegate?.tapRichWorkspace(sender: sender)
     }

+ 29 - 14
iOSClient/Main/Section Header Footer/NCSectionHeaderMenu.xib

@@ -12,14 +12,14 @@
         <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="sectionHeaderMenu" id="tys-A2-nDX" customClass="NCSectionHeaderMenu" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="375" height="150"/>
+            <rect key="frame" x="0.0" y="0.0" width="551" height="211"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QBu-GJ-Y52" userLabel="View Menu">
-                    <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+                    <rect key="frame" x="0.0" y="0.0" width="551" height="111"/>
                     <subviews>
                         <button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1LD-cd-zhc" userLabel="buttonSwitch">
-                            <rect key="frame" x="12" y="12.5" width="25" height="25"/>
+                            <rect key="frame" x="12" y="10" width="25" height="25"/>
                             <constraints>
                                 <constraint firstAttribute="width" constant="25" id="D76-X9-Tw9"/>
                                 <constraint firstAttribute="height" constant="25" id="izT-Ru-XYG"/>
@@ -30,7 +30,7 @@
                             </connections>
                         </button>
                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0bo-yl-t5k" userLabel="buttonOrder">
-                            <rect key="frame" x="55" y="11" width="230" height="28"/>
+                            <rect key="frame" x="55" y="8.5" width="230" height="28"/>
                             <constraints>
                                 <constraint firstAttribute="width" constant="230" id="jvv-Ug-l3I"/>
                             </constraints>
@@ -43,7 +43,7 @@
                             </connections>
                         </button>
                         <button hidden="YES" opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="D0O-wK-14O" userLabel="buttonSwitch">
-                            <rect key="frame" x="338" y="12.5" width="25" height="25"/>
+                            <rect key="frame" x="514" y="10" width="25" height="25"/>
                             <constraints>
                                 <constraint firstAttribute="width" constant="25" id="aEr-j8-JDO"/>
                                 <constraint firstAttribute="height" constant="25" id="bvx-Uh-NWD"/>
@@ -54,31 +54,44 @@
                             </connections>
                         </button>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LZu-Te-clJ" userLabel="Separator">
-                            <rect key="frame" x="0.0" y="49" width="375" height="1"/>
+                            <rect key="frame" x="0.0" y="110" width="551" 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="VuP-sT-hUI"/>
                             </constraints>
                         </view>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hie-dN-B9L">
+                            <rect key="frame" x="10" y="61" width="104.5" height="40"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="40" id="X1Q-Rt-PQI"/>
+                            </constraints>
+                            <state key="normal" title="Button"/>
+                            <buttonConfiguration key="configuration" style="plain" image="tv" catalog="system" title="Button 1"/>
+                            <connections>
+                                <action selector="touchUpInsideButtonUpload:" destination="tys-A2-nDX" eventType="touchUpInside" id="PRS-wE-LRC"/>
+                            </connections>
+                        </button>
                     </subviews>
                     <constraints>
+                        <constraint firstItem="Hie-dN-B9L" firstAttribute="leading" secondItem="QBu-GJ-Y52" secondAttribute="leading" constant="10" id="1BO-pk-3cu"/>
                         <constraint firstItem="1LD-cd-zhc" firstAttribute="leading" secondItem="QBu-GJ-Y52" secondAttribute="leading" constant="12" id="3bI-Ld-Ddl"/>
                         <constraint firstAttribute="trailing" secondItem="LZu-Te-clJ" secondAttribute="trailing" id="4Ue-ug-B6K"/>
-                        <constraint firstItem="1LD-cd-zhc" firstAttribute="centerY" secondItem="QBu-GJ-Y52" secondAttribute="centerY" id="AJf-bs-tiq"/>
+                        <constraint firstItem="1LD-cd-zhc" firstAttribute="top" secondItem="QBu-GJ-Y52" secondAttribute="top" constant="10" id="6P3-o3-2qv"/>
                         <constraint firstAttribute="bottom" secondItem="LZu-Te-clJ" secondAttribute="bottom" id="DDK-aB-wEh"/>
+                        <constraint firstAttribute="bottom" secondItem="Hie-dN-B9L" secondAttribute="bottom" constant="10" id="QAZ-i4-RLP"/>
+                        <constraint firstItem="D0O-wK-14O" firstAttribute="centerY" secondItem="1LD-cd-zhc" secondAttribute="centerY" id="bgO-UA-bhj"/>
                         <constraint firstItem="LZu-Te-clJ" firstAttribute="leading" secondItem="QBu-GJ-Y52" secondAttribute="leading" id="c4q-XY-3mD"/>
-                        <constraint firstItem="D0O-wK-14O" firstAttribute="centerY" secondItem="QBu-GJ-Y52" secondAttribute="centerY" id="d0X-sZ-v5c"/>
-                        <constraint firstItem="0bo-yl-t5k" firstAttribute="centerY" secondItem="QBu-GJ-Y52" secondAttribute="centerY" id="d2r-aK-x8q"/>
                         <constraint firstAttribute="trailing" secondItem="D0O-wK-14O" secondAttribute="trailing" constant="12" id="qZw-Ob-In1"/>
                         <constraint firstItem="0bo-yl-t5k" firstAttribute="leading" secondItem="1LD-cd-zhc" secondAttribute="trailing" constant="18" id="tBF-23-TJ4"/>
+                        <constraint firstItem="0bo-yl-t5k" firstAttribute="centerY" secondItem="1LD-cd-zhc" secondAttribute="centerY" id="wdV-T7-dwy"/>
                     </constraints>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NC1-5C-E5z" userLabel="View RichWorkspace">
-                    <rect key="frame" x="0.0" y="50" width="375" height="50"/>
+                    <rect key="frame" x="0.0" y="111" 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="365" height="50"/>
+                            <rect key="frame" x="5" y="0.0" width="541" height="50"/>
                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             <color key="textColor" systemColor="labelColor"/>
                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -94,10 +107,10 @@
                     </constraints>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="f9U-NY-4OS">
-                    <rect key="frame" x="0.0" y="100" width="375" height="50"/>
+                    <rect key="frame" x="0.0" y="161" width="551" height="50"/>
                     <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.5" width="355" height="17"/>
+                            <rect key="frame" x="10" y="16.5" width="531" height="17"/>
                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                             <nil key="textColor"/>
                             <nil key="highlightedColor"/>
@@ -129,6 +142,7 @@
                 <outlet property="buttonOrder" destination="0bo-yl-t5k" id="Kbw-BG-73C"/>
                 <outlet property="buttonOrderWidthConstraint" destination="jvv-Ug-l3I" id="E6N-z6-2VC"/>
                 <outlet property="buttonSwitch" destination="1LD-cd-zhc" id="Ec2-cM-CoY"/>
+                <outlet property="buttonUpload" destination="Hie-dN-B9L" id="AfM-W6-RDX"/>
                 <outlet property="labelSection" destination="mB5-5n-AL9" id="uxf-bN-nZA"/>
                 <outlet property="separator" destination="LZu-Te-clJ" id="EwO-za-LxT"/>
                 <outlet property="separatorHeightConstraint" destination="VuP-sT-hUI" id="5wS-ww-yKo"/>
@@ -138,12 +152,13 @@
                 <outlet property="viewSection" destination="f9U-NY-4OS" id="idM-C9-2nP"/>
                 <outlet property="viewSectionHeightConstraint" destination="ZcL-Wd-xhN" id="RDs-yy-I6W"/>
             </connections>
-            <point key="canvasLocation" x="124" y="140.32983508245877"/>
+            <point key="canvasLocation" x="349.60000000000002" y="55.322338830584712"/>
         </collectionReusableView>
     </objects>
     <resources>
         <image name="moreBig" width="50" height="50"/>
         <image name="switchList" width="25" height="25"/>
+        <image name="tv" catalog="system" width="128" height="97"/>
         <systemColor name="darkTextColor">
             <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>