marinofaggiana %!s(int64=4) %!d(string=hai) anos
pai
achega
be8e79becc

+ 0 - 96
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1498,99 +1498,3 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
         return CGSize(width: collectionView.frame.width, height: footerHeight)
     }
 }
-
-// MARK: - List Layout
-
-class NCListLayout: UICollectionViewFlowLayout {
-    
-    var itemHeight: CGFloat = 60
-    
-    override init() {
-        super.init()
-        
-        sectionHeadersPinToVisibleBounds = false
-        
-        minimumInteritemSpacing = 0
-        minimumLineSpacing = 1
-        
-        self.scrollDirection = .vertical
-        self.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
-    override var itemSize: CGSize {
-        get {
-            if let collectionView = collectionView {
-                let itemWidth: CGFloat = collectionView.frame.width
-                return CGSize(width: itemWidth, height: self.itemHeight)
-            }
-            
-            // Default fallback
-            return CGSize(width: 100, height: 100)
-        }
-        set {
-            super.itemSize = newValue
-        }
-    }
-    
-    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
-        return proposedContentOffset
-    }
-}
-
-// MARK: - Grid Layout
-
-class NCGridLayout: UICollectionViewFlowLayout {
-    
-    var heightLabelPlusButton: CGFloat = 45
-    var marginLeftRight: CGFloat = 6
-    var itemForLine: CGFloat = 3
-    var itemWidthDefault: CGFloat = 120
-
-    override init() {
-        super.init()
-        
-        sectionHeadersPinToVisibleBounds = false
-        
-        minimumInteritemSpacing = 1
-        minimumLineSpacing = marginLeftRight
-        
-        self.scrollDirection = .vertical
-        self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 0, right:  marginLeftRight)
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
-    override var itemSize: CGSize {
-        get {
-            if let collectionView = collectionView {
-                
-                if collectionView.frame.width < 400 {
-                    itemForLine = 3
-                } else {
-                    itemForLine = collectionView.frame.width / itemWidthDefault
-                }
-                
-                let itemWidth: CGFloat = (collectionView.frame.width - marginLeftRight * 2 - marginLeftRight * (itemForLine - 1)) / itemForLine
-                let itemHeight: CGFloat = itemWidth + heightLabelPlusButton
-                
-                return CGSize(width: itemWidth, height: itemHeight)
-            }
-            
-            // Default fallback
-            return CGSize(width: itemWidthDefault, height: itemWidthDefault)
-        }
-        set {
-            super.itemSize = newValue
-        }
-    }
-    
-    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
-        return proposedContentOffset
-    }
-}

+ 54 - 0
iOSClient/Main/Collection Common/NCGridCell.swift

@@ -128,3 +128,57 @@ protocol NCGridCellDelegate {
     func longPressMoreGridItem(with objectId: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
     func longPressGridItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer)
 }
+
+// MARK: - Grid Layout
+
+class NCGridLayout: UICollectionViewFlowLayout {
+    
+    var heightLabelPlusButton: CGFloat = 45
+    var marginLeftRight: CGFloat = 6
+    var itemForLine: CGFloat = 3
+    var itemWidthDefault: CGFloat = 120
+
+    override init() {
+        super.init()
+        
+        sectionHeadersPinToVisibleBounds = false
+        
+        minimumInteritemSpacing = 1
+        minimumLineSpacing = marginLeftRight
+        
+        self.scrollDirection = .vertical
+        self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 0, right:  marginLeftRight)
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    override var itemSize: CGSize {
+        get {
+            if let collectionView = collectionView {
+                
+                if collectionView.frame.width < 400 {
+                    itemForLine = 3
+                } else {
+                    itemForLine = collectionView.frame.width / itemWidthDefault
+                }
+                
+                let itemWidth: CGFloat = (collectionView.frame.width - marginLeftRight * 2 - marginLeftRight * (itemForLine - 1)) / itemForLine
+                let itemHeight: CGFloat = itemWidth + heightLabelPlusButton
+                
+                return CGSize(width: itemWidth, height: itemHeight)
+            }
+            
+            // Default fallback
+            return CGSize(width: itemWidthDefault, height: itemWidthDefault)
+        }
+        set {
+            super.itemSize = newValue
+        }
+    }
+    
+    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
+        return proposedContentOffset
+    }
+}

+ 42 - 0
iOSClient/Main/Collection Common/NCListCell.swift

@@ -155,3 +155,45 @@ protocol NCListCellDelegate {
     func longPressMoreListItem(with objectId: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
     func longPressListItem(with objectId: String, gestureRecognizer: UILongPressGestureRecognizer)
 }
+
+// MARK: - List Layout
+
+class NCListLayout: UICollectionViewFlowLayout {
+    
+    var itemHeight: CGFloat = 60
+    
+    override init() {
+        super.init()
+        
+        sectionHeadersPinToVisibleBounds = false
+        
+        minimumInteritemSpacing = 0
+        minimumLineSpacing = 1
+        
+        self.scrollDirection = .vertical
+        self.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    override var itemSize: CGSize {
+        get {
+            if let collectionView = collectionView {
+                let itemWidth: CGFloat = collectionView.frame.width
+                return CGSize(width: itemWidth, height: self.itemHeight)
+            }
+            
+            // Default fallback
+            return CGSize(width: 100, height: 100)
+        }
+        set {
+            super.itemSize = newValue
+        }
+    }
+    
+    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
+        return proposedContentOffset
+    }
+}