Archived
Implemented colour picker, TODO: change plan cell colour to selected colours, make CollectionView refresh on colour picked, change selection visualisation in colour picker
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<!--Personal-->
|
||||
<scene sceneID="wg7-f3-ORb">
|
||||
<objects>
|
||||
<viewController id="8rJ-Kc-sve" customClass="PersonalPlanViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController storyboardIdentifier="CustomizationViewController" id="8rJ-Kc-sve" customClass="PersonalPlanViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -58,7 +58,8 @@
|
||||
<navigationItem title="Personal Plan" id="8j4-CR-EDO">
|
||||
<barButtonItem key="rightBarButtonItem" title="Customize" id="iH8-LX-SKF">
|
||||
<connections>
|
||||
<action selector="toolbarButtonCustomise:" destination="8rJ-Kc-sve" id="XTh-6F-m3e"/>
|
||||
<action selector="navBarButton:" destination="8rJ-Kc-sve" id="FA8-tv-rLI"/>
|
||||
<segue destination="8XB-jK-YFD" kind="show" id="HR4-ZO-fnF"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
@@ -82,6 +83,178 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1489.8550724637682" y="-321.42857142857139"/>
|
||||
</scene>
|
||||
<!--Customization View Controller-->
|
||||
<scene sceneID="gAv-U3-QPB">
|
||||
<objects>
|
||||
<viewController id="8XB-jK-YFD" customClass="CustomizationViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="3L4-c2-Pow">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1XB-6S-dGV">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<items>
|
||||
<navigationItem title="Customize" id="9Pf-pB-wLS">
|
||||
<barButtonItem key="rightBarButtonItem" title="Done" id="PWA-cp-z6o">
|
||||
<connections>
|
||||
<action selector="done:" destination="8XB-jK-YFD" id="7wR-PO-v0i"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Your name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="TpM-Mz-EpI">
|
||||
<rect key="frame" x="24" y="112" width="366" height="30"/>
|
||||
<accessibility key="accessibilityConfiguration" hint="Name"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Your classes" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bCV-w1-hVY">
|
||||
<rect key="frame" x="24" y="158" width="366" height="30"/>
|
||||
<accessibility key="accessibilityConfiguration" hint="Classes"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Your courses" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="69O-Fo-TQF">
|
||||
<rect key="frame" x="24" y="204" width="366" height="30"/>
|
||||
<accessibility key="accessibilityConfiguration" hint="Courses"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="hWP-3N-RUn">
|
||||
<rect key="frame" x="8" y="352" width="398" height="486"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewLayout key="collectionViewLayout" id="sCM-Sc-0Zw" customClass="MagazineLayout" customModule="MagazineLayout"/>
|
||||
<cells/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="8XB-jK-YFD" id="mHC-Am-kkd"/>
|
||||
<outlet property="delegate" destination="8XB-jK-YFD" id="cTM-du-BOk"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Default plan" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hkV-XP-jXe">
|
||||
<rect key="frame" x="24" y="250" width="366" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Custom colours" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rks-gf-AM4">
|
||||
<rect key="frame" x="24" y="323" width="366" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="1" translatesAutoresizingMaskIntoConstraints="NO" id="omP-RH-Hlh">
|
||||
<rect key="frame" x="24" y="279" width="366" height="29"/>
|
||||
<segments>
|
||||
<segment title="General"/>
|
||||
<segment title="Personal"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="bottom" secondItem="hWP-3N-RUn" secondAttribute="bottom" constant="24" id="3pJ-hl-GCJ"/>
|
||||
<constraint firstItem="TpM-Mz-EpI" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="7Ng-ON-AQ6"/>
|
||||
<constraint firstItem="bCV-w1-hVY" firstAttribute="top" secondItem="TpM-Mz-EpI" secondAttribute="bottom" constant="16" id="9ex-Jw-qBO"/>
|
||||
<constraint firstItem="hkV-XP-jXe" firstAttribute="top" secondItem="69O-Fo-TQF" secondAttribute="bottom" constant="16" id="9fR-TP-JaT"/>
|
||||
<constraint firstItem="TpM-Mz-EpI" firstAttribute="top" secondItem="1XB-6S-dGV" secondAttribute="bottom" constant="24" id="Bgw-zQ-6lf"/>
|
||||
<constraint firstItem="bCV-w1-hVY" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="CPw-u9-bVh"/>
|
||||
<constraint firstItem="rks-gf-AM4" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="HdU-p4-Goh"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="TpM-Mz-EpI" secondAttribute="trailing" constant="24" id="JRY-Id-RvJ"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="hWP-3N-RUn" secondAttribute="trailing" constant="8" id="Jty-qn-j3D"/>
|
||||
<constraint firstItem="hkV-XP-jXe" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="LC6-o0-HSh"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="rks-gf-AM4" secondAttribute="trailing" constant="24" id="LNt-n8-sve"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="bCV-w1-hVY" secondAttribute="trailing" constant="24" id="ND8-7l-QRM"/>
|
||||
<constraint firstItem="69O-Fo-TQF" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="Rfy-KZ-OF1"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="1XB-6S-dGV" secondAttribute="trailing" id="ViL-Rg-PN8"/>
|
||||
<constraint firstItem="hWP-3N-RUn" firstAttribute="top" secondItem="rks-gf-AM4" secondAttribute="bottom" constant="8" id="YSc-4u-eGx"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="hkV-XP-jXe" secondAttribute="trailing" constant="24" id="YiF-gB-Ipi"/>
|
||||
<constraint firstItem="hWP-3N-RUn" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="8" id="c9W-lx-Lt1"/>
|
||||
<constraint firstItem="69O-Fo-TQF" firstAttribute="top" secondItem="bCV-w1-hVY" secondAttribute="bottom" constant="16" id="d28-3O-3GO"/>
|
||||
<constraint firstItem="omP-RH-Hlh" firstAttribute="leading" secondItem="iN7-lf-GS3" secondAttribute="leading" constant="24" id="nDZ-Hu-019"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="omP-RH-Hlh" secondAttribute="trailing" constant="24" id="per-wQ-baW"/>
|
||||
<constraint firstItem="iN7-lf-GS3" firstAttribute="trailing" secondItem="69O-Fo-TQF" secondAttribute="trailing" constant="24" id="tEy-M0-XwI"/>
|
||||
<constraint firstItem="omP-RH-Hlh" firstAttribute="top" secondItem="hkV-XP-jXe" secondAttribute="bottom" constant="8" id="teR-bN-0UV"/>
|
||||
<constraint firstItem="1XB-6S-dGV" firstAttribute="top" secondItem="iN7-lf-GS3" secondAttribute="top" id="uz5-3l-eKb"/>
|
||||
<constraint firstItem="1XB-6S-dGV" firstAttribute="leading" secondItem="3L4-c2-Pow" secondAttribute="leading" id="vnV-AO-wgT"/>
|
||||
<constraint firstItem="rks-gf-AM4" firstAttribute="top" secondItem="omP-RH-Hlh" secondAttribute="bottom" constant="16" id="xgD-fy-RGr"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="iN7-lf-GS3"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="xDt-o1-FZQ"/>
|
||||
<connections>
|
||||
<outlet property="collectionView" destination="hWP-3N-RUn" id="RFo-DP-uPX"/>
|
||||
<outlet property="defaultSegments" destination="omP-RH-Hlh" id="hVo-ND-9EG"/>
|
||||
<outlet property="toolbar" destination="1XB-6S-dGV" id="1Yf-SM-ANg"/>
|
||||
<outlet property="txtClasses" destination="bCV-w1-hVY" id="lDD-NQ-f8f"/>
|
||||
<outlet property="txtCourses" destination="69O-Fo-TQF" id="AC7-pO-Jms"/>
|
||||
<outlet property="txtName" destination="TpM-Mz-EpI" id="W0o-NR-E96"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="fIE-1y-qpc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2524.6376811594205" y="-348.21428571428572"/>
|
||||
</scene>
|
||||
<!--Colour Picker View-->
|
||||
<scene sceneID="H2r-WV-fSr">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ColourPickerView" id="xQo-mK-Kfi" customClass="ColourPickerView" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="yNW-hn-UZ1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hA8-ki-X8m">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<items>
|
||||
<navigationItem title="Title" id="HYG-gj-KYl">
|
||||
<barButtonItem key="rightBarButtonItem" title="Done" id="ZI8-Ec-yYU">
|
||||
<connections>
|
||||
<action selector="done:" destination="xQo-mK-Kfi" id="DK7-6I-kUG"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="PuQ-HH-9DW">
|
||||
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="U1s-L9-Ptw" customClass="MagazineLayout" customModule="MagazineLayout">
|
||||
<size key="itemSize" width="50" height="50"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="xQo-mK-Kfi" id="xjd-1I-Q8C"/>
|
||||
<outlet property="delegate" destination="xQo-mK-Kfi" id="lgT-bv-TWP"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="PuQ-HH-9DW" firstAttribute="leading" secondItem="sxo-IA-DXC" secondAttribute="leading" id="0ss-7W-Crv"/>
|
||||
<constraint firstItem="hA8-ki-X8m" firstAttribute="top" secondItem="sxo-IA-DXC" secondAttribute="top" id="cSc-da-pRP"/>
|
||||
<constraint firstItem="hA8-ki-X8m" firstAttribute="trailing" secondItem="sxo-IA-DXC" secondAttribute="trailing" id="eLY-V4-1lX"/>
|
||||
<constraint firstItem="sxo-IA-DXC" firstAttribute="trailing" secondItem="PuQ-HH-9DW" secondAttribute="trailing" id="iAf-Pv-Hl8"/>
|
||||
<constraint firstItem="PuQ-HH-9DW" firstAttribute="top" secondItem="hA8-ki-X8m" secondAttribute="bottom" id="lNF-lt-wSq"/>
|
||||
<constraint firstItem="sxo-IA-DXC" firstAttribute="bottom" secondItem="PuQ-HH-9DW" secondAttribute="bottom" id="m44-uV-U72"/>
|
||||
<constraint firstItem="hA8-ki-X8m" firstAttribute="leading" secondItem="sxo-IA-DXC" secondAttribute="leading" id="vWh-ct-B5X"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="sxo-IA-DXC"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="collectionView" destination="PuQ-HH-9DW" id="b5u-ZB-l7g"/>
|
||||
<outlet property="toolbar" destination="hA8-ki-X8m" id="wGZ-na-axJ"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="hiX-3i-iLz" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="3363.7681159420295" y="-341.51785714285711"/>
|
||||
</scene>
|
||||
<!--Information-->
|
||||
<scene sceneID="tt5-VM-aeV">
|
||||
<objects>
|
||||
@@ -186,7 +359,7 @@
|
||||
<!--AvH Plan-->
|
||||
<scene sceneID="yl2-sM-qoP">
|
||||
<objects>
|
||||
<tabBarController title="AvH Plan" id="49e-Tb-3d3" sceneMemberID="viewController">
|
||||
<tabBarController title="AvH Plan" id="49e-Tb-3d3" customClass="CustomTabBarController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="W28-zg-YXA">
|
||||
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// ColourViewCell.swift
|
||||
// AvH Plan
|
||||
//
|
||||
// Created by Deniz Duezgoeren on 21.07.19.
|
||||
// Copyright © 2019 Deniz Duezgoeren. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ColourViewCell: GenericViewCell {
|
||||
|
||||
@IBOutlet weak var colorView: UIView!
|
||||
@IBOutlet weak var label: UILabel!
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="ColourViewCell" customModule="AvH_Plan" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="437" height="71"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="437" height="71"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="190-8v-eT2">
|
||||
<rect key="frame" x="71" y="8" width="342" height="55"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pXw-Js-My4">
|
||||
<rect key="frame" x="16" y="70" width="405" height="1"/>
|
||||
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HcR-OC-IDt">
|
||||
<rect key="frame" x="16" y="8" width="39" height="39"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="HcR-OC-IDt" secondAttribute="height" multiplier="1:1" id="4zf-WA-ORG"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="leading" secondItem="HcR-OC-IDt" secondAttribute="trailing" constant="-55" id="52w-ff-fKd"/>
|
||||
<constraint firstAttribute="trailing" secondItem="pXw-Js-My4" secondAttribute="trailing" constant="16" id="5Re-eN-o1T"/>
|
||||
<constraint firstItem="HcR-OC-IDt" firstAttribute="top" secondItem="190-8v-eT2" secondAttribute="top" priority="999" id="8DG-j8-Ojn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="190-8v-eT2" secondAttribute="trailing" constant="24" id="8Uf-UV-G9Y"/>
|
||||
<constraint firstAttribute="bottom" secondItem="pXw-Js-My4" secondAttribute="bottom" id="BP5-Xn-rR4"/>
|
||||
<constraint firstItem="HcR-OC-IDt" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="16" id="HWa-bE-RAc"/>
|
||||
<constraint firstItem="190-8v-eT2" firstAttribute="bottom" secondItem="HcR-OC-IDt" secondAttribute="bottom" priority="999" id="Qib-8w-kx3"/>
|
||||
<constraint firstItem="190-8v-eT2" firstAttribute="leading" secondItem="HcR-OC-IDt" secondAttribute="trailing" constant="16" id="if6-co-5BB"/>
|
||||
<constraint firstItem="190-8v-eT2" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="8" id="j5f-Jb-cBH"/>
|
||||
<constraint firstAttribute="bottom" secondItem="190-8v-eT2" secondAttribute="bottom" constant="8" id="lcL-aR-dl6"/>
|
||||
<constraint firstItem="pXw-Js-My4" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="16" id="nCr-5a-USw"/>
|
||||
<constraint firstItem="pXw-Js-My4" firstAttribute="top" secondItem="190-8v-eT2" secondAttribute="bottom" constant="7" id="nTa-Og-B8E"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
|
||||
<size key="customSize" width="437" height="71"/>
|
||||
<connections>
|
||||
<outlet property="colorView" destination="HcR-OC-IDt" id="qB6-fL-D3e"/>
|
||||
<outlet property="label" destination="190-8v-eT2" id="Xnc-ZG-PDp"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="412.31884057971018" y="160.37946428571428"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// CustomTabBarController.swift
|
||||
// AvH Plan
|
||||
//
|
||||
// Created by Deniz Duezgoeren on 19.07.19.
|
||||
// Copyright © 2019 Deniz Duezgoeren. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class CustomTabBarController: UITabBarController {
|
||||
|
||||
let prefs = UserDefaults.standard
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.selectedIndex = prefs.integer(forKey: "default-plan")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// CustomizationViewController.swift
|
||||
// AvH Plan
|
||||
//
|
||||
// Created by Deniz Duezgoeren on 19.07.19.
|
||||
// Copyright © 2019 Deniz Duezgoeren. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MagazineLayout
|
||||
|
||||
class CustomizationViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateMagazineLayout {
|
||||
|
||||
let courses = ["German", "English", "French", "Spanish", "Latin", "Turkish", "Chinese", "Arts", "Music", "Theatre", "Geography", "History", "Politics", "Philosophy", "Religion", "Maths", "Biology", "Chemistry", "Physics", "CompSci", "PhysEd", "GLL", "WAT", "Forder", "WP"]
|
||||
@IBOutlet weak var collectionView: UICollectionView!
|
||||
let identifier = "customisation_cell"
|
||||
// let storyboard = UIStoryboard(name: "main", bundle: nil)
|
||||
let prefs = UserDefaults.standard
|
||||
let df = DataFetcher.sharedInstance
|
||||
|
||||
@IBOutlet weak var txtName: UITextField!
|
||||
@IBOutlet weak var txtClasses: UITextField!
|
||||
@IBOutlet weak var txtCourses: UITextField!
|
||||
@IBOutlet weak var defaultSegments: UISegmentedControl!
|
||||
|
||||
@IBOutlet weak var toolbar: UINavigationBar!
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
self.collectionView.register(UINib(nibName: "ColourViewCell", bundle: nil), forCellWithReuseIdentifier: identifier)
|
||||
}
|
||||
|
||||
@IBAction func done(_ sender: UIBarButtonItem) {
|
||||
|
||||
self.prefs.set(self.txtName.text, forKey: "username")
|
||||
self.prefs.set(self.txtClasses.text, forKey: "classes")
|
||||
self.prefs.set(self.txtCourses.text, forKey: "courses")
|
||||
self.prefs.set(self.defaultSegments.selectedSegmentIndex, forKey: "default-plan")
|
||||
|
||||
self.prefs.synchronize()
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
self.txtName.text = prefs.string(forKey: "username")
|
||||
self.txtClasses.text = prefs.string(forKey: "classes")
|
||||
self.txtCourses.text = prefs.string(forKey: "courses")
|
||||
self.defaultSegments.selectedSegmentIndex = prefs.integer(forKey: "default-plan")
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
if let s = storyboard?.instantiateViewController(withIdentifier: "ColourPickerView") as? ColourPickerView {
|
||||
s.course = self.courses[indexPath.item]
|
||||
s.internalCourse = self.courses[indexPath.item]
|
||||
self.present(s, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeModeForItemAt indexPath: IndexPath) -> MagazineLayoutItemSizeMode {
|
||||
let widthMode = MagazineLayoutItemWidthMode.fullWidth(respectsHorizontalInsets: true)
|
||||
let heightMode = MagazineLayoutItemHeightMode.dynamic
|
||||
return MagazineLayoutItemSizeMode(widthMode: widthMode, heightMode: heightMode)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForHeaderInSectionAtIndex index: Int) -> MagazineLayoutHeaderVisibilityMode {
|
||||
return .hidden
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForFooterInSectionAtIndex index: Int) -> MagazineLayoutFooterVisibilityMode {
|
||||
return .hidden
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForBackgroundInSectionAtIndex index: Int) -> MagazineLayoutBackgroundVisibilityMode {
|
||||
return .hidden
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, horizontalSpacingForItemsInSectionAtIndex index: Int) -> CGFloat {
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, verticalSpacingForElementsInSectionAtIndex index: Int) -> CGFloat {
|
||||
return 0
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForSectionAtIndex index: Int) -> UIEdgeInsets {
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForItemsInSectionAtIndex index: Int) -> UIEdgeInsets {
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return self.courses.count
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath as IndexPath) as! ColourViewCell
|
||||
cell.label.text = self.courses[indexPath.item]
|
||||
cell.colorView.layer.cornerRadius = cell.colorView.frame.height / 2
|
||||
cell.colorView.backgroundColor = self.df.getColourPalette()[prefs.integer(forKey: "debug-colour-index-\(courses[indexPath.item])")]
|
||||
cell.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import SQLite
|
||||
|
||||
class DataFetcher {
|
||||
|
||||
static let sharedInstance = DataFetcher()
|
||||
|
||||
let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
|
||||
let prefs = UserDefaults.standard
|
||||
|
||||
@@ -30,7 +32,7 @@ class DataFetcher {
|
||||
let room = Expression<String>("room")
|
||||
let text = Expression<String>("text")
|
||||
|
||||
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: Array<Any>) -> ()) {
|
||||
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: [Any]) -> ()) {
|
||||
DispatchQueue(label: "work-queue").async {
|
||||
let foodUrl = "https://djd4rkn355.github.io/food_test.html"
|
||||
let url = "https://djd4rkn355.github.io/subst_test.html"
|
||||
@@ -43,16 +45,14 @@ class DataFetcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func parseHTML(html: String, food: String, type: String) -> Array<Any> {
|
||||
var subst = Array<SubstModel>()
|
||||
var personalSubst = Array<SubstModel>()
|
||||
func parseHTML(html: String, food: String, type: String) -> [Any] {
|
||||
var subst = [SubstModel]()
|
||||
var personalSubst = [SubstModel]()
|
||||
var info = ""
|
||||
var infoList = [String]()
|
||||
|
||||
var menuList = [String]()
|
||||
do {
|
||||
let doc = try SwiftSoup.parse(html)
|
||||
@@ -273,4 +273,12 @@ class DataFetcher {
|
||||
}
|
||||
return UIImage(named: imagePath)
|
||||
}
|
||||
|
||||
func getColourPalette() -> [UIColor] {
|
||||
return [#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0), #colorLiteral(red: 1, green: 0.4932718873, blue: 0.4739984274, alpha: 1), #colorLiteral(red: 1, green: 0.5781051517, blue: 0, alpha: 1), #colorLiteral(red: 0.9995340705, green: 0.988355577, blue: 0.4726552367, alpha: 1), #colorLiteral(red: 0.4500938654, green: 0.9813225865, blue: 0.4743030667, alpha: 1), #colorLiteral(red: 0.4508578777, green: 0.9882974029, blue: 0.8376303315, alpha: 1), #colorLiteral(red: 0.4620226622, green: 0.8382837176, blue: 1, alpha: 1), #colorLiteral(red: 0.476841867, green: 0.5048075914, blue: 1, alpha: 1), #colorLiteral(red: 0.8446564078, green: 0.5145705342, blue: 1, alpha: 1), #colorLiteral(red: 1, green: 0.5409764051, blue: 0.8473142982, alpha: 1), #colorLiteral(red: 0.6745098039, green: 0.5568627451, blue: 0.4078431373, alpha: 1), #colorLiteral(red: 0.7540688515, green: 0.7540867925, blue: 0.7540771365, alpha: 1)]
|
||||
}
|
||||
|
||||
func getColourPaletteNames() -> [String] {
|
||||
return ["White", "Red", "Orange", "Yellow", "Green", "Cyan", "Light Blue", "Blue", "Purple", "Pink", "Brown", "Grey"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class InfoViewController : UIViewController {
|
||||
let prefs = UserDefaults.standard
|
||||
@IBOutlet weak var scrollView: UIScrollView!
|
||||
private let refreshControl = UIRefreshControl()
|
||||
let df = DataFetcher() // should be a static reference
|
||||
let df = DataFetcher.sharedInstance
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
@@ -13,7 +13,7 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
|
||||
|
||||
var items = [String]()
|
||||
private let refreshControl = UIRefreshControl()
|
||||
let df = DataFetcher()
|
||||
let df = DataFetcher.sharedInstance
|
||||
@IBOutlet weak var toolbar: UINavigationBar!
|
||||
let layout = MagazineLayout()
|
||||
var collectionView: UICollectionView
|
||||
@@ -71,7 +71,7 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
|
||||
cell.content.text = self.items[indexPath.item]
|
||||
}
|
||||
|
||||
cell.backgroundColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
|
||||
cell.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
|
||||
return cell
|
||||
}
|
||||
|
||||
|
||||
@@ -14,29 +14,31 @@ class PersonalPlanViewController: PlanViewController {
|
||||
let prefs = UserDefaults.standard
|
||||
|
||||
@IBAction func toolbarButtonCustomise(_ sender: UIBarButtonItem) {
|
||||
let alert = UIAlertController(title: NSLocalizedString("customize_alert_title", comment: ""), message: nil, preferredStyle: .alert)
|
||||
alert.addTextField { (name) in
|
||||
name.text = self.prefs.string(forKey: "username")
|
||||
name.placeholder = NSLocalizedString("name", comment: "")
|
||||
}
|
||||
alert.addTextField { (classes) in
|
||||
classes.text = self.prefs.string(forKey: "classes")
|
||||
classes.placeholder = NSLocalizedString("classes", comment: "")
|
||||
}
|
||||
alert.addTextField { (courses) in
|
||||
courses.text = self.prefs.string(forKey: "courses")
|
||||
courses.placeholder = NSLocalizedString("courses", comment: "")
|
||||
}
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (action) -> Void in
|
||||
_ = self.prefs.set(alert!.textFields![0].text, forKey: "username")
|
||||
_ = self.prefs.set(alert!.textFields![1].text, forKey: "classes")
|
||||
_ = self.prefs.set(alert!.textFields![2].text, forKey: "courses")
|
||||
_ = self.prefs.synchronize()
|
||||
}))
|
||||
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
// let alert = UIAlertController(title: NSLocalizedString("customize_alert_title", comment: ""), message: nil, preferredStyle: .alert)
|
||||
// alert.addTextField { (name) in
|
||||
// name.text = self.prefs.string(forKey: "username")
|
||||
// name.placeholder = NSLocalizedString("name", comment: "")
|
||||
// }
|
||||
// alert.addTextField { (classes) in
|
||||
// classes.text = self.prefs.string(forKey: "classes")
|
||||
// classes.placeholder = NSLocalizedString("classes", comment: "")
|
||||
// }
|
||||
// alert.addTextField { (courses) in
|
||||
// courses.text = self.prefs.string(forKey: "courses")
|
||||
// courses.placeholder = NSLocalizedString("courses", comment: "")
|
||||
// }
|
||||
// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (action) -> Void in
|
||||
// _ = self.prefs.set(alert!.textFields![0].text, forKey: "username")
|
||||
// _ = self.prefs.set(alert!.textFields![1].text, forKey: "classes")
|
||||
// _ = self.prefs.set(alert!.textFields![2].text, forKey: "courses")
|
||||
// _ = self.prefs.synchronize()
|
||||
// }))
|
||||
//
|
||||
// self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
let user = self.prefs.string(forKey: "username")
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MagazineLayout
|
||||
|
||||
class PlanViewCell: MagazineLayoutCollectionViewCell {
|
||||
class PlanViewCell: GenericViewCell {
|
||||
|
||||
@IBOutlet weak var group: UILabel!
|
||||
@IBOutlet weak var date: UILabel!
|
||||
@@ -18,77 +17,4 @@ class PlanViewCell: MagazineLayoutCollectionViewCell {
|
||||
@IBOutlet weak var additional: UILabel!
|
||||
@IBOutlet weak var room: UILabel!
|
||||
@IBOutlet weak var tintView: UIView!
|
||||
|
||||
private var widthConstraint: NSLayoutConstraint!
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
contentView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
let bottomConstraint = bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||
bottomConstraint.priority = .required - 1
|
||||
NSLayoutConstraint.activate(
|
||||
[
|
||||
leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||
bottomConstraint
|
||||
]
|
||||
)
|
||||
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: bounds.width)
|
||||
widthConstraint.priority = .required - 1
|
||||
widthConstraint.isActive = true
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
override open func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
contentView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
let bottomConstraint = bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||
bottomConstraint.priority = .required - 1
|
||||
NSLayoutConstraint.activate(
|
||||
[
|
||||
leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||
bottomConstraint
|
||||
]
|
||||
)
|
||||
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: bounds.width)
|
||||
widthConstraint.priority = .required - 1
|
||||
widthConstraint.isActive = true
|
||||
}
|
||||
|
||||
override open func preferredLayoutAttributesFitting(
|
||||
_ layoutAttributes: UICollectionViewLayoutAttributes)
|
||||
-> UICollectionViewLayoutAttributes
|
||||
{
|
||||
guard let attributes = layoutAttributes as? MagazineLayoutCollectionViewLayoutAttributes else {
|
||||
assertionFailure("`layoutAttributes` must be an instance of `MagazineLayoutCollectionViewLayoutAttributes`")
|
||||
return super.preferredLayoutAttributesFitting(layoutAttributes)
|
||||
}
|
||||
|
||||
let size: CGSize
|
||||
if attributes.shouldVerticallySelfSize {
|
||||
widthConstraint.constant = layoutAttributes.size.width
|
||||
|
||||
size = super.preferredLayoutAttributesFitting(layoutAttributes).size
|
||||
} else {
|
||||
// No self-sizing is required; respect whatever size the layout determined.
|
||||
size = layoutAttributes.size
|
||||
}
|
||||
|
||||
layoutAttributes.size = size
|
||||
|
||||
return layoutAttributes
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
|
||||
let identifier = "plan_cell"
|
||||
var substs = [SubstModel]()
|
||||
let refreshControl = UIRefreshControl()
|
||||
let df = DataFetcher()
|
||||
let df = DataFetcher.sharedInstance
|
||||
let layout = MagazineLayout()
|
||||
var collectionView: UICollectionView
|
||||
|
||||
|
||||
Reference in New Issue
Block a user