Manos Chorianopoulos

MyRewardsOffersScrollTableViewCell redesign

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
{
"images" : [
{
"filename" : "arrow_right_blue.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "arrow_right_blue 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "arrow_right_blue 2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -61,8 +61,8 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
// Initialization code
parentView.layer.borderWidth = 1.0
parentView.layer.borderColor = UIColor(rgb: 0xCCCCCC).cgColor
parentView.layer.cornerRadius = 8.0
parentView.layer.borderColor = UIColor(rgb: 0xD2D6D9).cgColor
parentView.layer.cornerRadius = 12.0
parentView.clipsToBounds = true
discountView.layer.cornerRadius = 34.0
......@@ -83,12 +83,13 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
// discountLabel.text = "\(data.discount)\(discountSymbol)"
discountLabel.text = data.discount
discountLabel.font = UIFont(name: "PingLCG-Bold", size: 17)
discountLabel.textColor = UIColor(rgb: 0xF2F2F2)
discountLabel.textColor = UIColor(rgb: 0xFFFFFF)
discountView.backgroundColor = UIColor(rgb: data.color)
// discountView.backgroundColor = UIColor(rgb: data.color)
discountView.backgroundColor = UIColor(rgb: 0xCBCBCB)
titleLabel.text = data.title
titleLabel.font = UIFont(name: "PingLCG-Bold", size: 17)
titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
titleLabel.textColor = UIColor(rgb: 0x000F1E)
subtitleLabel.text = data.description
......@@ -96,8 +97,8 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
subtitleLabel.textColor = UIColor(rgb: 0x00111B)
expirationLabel.text = data.expirationDate
expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
expirationLabel.textColor = UIColor(rgb: 0x00111B)
expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 12)
expirationLabel.textColor = UIColor(rgb: 0x9BA1A6)
logoImage.image = UIImage(named: data.merchantLogo, in: Bundle.frameworkResourceBundle, compatibleWith: nil)
}
......@@ -113,7 +114,7 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
// Use coupon set discount
discountLabel.text = data._discount
discountLabel.font = UIFont(name: "PingLCG-Bold", size: 17)
discountLabel.textColor = UIColor(rgb: 0xF2F2F2)
discountLabel.textColor = UIColor(rgb: 0xFFFFFF)
// Color based on discount type
let discountColor: UInt = {
......@@ -128,19 +129,21 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
return 0xEE417D
}
}()
discountView.backgroundColor = UIColor(rgb: discountColor)
// discountView.backgroundColor = UIColor(rgb: discountColor)
discountView.backgroundColor = UIColor(rgb: 0xCBCBCB)
titleLabel.text = data._name
titleLabel.font = UIFont(name: "PingLCG-Bold", size: 17)
titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
titleLabel.textColor = UIColor(rgb: 0x000F1E)
subtitleLabel.text = data._short_description
subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 14)
subtitleLabel.textColor = UIColor(rgb: 0x00111B)
expirationLabel.text = "έως " + data.formattedEndDate(format: "dd-MM")
expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
expirationLabel.textColor = UIColor(rgb: 0x00111B)
// expirationLabel.text = "έως " + data.formattedEndDate(format: "dd-MM")
expirationLabel.text = "until " + data.formattedEndDate(format: "dd-MM")
expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 12)
expirationLabel.textColor = UIColor(rgb: 0x9BA1A6)
// Use merchant logo from bound merchant data
if let merchant = data._merchant, !merchant._img_preview.isEmpty {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -45,7 +45,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ke4-P2-jW4" userLabel="Discount View">
<rect key="frame" x="192" y="6" width="68" height="68"/>
<rect key="frame" x="194" y="6" width="68" height="68"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dlB-Ci-f8K">
<rect key="frame" x="5" y="23.666666666666671" width="58" height="21"/>
......@@ -72,9 +72,14 @@
<constraint firstItem="gqm-4L-lda" firstAttribute="leading" secondItem="nG0-KL-IyC" secondAttribute="leading" id="DMQ-RI-Dqo"/>
<constraint firstAttribute="bottom" secondItem="gqm-4L-lda" secondAttribute="bottom" id="IXr-0J-fEF"/>
<constraint firstItem="ke4-P2-jW4" firstAttribute="top" secondItem="nG0-KL-IyC" secondAttribute="top" constant="6" id="T5E-w8-e65"/>
<constraint firstAttribute="trailing" secondItem="ke4-P2-jW4" secondAttribute="trailing" constant="8" id="VcX-22-qep"/>
<constraint firstAttribute="trailing" secondItem="ke4-P2-jW4" secondAttribute="trailing" constant="6" id="VcX-22-qep"/>
<constraint firstItem="gqm-4L-lda" firstAttribute="top" secondItem="nG0-KL-IyC" secondAttribute="top" id="rzs-LV-a8h"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="QOx-tV-FfU"/>
</mask>
</variation>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VZh-nd-i9h" userLabel="Bottom View">
<rect key="frame" x="0.0" y="64" width="268" height="101"/>
......
......@@ -17,6 +17,7 @@ public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
@IBOutlet weak var categoryLabel: UILabel!
@IBOutlet weak var allButtonView: UIView!
@IBOutlet weak var allButtonLabel: UILabel!
@IBOutlet weak var allButtonArrowImage: UIImageView!
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var collectionViewHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var collectionViewBottom: NSLayoutConstraint!
......@@ -28,13 +29,16 @@ public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
super.awakeFromNib()
// Initialization code
allButtonView.layer.borderWidth = 1.0
allButtonView.layer.borderColor = UIColor(rgb: 0x000F1E).cgColor
allButtonView.layer.cornerRadius = 4.0
// allButtonView.layer.borderWidth = 1.0
// allButtonView.layer.borderColor = UIColor(rgb: 0x000F1E).cgColor
// allButtonView.layer.cornerRadius = 4.0
allButtonLabel.text = "Όλα"
allButtonLabel.font = UIFont(name: "PingLCG-Regular", size: 16)
allButtonLabel.textColor = UIColor(rgb: 0x00111B)
allButtonArrowImage.image = UIImage(named: "arrow_right_blue", in: Bundle.frameworkResourceBundle, compatibleWith: nil)
// allButtonLabel.text = "Όλα"
allButtonLabel.text = "All"
allButtonLabel.font = UIFont(name: "PingLCG-Regular", size: 15)
allButtonLabel.textColor = UIColor(rgb: 0x004E6E)
allButtonLabel.frame.size.width = allButtonLabel.intrinsicContentSize.width
allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height
......@@ -86,7 +90,7 @@ public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
layout.scrollDirection = .horizontal
layout.minimumLineSpacing = 7
layout.minimumInteritemSpacing = 0
layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
layout.sectionInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
}
}
......@@ -106,26 +110,26 @@ public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
}
// Update collection view height based on section
if data?.title == "Αγαπημένα" {
collectionViewHeightConstraint.constant = 350 // Match cell height
} else {
// if data?.title == "Αγαπημένα" {
// collectionViewHeightConstraint.constant = 350 // Match cell height
// } else {
collectionViewHeightConstraint.constant = 232 // Default height
}
// }
// Configure layout based on section type
if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
if data?.title == "Αγαπημένα" {
layout.minimumLineSpacing = 24
} else {
// if data?.title == "Αγαπημένα" {
// layout.minimumLineSpacing = 24
// } else {
layout.minimumLineSpacing = 7
}
// }
}
let catBoldText = (data?.title ?? "") + " "
let catRegText = "(" + String(data?.count ?? 0) + ")"
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Bold", size: 18) ?? UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Regular", size: 18) ?? UIFont.systemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Bold", size: 15) ?? UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Regular", size: 15) ?? UIFont.systemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
let catAttributedString = NSMutableAttributedString(string:catBoldText, attributes:attrBold)
let catRegString = NSMutableAttributedString(string: catRegText, attributes:attrRegular)
......@@ -198,20 +202,20 @@ extension MyRewardsOffersScrollTableViewCell: UICollectionViewDataSource, UIColl
// MARK: - UICollectionViewDelegateFlowLayout
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if self.data?.title == "Αγαπημένα" {
return CGSize(width: 275, height: 350)
} else {
// if self.data?.title == "Αγαπημένα" {
// return CGSize(width: 275, height: 350)
// } else {
return CGSize(width: 257, height: 232)
}
// }
}
// Distance Between Item Cells
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
if self.data?.title == "Αγαπημένα" {
return 24
} else {
// if self.data?.title == "Αγαπημένα" {
// return 24
// } else {
return 7
}
// }
}
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
......@@ -220,6 +224,6 @@ extension MyRewardsOffersScrollTableViewCell: UICollectionViewDataSource, UIColl
// Cell Margin
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
return UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -17,10 +17,10 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3yR-f0-cq6" userLabel="Parent View">
<rect key="frame" x="0.0" y="0.0" width="403" height="335"/>
<rect key="frame" x="0.0" y="0.0" width="403" height="317"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iQa-jk-pTS" userLabel="Top View">
<rect key="frame" x="24" y="50" width="355" height="35"/>
<rect key="frame" x="24" y="43" width="355" height="35"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2GN-Th-7DN">
<rect key="frame" x="0.0" y="7" width="270" height="21"/>
......@@ -32,11 +32,18 @@
<rect key="frame" x="280" y="0.0" width="75" height="35"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Όλα" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KGA-M6-mox">
<rect key="frame" x="17" y="7" width="41" height="21"/>
<rect key="frame" x="17" y="7" width="50" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ScT-dl-H7N">
<rect key="frame" x="71" y="13.666666666666664" width="4" height="8"/>
<constraints>
<constraint firstAttribute="width" constant="4" id="fPm-t1-TQF"/>
<constraint firstAttribute="height" constant="8" id="vm9-GN-BYx"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3xd-DO-x7D">
<rect key="frame" x="0.0" y="0.0" width="75" height="35"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
......@@ -49,12 +56,14 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="3xd-DO-x7D" secondAttribute="trailing" id="JPz-In-GKK"/>
<constraint firstItem="ScT-dl-H7N" firstAttribute="centerY" secondItem="9Qp-M4-KdO" secondAttribute="centerY" id="Juh-Ho-gwG"/>
<constraint firstItem="3xd-DO-x7D" firstAttribute="top" secondItem="9Qp-M4-KdO" secondAttribute="top" id="Tja-OQ-C2l"/>
<constraint firstItem="KGA-M6-mox" firstAttribute="leading" secondItem="9Qp-M4-KdO" secondAttribute="leading" constant="17" id="VmX-L4-pUZ"/>
<constraint firstItem="KGA-M6-mox" firstAttribute="top" secondItem="9Qp-M4-KdO" secondAttribute="top" constant="7" id="Wfv-az-eWF"/>
<constraint firstAttribute="trailing" secondItem="ScT-dl-H7N" secondAttribute="trailing" id="X9a-ST-Z68"/>
<constraint firstItem="3xd-DO-x7D" firstAttribute="leading" secondItem="9Qp-M4-KdO" secondAttribute="leading" id="a6e-3u-98H"/>
<constraint firstAttribute="bottom" secondItem="KGA-M6-mox" secondAttribute="bottom" constant="7" id="e7a-OL-xbA"/>
<constraint firstAttribute="trailing" secondItem="KGA-M6-mox" secondAttribute="trailing" constant="17" id="eK1-vy-dDM"/>
<constraint firstItem="ScT-dl-H7N" firstAttribute="leading" secondItem="KGA-M6-mox" secondAttribute="trailing" constant="4" id="eK1-vy-dDM"/>
<constraint firstAttribute="bottom" secondItem="3xd-DO-x7D" secondAttribute="bottom" id="xGA-AA-7JP"/>
</constraints>
</view>
......@@ -70,7 +79,7 @@
</constraints>
</view>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="E9Q-uB-Uvd">
<rect key="frame" x="0.0" y="103" width="403" height="232"/>
<rect key="frame" x="0.0" y="85" width="403" height="232"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="232" id="kSx-su-PE4"/>
......@@ -90,10 +99,10 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="E9Q-uB-Uvd" firstAttribute="top" secondItem="iQa-jk-pTS" secondAttribute="bottom" constant="18" id="BbT-IJ-sg4"/>
<constraint firstItem="E9Q-uB-Uvd" firstAttribute="top" secondItem="iQa-jk-pTS" secondAttribute="bottom" constant="7" id="BbT-IJ-sg4"/>
<constraint firstItem="iQa-jk-pTS" firstAttribute="leading" secondItem="3yR-f0-cq6" secondAttribute="leading" constant="24" id="C0X-4S-oP1"/>
<constraint firstAttribute="trailing" secondItem="E9Q-uB-Uvd" secondAttribute="trailing" id="KNV-Sk-0rr"/>
<constraint firstItem="iQa-jk-pTS" firstAttribute="top" secondItem="3yR-f0-cq6" secondAttribute="top" constant="50" id="Saf-QC-O71"/>
<constraint firstItem="iQa-jk-pTS" firstAttribute="top" secondItem="3yR-f0-cq6" secondAttribute="top" constant="43" id="Saf-QC-O71"/>
<constraint firstItem="E9Q-uB-Uvd" firstAttribute="leading" secondItem="3yR-f0-cq6" secondAttribute="leading" id="ToF-ce-EMM"/>
<constraint firstAttribute="bottom" secondItem="E9Q-uB-Uvd" secondAttribute="bottom" id="ssj-8N-2gP"/>
<constraint firstAttribute="trailing" secondItem="iQa-jk-pTS" secondAttribute="trailing" constant="24" id="zI6-rP-3kk"/>
......@@ -111,6 +120,7 @@
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="allButtonArrowImage" destination="ScT-dl-H7N" id="nMs-HW-P4D"/>
<outlet property="allButtonLabel" destination="KGA-M6-mox" id="34J-92-2Fb"/>
<outlet property="allButtonView" destination="9Qp-M4-KdO" id="dwb-fV-WAm"/>
<outlet property="categoryLabel" destination="2GN-Th-7DN" id="wGT-fB-Ktd"/>
......