Browse Source

dev trash

Marino Faggiana 6 years ago
parent
commit
7933c5f616

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -192,6 +192,7 @@
 		F73D71621F2673C200E233EB /* NCText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73D71611F2673C200E233EB /* NCText.swift */; };
 		F73D71641F2674A400E233EB /* NCText.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F73D71631F2674A400E233EB /* NCText.storyboard */; };
 		F73F537F1E929C8500F8678D /* CCMore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73F537E1E929C8500F8678D /* CCMore.swift */; };
+		F7417DB3216CE925007D05F5 /* NCTrashHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7417DB2216CE925007D05F5 /* NCTrashHeader.swift */; };
 		F7434B3420E23FD700417916 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
 		F7434B3620E23FE000417916 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; };
 		F7434B3720E23FF200417916 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
@@ -918,6 +919,7 @@
 		F73D71611F2673C200E233EB /* NCText.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCText.swift; sourceTree = "<group>"; };
 		F73D71631F2674A400E233EB /* NCText.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCText.storyboard; sourceTree = "<group>"; };
 		F73F537E1E929C8500F8678D /* CCMore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CCMore.swift; sourceTree = "<group>"; };
+		F7417DB2216CE925007D05F5 /* NCTrashHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrashHeader.swift; sourceTree = "<group>"; };
 		F7434B5F20E2440600417916 /* FileProviderExtension-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FileProviderExtension-Bridging-Header.h"; sourceTree = "<group>"; };
 		F743B2C31C95BBE8006F5B4A /* CCShareInfoCMOC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCShareInfoCMOC.h; sourceTree = "<group>"; };
 		F743B2C41C95BBE8006F5B4A /* CCShareInfoCMOC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCShareInfoCMOC.m; sourceTree = "<group>"; };
@@ -2739,6 +2741,7 @@
 			isa = PBXGroup;
 			children = (
 				F78F74332163757000C2ADAD /* NCTrash.storyboard */,
+				F7417DB2216CE925007D05F5 /* NCTrashHeader.swift */,
 				F78F74352163781100C2ADAD /* NCTrash.swift */,
 				F7ED7EDB216B83D5007AB4D9 /* NCTrashListCell.xib */,
 				F7ED7EDD216B85DA007AB4D9 /* NCTrashListCell.swift */,
@@ -4174,6 +4177,7 @@
 				F73CC07E1E813DFF006E3047 /* BKTouchIDSwitchView.m in Sources */,
 				F77B0E5F1D118A16002130FE /* CCSettings.m in Sources */,
 				F78F74362163781100C2ADAD /* NCTrash.swift in Sources */,
+				F7417DB3216CE925007D05F5 /* NCTrashHeader.swift in Sources */,
 				F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */,
 				F7D424611F063B82009C9782 /* CTAssetScrollView.m in Sources */,
 				F762CB141EACB66200B38484 /* XLFormRightImageButton.m in Sources */,

+ 21 - 2
iOSClient/Trash/NCTrash.storyboard

@@ -28,10 +28,26 @@
                                     <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 </collectionViewFlowLayout>
                                 <cells/>
-                                <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="header" id="AQ6-rS-Wxb">
+                                <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="header" id="AQ6-rS-Wxb" customClass="NCTrashHeader" customModule="Nextcloud" customModuleProvider="target">
                                     <rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
                                     <autoresizingMask key="autoresizingMask"/>
-                                    <color key="backgroundColor" red="0.59999999999999998" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <subviews>
+                                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="trashMore" translatesAutoresizingMaskIntoConstraints="NO" id="2CA-s4-Jqg" userLabel="More">
+                                            <rect key="frame" x="332" y="2" width="26" height="26"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="26" id="1jE-4z-D0D"/>
+                                                <constraint firstAttribute="width" constant="26" id="9NZ-3O-HHt"/>
+                                            </constraints>
+                                        </imageView>
+                                    </subviews>
+                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="trailing" secondItem="2CA-s4-Jqg" secondAttribute="trailing" constant="17" id="MqZ-eT-w2f"/>
+                                        <constraint firstItem="2CA-s4-Jqg" firstAttribute="centerY" secondItem="AQ6-rS-Wxb" secondAttribute="centerY" id="xmf-F2-GEE"/>
+                                    </constraints>
+                                    <connections>
+                                        <outlet property="tapMore" destination="2CA-s4-Jqg" id="ZrC-Kw-hzQ"/>
+                                    </connections>
                                 </collectionReusableView>
                                 <connections>
                                     <outlet property="dataSource" destination="EFX-fO-Oip" id="2On-qP-zuG"/>
@@ -57,4 +73,7 @@
             <point key="canvasLocation" x="256.80000000000001" y="228.93553223388307"/>
         </scene>
     </scenes>
