Browse Source

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 năm trước cách đây
mục cha
commit
533a2db372

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

@@ -54,8 +54,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     internal var listLayout: NCListLayout!
     internal var gridLayout: NCGridLayout!
 
-    internal let heightButtonsOne: CGFloat = 60
-    internal let heightButtonsTwo: CGFloat = 40
+    internal let heightButtonsCommand: CGFloat = 60
+    internal let heightButtonsView: CGFloat = 40
     internal let heightSection: CGFloat = 50
     internal let footerHeight: CGFloat = 0
     internal let footerEndHeight: CGFloat = 100
@@ -122,7 +122,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         }
 
         // Empty
-        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsOne + heightButtonsTwo, delegate: self)
+        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsCommand + heightButtonsView, delegate: self)
 
         // Long Press on CollectionView
         let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressCollecationView(_:)))
@@ -1823,8 +1823,8 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
                 header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath).firstUppercased
                 header.labelSection.textColor = NCBrandColor.shared.brandElement
 
-                header.setButtonsOneHeight(heightButtonsOne)
-                header.setButtonsTwoHeight(heightButtonsTwo, imageButton1: UIImage(named: "buttonAddImage"), imageButton2: UIImage(named: "buttonAddFolder"), imageButton3: UIImage(named: "buttonAddScan"))
+                header.setButtonsView(heigt: heightButtonsView)
+                header.setButtonsCommand(heigt: heightButtonsCommand, imageButton1: UIImage(named: "buttonAddImage"), titleButton1: NSLocalizedString("_upload_", comment: ""), imageButton2: UIImage(named: "buttonAddFolder"), titleButton2: NSLocalizedString("_folder_", comment: ""), imageButton3: UIImage(named: "buttonAddScan"), titleButton3: NSLocalizedString("_scan_", comment: ""))
                 header.setRichWorkspaceHeight(heightHeaderRichWorkspace)
                 header.setSectionHeight(heightHeaderSection)
 
@@ -1870,9 +1870,9 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
         }
 
         if section == 0 && dataSource.numberOfSections() > 1 {
-            return (heightButtonsOne + heightButtonsTwo, headerRichWorkspace, heightSection)
+            return (heightButtonsCommand + heightButtonsView, headerRichWorkspace, heightSection)
         } else if section == 0 && dataSource.numberOfSections() == 1 {
-            return (heightButtonsOne + heightButtonsTwo, headerRichWorkspace, 0)
+            return (heightButtonsCommand + heightButtonsView, headerRichWorkspace, 0)
         } else if section > 0 && dataSource.numberOfSections() > 1 {
             return (0, 0, heightSection)
         } else {

+ 21 - 20
iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift

@@ -34,14 +34,14 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
     @IBOutlet weak var button2: UIButton!
     @IBOutlet weak var button3: UIButton!
 
-    @IBOutlet weak var viewButtonsOne: UIView!
-    @IBOutlet weak var viewButtonsTwo: UIView!
+    @IBOutlet weak var viewButtonsCommand: UIView!
+    @IBOutlet weak var viewButtonsView: UIView!
     @IBOutlet weak var viewSeparator: UIView!
     @IBOutlet weak var viewRichWorkspace: UIView!
     @IBOutlet weak var viewSection: UIView!
 
-    @IBOutlet weak var viewButtonsOneHeightConstraint: NSLayoutConstraint!
-    @IBOutlet weak var viewButtonsTwoHeightConstraint: NSLayoutConstraint!
+    @IBOutlet weak var viewButtonsCommandHeightConstraint: NSLayoutConstraint!
+    @IBOutlet weak var viewButtonsViewHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var viewSeparatorHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var viewRichWorkspaceHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var viewSectionHeightConstraint: NSLayoutConstraint!
@@ -72,7 +72,6 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         button1.isHidden = true
         button1.backgroundColor = .clear
         button1.setTitleColor(.systemBlue, for: .normal)
-        button1.setTitle(NSLocalizedString("_upload_", comment: "").firstUppercased, for: .normal)
         button1.layer.borderColor = NCBrandColor.shared.systemGray1.cgColor
         button1.layer.borderWidth = 0.3
         button1.layer.cornerRadius = 3
@@ -81,7 +80,6 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         button2.isHidden = true
         button2.backgroundColor = .clear
         button2.setTitleColor(.systemBlue, for: .normal)
-        button2.setTitle(NSLocalizedString("_folder_", comment: "").firstUppercased, for: .normal)
         button2.layer.borderColor = NCBrandColor.shared.systemGray1.cgColor
         button2.layer.borderWidth = 0.3
         button2.layer.cornerRadius = 3
@@ -90,7 +88,7 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         button3.isHidden = true
         button3.backgroundColor = .clear
         button3.setTitleColor(.systemBlue, for: .normal)
-        button3.setTitle(NSLocalizedString("_scan_", comment: "").firstUppercased, for: .normal)
+        //button3.setTitle(NSLocalizedString("_scan_", comment: "").firstUppercased, for: .normal)
         button3.layer.borderColor = NCBrandColor.shared.systemGray1.cgColor
         button3.layer.borderWidth = 0.3
         button3.layer.cornerRadius = 3
@@ -183,36 +181,39 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate
         buttonSwitch.setImage(UIImage(named: "switchGrid")!.image(color: NCBrandColor.shared.systemGray1, size: 50), for: .normal)
     }
 
