marinofaggiana 4 жил өмнө
parent
commit
36bb75fec1

+ 20 - 6
iOSClient/BackgroundImage/NCBackgroundImage.storyboard

@@ -14,11 +14,11 @@
             <objects>
                 <viewController id="V0q-CP-xMJ" customClass="NCBackgroundImage" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="gzh-6E-hc4">
-                        <rect key="frame" x="0.0" y="0.0" width="300" height="310"/>
+                        <rect key="frame" x="0.0" y="0.0" width="300" height="500"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Background" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZr-nE-ths">
-                                <rect key="frame" x="20" y="15" width="260" height="18"/>
+                                <rect key="frame" x="40" y="15" width="220" height="18"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
@@ -31,23 +31,34 @@
                                 </constraints>
                                 <state key="normal" image="xmark"/>
                                 <connections>
-                                    <action selector="close:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="jqt-Px-KVr"/>
+                                    <action selector="actionClose:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="dWH-n9-hhC"/>
                                 </connections>
                             </button>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ejg-dZ-Omg">
+                                <rect key="frame" x="0.0" y="53" width="300" height="250"/>
+                                <color key="backgroundColor" systemColor="systemPinkColor"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="250" id="BDt-UA-R5t"/>
+                                </constraints>
+                            </view>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="1c1-7Q-WMG"/>
                         <color key="backgroundColor" systemColor="systemGray6Color"/>
                         <constraints>
-                            <constraint firstItem="1c1-7Q-WMG" firstAttribute="trailing" secondItem="nZr-nE-ths" secondAttribute="trailing" constant="20" id="DPW-MV-oKc"/>
+                            <constraint firstItem="ejg-dZ-Omg" firstAttribute="leading" secondItem="1c1-7Q-WMG" secondAttribute="leading" id="4FU-Pz-d6P"/>
+                            <constraint firstItem="1c1-7Q-WMG" firstAttribute="trailing" secondItem="ejg-dZ-Omg" secondAttribute="trailing" id="CBH-1m-EvS"/>
+                            <constraint firstItem="1c1-7Q-WMG" firstAttribute="trailing" secondItem="nZr-nE-ths" secondAttribute="trailing" constant="40" id="DPW-MV-oKc"/>
                             <constraint firstItem="usk-m0-m1V" firstAttribute="leading" secondItem="1c1-7Q-WMG" secondAttribute="leading" constant="20" id="Rt2-3Z-moO"/>
-                            <constraint firstItem="nZr-nE-ths" firstAttribute="leading" secondItem="1c1-7Q-WMG" secondAttribute="leading" constant="20" id="SI9-xL-6s8"/>
+                            <constraint firstItem="nZr-nE-ths" firstAttribute="leading" secondItem="1c1-7Q-WMG" secondAttribute="leading" constant="40" id="SI9-xL-6s8"/>
+                            <constraint firstItem="ejg-dZ-Omg" firstAttribute="top" secondItem="nZr-nE-ths" secondAttribute="bottom" constant="20" id="Xe8-Cq-oh7"/>
                             <constraint firstItem="usk-m0-m1V" firstAttribute="centerY" secondItem="nZr-nE-ths" secondAttribute="centerY" id="m4H-fq-bl6"/>
                             <constraint firstItem="nZr-nE-ths" firstAttribute="top" secondItem="1c1-7Q-WMG" secondAttribute="top" constant="15" id="oyJ-sj-j5N"/>
                         </constraints>
                     </view>
                     <navigationItem key="navigationItem" id="Zon-2j-rsc"/>
-                    <size key="freeformSize" width="300" height="310"/>
+                    <size key="freeformSize" width="300" height="500"/>
                     <connections>
+                        <outlet property="chromaColorPickerView" destination="ejg-dZ-Omg" id="tay-tJ-kme"/>
                         <outlet property="closeButton" destination="usk-m0-m1V" id="IuD-PY-d4g"/>
                         <outlet property="titleLabel" destination="nZr-nE-ths" id="UbA-Dl-0Ad"/>
                     </connections>
@@ -62,5 +73,8 @@
         <systemColor name="systemGray6Color">
             <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
+        <systemColor name="systemPinkColor">
+            <color red="1" green="0.17647058823529413" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
     </resources>
 </document>

+ 8 - 17
iOSClient/BackgroundImage/NCBackgroundImage.swift

@@ -28,6 +28,7 @@ class NCBackgroundImage: UIViewController {
 
     @IBOutlet weak var titleLabel: UILabel!
     @IBOutlet weak var closeButton: UIButton!
+    @IBOutlet weak var chromaColorPickerView: UIView!
     
     private let colorPicker = ChromaColorPicker()
     private let brightnessSlider = ChromaBrightnessSlider()
@@ -37,7 +38,7 @@ class NCBackgroundImage: UIViewController {
     public var collectionViewCommon: NCCollectionViewCommon?
     
     let width: CGFloat = 300
-    let height: CGFloat = 400
+    let height: CGFloat = 500
     
     // MARK: - View Life Cycle
 
@@ -60,7 +61,7 @@ class NCBackgroundImage: UIViewController {
     
     // MARK: - Action
     
-    @IBAction func close(_ sender: Any) {
+    @IBAction func actionClose(_ sender: UIButton) {
         dismiss(animated: true)
     }
     
@@ -72,8 +73,8 @@ class NCBackgroundImage: UIViewController {
         view.addSubview(colorPicker)
 
         NSLayoutConstraint.activate([
-            colorPicker.centerXAnchor.constraint(equalTo: view.centerXAnchor),
-            colorPicker.topAnchor.constraint(equalTo: view.topAnchor, constant: 50),
+            colorPicker.centerXAnchor.constraint(equalTo: chromaColorPickerView.centerXAnchor),
+            colorPicker.topAnchor.constraint(equalTo: chromaColorPickerView.topAnchor),
             colorPicker.widthAnchor.constraint(equalToConstant: defaultColorPickerSize.width),
             colorPicker.heightAnchor.constraint(equalToConstant: defaultColorPickerSize.height)
         ])
@@ -99,26 +100,16 @@ class NCBackgroundImage: UIViewController {
     }
     
     private func setupColorPickerHandles() {
-        // (Optional) Assign a custom handle size - all handles appear as the same size
-        // colorPicker.handleSize = CGSize(width: 48, height: 60)
-        
-        // 1. Add handle and then customize
-//        addHomeHandle()
-        
-        // 2. Add a handle via a color
-        let peachColor = UIColor(red: 1, green: 203 / 255, blue: 164 / 255, alpha: 1)
+      
+        let peachColor = collectionViewCommon?.collectionView.backgroundColor //UIColor(red: 1, green: 203 / 255, blue: 164 / 255, alpha: 1)
         colorPicker.addHandle(at: peachColor)
-        
-        // 3. Create a custom handle and add to picker
-//        let customHandle = ChromaColorHandle()
-//        customHandle.color = UIColor.purple
-//        colorPicker.addHandle(customHandle)
     }
 }
 
 extension NCBackgroundImage: ChromaColorPickerDelegate {
     func colorPickerHandleDidChange(_ colorPicker: ChromaColorPicker, handle: ChromaColorHandle, to color: UIColor) {
         print("x")
+        
         /*
         colorDisplayView.backgroundColor = color