+    <resources>
+        <image name="trashMore" width="80" height="80"/>
+    </resources>
 </document>

+ 6 - 6
iOSClient/Trash/NCTrash.swift

@@ -12,7 +12,7 @@ import Foundation
 class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDelegate, UIGestureRecognizerDelegate, NCTrashListDelegate {
     
     @IBOutlet fileprivate weak var collectionView: UICollectionView!
-    
+
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     var path = ""
     var titleCurrentFolder = NSLocalizedString("_trash_view_", comment: "")
@@ -25,7 +25,7 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
         super.viewDidLoad()
         
         collectionView.register(UINib.init(nibName: "NCTrashListCell", bundle: nil), forCellWithReuseIdentifier: "cell")
-        collectionView.collectionViewLayout = ListLayout(itemHeight: 60)
+        collectionView.collectionViewLayout = ListLayout(itemHeight: 60)        
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -62,12 +62,12 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
     }
     
     // MARK: tap cell
-    func tapRestoreDelegate(with fileID: String) {
-        print("touch restore")
+    func tapRestoreItem(with fileID: String) {
+        print("tap item restore")
     }
     
-    func tapMoreDelegate(with fileID: String) {
-        print("touch more")
+    func tapMoreItem(with fileID: String) {
+        print("tap item more")
     }
     
     // MARK: collectionView methods

+ 30 - 0
iOSClient/Trash/NCTrashHeader.swift

@@ -0,0 +1,30 @@
+//
+//  NCTrashHeader.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 09/10/2018.
+//  Copyright © 2018 TWS. All rights reserved.
+//
+
+import Foundation
+
+class NCTrashHeader: UICollectionReusableView {
+    
+    @IBOutlet weak var tapMore: UIImageView!
+
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        tapMore.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "trashMore"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem)
+        
+        let tapGestureMore = UITapGestureRecognizer(target: self, action: #selector(NCTrashHeader.tapMore(sender:)))
+        addGestureRecognizer(tapGestureMore)
+        tapGestureMore.numberOfTapsRequired = 1
+        tapMore.isUserInteractionEnabled = true
+        tapMore.addGestureRecognizer(tapGestureMore)
+    }
+    
+    @objc func tapMore(sender: UITapGestureRecognizer) {
+        print("tap header more")
+    }
+}

+ 4 - 4
iOSClient/Trash/NCTrashListCell.swift

@@ -59,14 +59,14 @@ class NCTrashListCell: UICollectionViewCell {
     }
     
     @objc func tapRestore(sender: UITapGestureRecognizer) {
-        delegate?.tapRestoreDelegate(with: fileID)
+        delegate?.tapRestoreItem(with: fileID)
     }
     @objc func tapMore(sender: UITapGestureRecognizer) {
-        delegate?.tapMoreDelegate(with: fileID)
+        delegate?.tapMoreItem(with: fileID)
     }
 }
 
 protocol NCTrashListDelegate {
-    func tapRestoreDelegate(with fileID: String)
-    func tapMoreDelegate(with fileID: String)
+    func tapRestoreItem(with fileID: String)
+    func tapMoreItem(with fileID: String)
 }

+ 6 - 6
iOSClient/Trash/NCTrashListCell.xib

@@ -46,17 +46,17 @@
                         </constraints>
                     </imageView>
                     <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dgL-g5-Nkc" userLabel="More">
-                        <rect key="frame" x="557.5" y="17.5" width="25" height="25"/>
+                        <rect key="frame" x="557" y="17" width="26" height="26"/>
                         <constraints>
-                            <constraint firstAttribute="width" constant="25" id="05P-NL-pd8"/>
-                            <constraint firstAttribute="height" constant="25" id="Jet-eo-x1M"/>
+                            <constraint firstAttribute="width" constant="26" id="05P-NL-pd8"/>
+                            <constraint firstAttribute="height" constant="26" id="Jet-eo-x1M"/>
                         </constraints>
                     </imageView>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nwZ-pi-Igj" userLabel="restore">
-                        <rect key="frame" x="497.5" y="17.5" width="25" height="25"/>
+                        <rect key="frame" x="497" y="17" width="26" height="26"/>
                         <constraints>
-                            <constraint firstAttribute="width" constant="25" id="5Zc-h7-ZRJ"/>
-                            <constraint firstAttribute="height" constant="25" id="xvo-pN-hfE"/>
+                            <constraint firstAttribute="width" constant="26" id="5Zc-h7-ZRJ"/>
+                            <constraint firstAttribute="height" constant="26" id="xvo-pN-hfE"/>
                         </constraints>
                     </imageView>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Egg-cb-EhZ" userLabel="Separator">