-    func setButtonsOneHeight(_ size:CGFloat) {
-        viewButtonsOneHeightConstraint.constant = size
-        if size == 0 {
-            viewButtonsOne.isHidden = true
+    func setButtonsView(heigt :CGFloat) {
+        viewButtonsCommandHeightConstraint.constant = heigt
+        if heigt == 0 {
+            viewButtonsCommand.isHidden = true
         } else {
-            viewButtonsOne.isHidden = false
+            viewButtonsCommand.isHidden = false
         }
     }
 
-    func setButtonsTwoHeight(_ size:CGFloat, imageButton1: UIImage? = nil, imageButton2: UIImage? = nil, imageButton3: UIImage? = nil) {
-        viewButtonsTwoHeightConstraint.constant = size
-        if size == 0 {
-            viewButtonsTwo.isHidden = true
+    func setButtonsCommand(heigt :CGFloat, imageButton1: UIImage? = nil, titleButton1: String? = nil, imageButton2: UIImage? = nil, titleButton2: String? = nil, imageButton3: UIImage? = nil, titleButton3: String? = nil) {
+        viewButtonsViewHeightConstraint.constant = heigt
+        if heigt == 0 {
+            viewButtonsView.isHidden = true
         } else {
-            viewButtonsTwo.isHidden = false
+            viewButtonsView.isHidden = false
         }
-        if var image = imageButton1 {
+        if var image = imageButton1, let title = titleButton1 {
             image = image.image(color: NCBrandColor.shared.systemGray1, size: 25)
             button1.setImage(image, for: .normal)
             button1.isHidden = false
+            button1.setTitle(title.firstUppercased, for: .normal)
         }
-        if var image = imageButton2 {
+        if var image = imageButton2, let title = titleButton2 {
             image = image.image(color: NCBrandColor.shared.systemGray1, size: 25)
             button2.setImage(image, for: .normal)
             button2.isHidden = false
+            button2.setTitle(title.firstUppercased, for: .normal)
         }
-        if var image = imageButton3 {
+        if var image = imageButton3, let title = titleButton3 {
             image = image.image(color: NCBrandColor.shared.systemGray1, size: 25)
             button3.setImage(image, for: .normal)
             button3.isHidden = false
+            button3.setTitle(title.firstUppercased, for: .normal)
         }
     }
 

+ 4 - 4
iOSClient/Main/Section Header Footer/NCSectionHeaderMenu.xib

@@ -186,10 +186,10 @@
                 <outlet property="buttonSwitch" destination="1LD-cd-zhc" id="Ec2-cM-CoY"/>
                 <outlet property="labelSection" destination="mB5-5n-AL9" id="uxf-bN-nZA"/>
                 <outlet property="textViewRichWorkspace" destination="pYo-pF-MGv" id="2h4-LP-T1z"/>
-                <outlet property="viewButtonsOne" destination="4m9-yf-RbB" id="ym1-m0-plm"/>
-                <outlet property="viewButtonsOneHeightConstraint" destination="aJx-Rv-Dc0" id="rk9-2d-ia8"/>
-                <outlet property="viewButtonsTwo" destination="s4I-Jo-yCE" id="15J-J1-EAl"/>
-                <outlet property="viewButtonsTwoHeightConstraint" destination="vvG-dH-6c1" id="ELG-Xi-vlb"/>
+                <outlet property="viewButtonsCommand" destination="4m9-yf-RbB" id="d1a-Pc-ujo"/>
+                <outlet property="viewButtonsCommandHeightConstraint" destination="aJx-Rv-Dc0" id="58a-bd-5ri"/>
+                <outlet property="viewButtonsView" destination="s4I-Jo-yCE" id="FOI-ZK-1oj"/>
+                <outlet property="viewButtonsViewHeightConstraint" destination="vvG-dH-6c1" id="SEQ-Tn-EE0"/>
                 <outlet property="viewRichWorkspace" destination="NC1-5C-E5z" id="NyN-tr-sJl"/>
                 <outlet property="viewRichWorkspaceHeightConstraint" destination="eT3-4m-mJ6" id="agb-tE-jhw"/>
                 <outlet property="viewSection" destination="f9U-NY-4OS" id="idM-C9-2nP"/>

+ 7 - 7
iOSClient/Select/NCSelect.swift

@@ -80,8 +80,8 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
     private var listLayout: NCListLayout!
     private var gridLayout: NCGridLayout!
 
-    private let heightButtonsOne: CGFloat = 0
-    private let heightButtonsTwo: CGFloat = 40
+    private let heightButtonsCommand: CGFloat = 0
+    private let heightButtonsView: CGFloat = 40
     private let heightSection: CGFloat = 50
     private let footerHeight: CGFloat = 0
     private let footerEndHeight: CGFloat = 100
@@ -124,7 +124,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
         bottomContraint?.constant = UIApplication.shared.keyWindow?.rootViewController?.view.safeAreaInsets.bottom ?? 0
 
         // Empty
-        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsOne + heightButtonsTwo, delegate: self)
+        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsCommand + heightButtonsView, delegate: self)
 
         // Type of command view
         if typeOfCommandView == .select || typeOfCommandView == .selectCreateFolder {
@@ -630,8 +630,8 @@ extension NCSelect: UICollectionViewDataSource {
                 header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath).firstUppercased
                 header.labelSection.textColor = NCBrandColor.shared.brandElement
 
-                header.setButtonsOneHeight(heightButtonsOne)
-                header.setButtonsTwoHeight(heightButtonsTwo)
+                header.setButtonsCommand(heigt: heightButtonsCommand)
+                header.setButtonsView(heigt: heightButtonsView)
                 header.setRichWorkspaceHeight(heightHeaderRichWorkspace)
                 header.setSectionHeight(heightHeaderSection)
 
@@ -677,9 +677,9 @@ extension NCSelect: UICollectionViewDelegateFlowLayout {
         }
 
         if section == 0 && dataSource.numberOfSections() > 1 {
-            return (heightButtonsOne + heightButtonsTwo, headerRichWorkspace, heightSection)
+            return (heightButtonsCommand + heightButtonsView, headerRichWorkspace, heightSection)
         } else if section == 0 && dataSource.numberOfSections() == 1 {
-            return (heightButtonsOne + heightButtonsTwo, headerRichWorkspace, 0)
+            return (heightButtonsCommand + heightButtonsView, headerRichWorkspace, 0)
         } else if section > 0 && dataSource.numberOfSections() > 1 {
             return (0, 0, heightSection)
         } else {

+ 3 - 3
iOSClient/Trash/NCTrash+CollectionView.swift

@@ -159,8 +159,8 @@ extension NCTrash: UICollectionViewDataSource {
             header.setSortedTitle(layoutForView?.titleButtonHeader ?? "")
 
             header.buttonMoreIsHidden(false)
-            header.setButtonsOneHeight(0)
-            header.setButtonsTwoHeight(heightButtonsTwo)
+            header.setButtonsCommand(heigt: 0)
+            header.setButtonsView(heigt: heightButtonsView)
             header.setRichWorkspaceHeight(0)
             header.setSectionHeight(0)
 
@@ -182,7 +182,7 @@ extension NCTrash: UICollectionViewDataSource {
 extension NCTrash: UICollectionViewDelegateFlowLayout {
 
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
-        return CGSize(width: collectionView.frame.width, height: heightButtonsTwo)
+        return CGSize(width: collectionView.frame.width, height: heightButtonsView)
     }
 
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {

+ 2 - 2
iOSClient/Trash/NCTrash.swift

@@ -47,7 +47,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
     var listLayout: NCListLayout!
     var gridLayout: NCGridLayout!
 
-    internal let heightButtonsTwo: CGFloat = 40
+    internal let heightButtonsView: CGFloat = 40
     internal let footerEndHeight: CGFloat = 100
 
     private let refreshControl = UIRefreshControl()
@@ -79,7 +79,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
         refreshControl.addTarget(self, action: #selector(loadListingTrash), for: .valueChanged)
 
         // Empty
-        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsTwo, delegate: self)
+        emptyDataSet = NCEmptyDataSet(view: collectionView, offset: heightButtonsView, delegate: self)
 
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSource), object: nil)