Unverified Commit e2e3c873 authored by Zach Knox's avatar Zach Knox
Browse files

Shadows and animations, oh and you can close the detail view with voiceover now

parent 7c6a70a4
......@@ -155,7 +155,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="naC-sZ-bcy">
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="naC-sZ-bcy">
<rect key="frame" x="0.0" y="116" width="375" height="507"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<gestureRecognizers/>
......@@ -313,9 +313,10 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="naC-sZ-bcy" firstAttribute="leading" secondItem="uyS-pc-zem" secondAttribute="leading" id="8qe-8Q-n4N"/>
<constraint firstItem="uyS-pc-zem" firstAttribute="bottom" secondItem="8FA-yc-q3z" secondAttribute="bottom" id="HZe-Pq-6Jf"/>
<constraint firstItem="8FA-yc-q3z" firstAttribute="leading" secondItem="avG-8M-sVI" secondAttribute="leading" id="Hbe-dA-GI7"/>
<constraint firstItem="naC-sZ-bcy" firstAttribute="width" secondItem="avG-8M-sVI" secondAttribute="width" id="YGE-MT-SX5"/>
<constraint firstItem="uyS-pc-zem" firstAttribute="trailing" secondItem="naC-sZ-bcy" secondAttribute="trailing" id="Txw-xY-c0f"/>
<constraint firstAttribute="trailing" secondItem="8FA-yc-q3z" secondAttribute="trailing" id="Zqb-Sf-oE3"/>
<constraint firstItem="naC-sZ-bcy" firstAttribute="bottom" secondItem="8FA-yc-q3z" secondAttribute="top" id="uPG-sr-fLJ"/>
<constraint firstItem="naC-sZ-bcy" firstAttribute="top" secondItem="uyS-pc-zem" secondAttribute="top" id="wgO-7q-0zE"/>
......@@ -750,6 +751,7 @@
</view>
<connections>
<outlet property="containerView" destination="7YD-bF-DBg" id="4FF-ZZ-bmY"/>
<outlet property="pullDown" destination="wLk-ur-Xnx" id="w86-BQ-fKD"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9oH-oz-bTd" userLabel="First Responder" sceneMemberID="firstResponder"/>
......
......@@ -39,6 +39,31 @@ class FacilityCollectionViewCell: UICollectionViewCell {
isAccessibilityElement = true
shouldGroupAccessibilityChildren = true
tapRecognizer.cancelsTouchesInView = true
// Initialization code
}
// Animations - modified based on this: https://stackoverflow.com/questions/35236271/make-a-collectionviewcell-bounce-on-highlight-in-swift#35236995
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
{
UIView.animate(withDuration: 0.2) { () -> Void in
let shrinkTransform = CGAffineTransform.init(scaleX: 0.95, y: 0.95)
self.transform = shrinkTransform
}
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?)
{
super.touchesEnded(touches, with: event)
UIView.animate(withDuration: 0.3) { () -> Void in
self.transform = .identity
}
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event)
UIView.animate(withDuration: 0.3) { () -> Void in
self.transform = .identity
}
}
}
......@@ -623,11 +623,17 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
//Accessibility
//TODO: FIX THIS
cell.accessibilityLabel = cell.nameLabel.text! + ", Currently " + cell.openClosedLabel.text! + "." + cell.timeDescriptionLabel.text!
cell.accessibilityLabel = cell.nameLabel.text! + " " + cell.categoryLabel.text! + ", Currently " + cell.openClosedLabel.text! + ". Located in" + cell.timeDescriptionLabel.text!
cell.accessibilityHint = "Double Tap to view details"
//Shadows
cell.layer.shadowColor = UIColor.black.cgColor
cell.layer.shadowOffset = CGSize(width: 0, height: 3)
cell.layer.shadowRadius = 7.0
cell.layer.shadowOpacity = 0.4
cell.layer.masksToBounds = false
cell.layer.shadowPath = UIBezierPath(roundedRect: cell.bounds, cornerRadius: cell.layer.cornerRadius).cgPath
self.reloadInputViews()
return cell
}
......@@ -665,6 +671,7 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
// MARK - Collection View Cell Layout
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if(indexPath.section == 1 || currentAlerts.count == 0) {
let height = LocationsListLayout.itemSize.height
......@@ -692,6 +699,24 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
if(section == 1 || currentAlerts.count == 0) {
return 15
}
else {
return 0
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
if(section == 1 || currentAlerts.count == 0) {
return 10
}
else {
return 0
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
var sectionInsets = LocationsListLayout.sectionInset
if(section != 1 && alertsList.count != 0) {
......
......@@ -13,6 +13,8 @@ class PullingViewController: UIViewController {
@IBOutlet var containerView: UIView!
weak var currentViewController: UIViewController?
@IBOutlet var pullDown: UIImageView!
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
......@@ -26,11 +28,18 @@ class PullingViewController: UIViewController {
self.currentViewController!.view.translatesAutoresizingMaskIntoConstraints = false
self.addChildViewController(self.currentViewController!)
self.addSubview(self.currentViewController!.view, toView: self.containerView)
self.accessibilityCustomActions = [
UIAccessibilityCustomAction(name: "Dismiss Detail View", target: self, selector: #selector(PullingViewController.willDismiss))
]
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@objc func willDismiss() {
dismiss(animated: true, completion: nil)
}
func addSubview(_ subView: UIView, toView parentView: UIView) {
parentView.addSubview(subView)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment