Commit 5fdb65df by Daniel Dahan

development: updated ImageCard and added defaults

parent 448b0318
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; }; 96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; };
96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96C910EE1B95804B00E7CE5C /* ImageRevealCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; };
9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; }; 9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; };
9A94D0FB1B895EA500F586A5 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */; }; 9A94D0FB1B895EA500F586A5 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */; };
...@@ -78,7 +76,6 @@ ...@@ -78,7 +76,6 @@
963832681B88E5BF0015F710 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; }; 963832681B88E5BF0015F710 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
963832871B8908180015F710 /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; }; 963832871B8908180015F710 /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; };
96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; }; 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; };
9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageRevealCard.swift; sourceTree = "<group>"; };
9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCard.swift; sourceTree = "<group>"; }; 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCard.swift; sourceTree = "<group>"; };
9A94D10A1B8A485C00F586A5 /* ImageCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCard.swift; sourceTree = "<group>"; }; 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCard.swift; sourceTree = "<group>"; };
9AAC384C1B89528900FE6B2D /* BasicCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCard.swift; sourceTree = "<group>"; }; 9AAC384C1B89528900FE6B2D /* BasicCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCard.swift; sourceTree = "<group>"; };
...@@ -235,7 +232,6 @@ ...@@ -235,7 +232,6 @@
9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */, 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */,
9AAC384C1B89528900FE6B2D /* BasicCard.swift */, 9AAC384C1B89528900FE6B2D /* BasicCard.swift */,
9A94D10A1B8A485C00F586A5 /* ImageCard.swift */, 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */,
9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */,
); );
name = Card; name = Card;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -273,7 +269,6 @@ ...@@ -273,7 +269,6 @@
657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */, 657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */,
657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */, 657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */,
96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */, 96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */,
96C910EE1B95804B00E7CE5C /* ImageRevealCard.swift in Headers */,
657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */, 657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -383,7 +378,6 @@ ...@@ -383,7 +378,6 @@
96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */, 96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */,
9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */, 9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */,
9A94D1091B8A3F5100F586A5 /* MaterialCard.swift in Sources */, 9A94D1091B8A3F5100F586A5 /* MaterialCard.swift in Sources */,
9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */,
65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */, 65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */,
9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */, 9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */,
963832711B88E5BF0015F710 /* Text.swift in Sources */, 963832711B88E5BF0015F710 /* Text.swift in Sources */,
......
...@@ -35,9 +35,9 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -35,9 +35,9 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
public var verticalSpace: CGFloat = 8 public var verticalSpace: CGFloat = 8
/** /**
:name: maximumDetailHeight :name: horizontalSpace
*/ */
public var maximumDetailHeight: CGFloat = 144 public var horizontalSpace: CGFloat = 8
/** /**
:name: titleLabelContainer :name: titleLabelContainer
...@@ -74,6 +74,7 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -74,6 +74,7 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
t.backgroundColor = MaterialTheme.clear.color t.backgroundColor = MaterialTheme.clear.color
t.font = Roboto.mediumWithSize(18) t.font = Roboto.mediumWithSize(18)
t.numberOfLines = 1 t.numberOfLines = 1
prepareCard()
} else { } else {
titleLabelContainer?.removeFromSuperview() titleLabelContainer?.removeFromSuperview()
} }
...@@ -81,6 +82,11 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -81,6 +82,11 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
} }
/** /**
:name: maximumDetailLabelHeight
*/
public var maximumDetailLabelHeight: CGFloat = 144
/**
:name: detailLabelContainer :name: detailLabelContainer
*/ */
public private(set) var detailLabelContainer: UIView? public private(set) var detailLabelContainer: UIView?
...@@ -203,7 +209,7 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -203,7 +209,7 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
views["titleLabelContainer"] = titleLabelContainer! views["titleLabelContainer"] = titleLabelContainer!
// text // text
titleLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!])) titleLabelContainer!.addConstraints(Layout.constraint("H:|-(horizontalSpace)-[titleLabel]-(horizontalSpace)-|", options: nil, metrics: ["horizontalSpace": horizontalSpace], views: ["titleLabel": titleLabel!]))
titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize + verticalSpace], views: ["titleLabel": titleLabel!])) titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize + verticalSpace], views: ["titleLabel": titleLabel!]))
} }
...@@ -215,8 +221,8 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -215,8 +221,8 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
views["detailLabelContainer"] = detailLabelContainer! views["detailLabelContainer"] = detailLabelContainer!
// text // text
detailLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[detailLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["detailLabel": detailLabel!])) detailLabelContainer!.addConstraints(Layout.constraint("H:|-(horizontalSpace)-[detailLabel]-(horizontalSpace)-|", options: nil, metrics: ["horizontalSpace": horizontalSpace], views: ["detailLabel": detailLabel!]))
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[detailLabel(<=maximumDetailHeight)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "maximumDetailHeight": maximumDetailHeight], views: ["detailLabel": detailLabel!])) detailLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[detailLabel(<=maximumDetailLabelHeight)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!]))
} }
if nil != buttonsContainer && (nil != leftButtons || nil != rightButtons) { if nil != buttonsContainer && (nil != leftButtons || nil != rightButtons) {
...@@ -240,10 +246,10 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -240,10 +246,10 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
let button: MaterialButton = leftButtons![i] let button: MaterialButton = leftButtons![i]
buttonsContainer!.addSubview(button) buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button buttonViews["button\(i)"] = button
horizontalFormat += "-(verticalSpace)-[button\(i)]" horizontalFormat += "-(horizontalSpace)-[button\(i)]"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalSpace, bottom: verticalSpace) Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: horizontalSpace, bottom: verticalSpace)
} }
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["verticalSpace": verticalSpace], views: buttonViews)) buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["horizontalSpace": horizontalSpace], views: buttonViews))
} }
// rightButtons // rightButtons
...@@ -254,10 +260,10 @@ public class BasicCard : MaterialCard, Comparable, Equatable { ...@@ -254,10 +260,10 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
let button: MaterialButton = rightButtons![i] let button: MaterialButton = rightButtons![i]
buttonsContainer!.addSubview(button) buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button buttonViews["button\(i)"] = button
horizontalFormat += "[button\(i)]-(verticalSpace)-" horizontalFormat += "[button\(i)]-(horizontalSpace)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalSpace, bottom: verticalSpace) Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: horizontalSpace, bottom: verticalSpace)
} }
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["verticalSpace": verticalSpace], views: buttonViews)) buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["horizontalSpace": horizontalSpace], views: buttonViews))
} }
} }
......
...@@ -27,7 +27,7 @@ public class FlatButton : MaterialButton { ...@@ -27,7 +27,7 @@ public class FlatButton : MaterialButton {
setTitleColor(MaterialTheme.indigo.darken1, forState: .Normal) setTitleColor(MaterialTheme.indigo.darken1, forState: .Normal)
pulseColor = MaterialTheme.indigo.darken1 pulseColor = MaterialTheme.indigo.darken1
backgroundColor = MaterialTheme.clear.color backgroundColor = MaterialTheme.clear.color
contentEdgeInsets = UIEdgeInsetsMake(4, 4, 4, 4) contentEdgeInsets = UIEdgeInsetsMake(4, 16, 4, 16)
} }
// //
......
////
//// RevealCard.swift
//// MaterialKit
////
//// Created by Adam Dahan on 2015-08-26.
//// Copyright (c) 2015 GraphKit Inc. All rights reserved.
////
//
//import UIKit
//
//public class ImageRevealCard : ImageCard {
//
// private lazy var revealView: UIView = UIView()
// private lazy var tapGesture: UITapGestureRecognizer = UITapGestureRecognizer()
// private lazy var metrics: Dictionary <String, AnyObject> = Dictionary <String, AnyObject>()
// private var topLayoutConstraint: NSLayoutConstraint!
// private lazy var hideRevealViewButton: UIButton = UIButton()
//
// public required init(coder aDecoder: NSCoder) {
// super.init(coder: aDecoder)
// }
//
// public required init(frame: CGRect) {
// super.init(frame: frame)
// }
//
// internal override func initialize() {
// prepareTapGestures()
// prepareRevealView()
// prepareHideRevealViewButton()
// super.initialize()
// }
//
// public override func layoutSubviews() {
// super.layoutSubviews()
// revealView.frame = CGRectMake(0, 0, bounds.width, bounds.height)
// hideRevealViewButton.frame = CGRectMake(CGRectGetMaxX(revealView.frame) - 50, 10, 40, 40)
// }
//
// private func prepareTapGestures() {
// tapGesture.addTarget(self, action: "showRevealView")
// imageView.userInteractionEnabled = true
// addGestureRecognizer(tapGesture)
// }
//
// private func prepareRevealView() {
// revealView.backgroundColor = .whiteColor()
// revealView.hidden = true
// imageView.addSubview(revealView)
// }
//
// private func prepareHideRevealViewButton() {
// hideRevealViewButton.setImage(UIImage(named: "ic_clear"), forState: .Normal)
// hideRevealViewButton.tintColor = .whiteColor()
// hideRevealViewButton.addTarget(self, action: "hideRevealView", forControlEvents: UIControlEvents.TouchUpInside)
// revealView.addSubview(hideRevealViewButton)
// }
//
// internal func showRevealView() {
// removeTapGestures()
// revealView.hidden = false
// revealView.frame = CGRectMake(0, bounds.height, bounds.width, bounds.height)
// UIView.animateWithDuration(0.3, animations: { () -> Void in
// var frame = self.revealView.frame
// frame.origin.y -= self.bounds.height
// self.revealView.frame = frame
// })
// }
//
// internal func hideRevealView() {
// UIView.animateWithDuration(0.3, animations: { () -> Void in
// var frame = self.revealView.frame
// frame.origin.y = self.bounds.height
// self.revealView.frame = frame
// }) { (finished) -> Void in
// self.revealView.hidden = true
// self.prepareTapGestures()
// }
// }
//
// private func removeTapGestures() {
// removeGestureRecognizer(tapGesture)
// }
//}
//
//
//
...@@ -44,7 +44,7 @@ public class MaterialButton : UIButton { ...@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
/** /**
:name: pulseColor :name: pulseColor
*/ */
public var pulseColor: UIColor? = MaterialTheme.white.color public var pulseColor: UIColor? = MaterialTheme.blueGrey.lighten3
/** /**
:name: init :name: init
......
...@@ -44,7 +44,7 @@ public class MaterialCard : UIView { ...@@ -44,7 +44,7 @@ public class MaterialCard : UIView {
/** /**
:name: pulseColor :name: pulseColor
*/ */
public var pulseColor: UIColor = MaterialTheme.white.color public var pulseColor: UIColor = MaterialTheme.blueGrey.lighten3
/** /**
:name: init :name: init
......
...@@ -26,7 +26,7 @@ public class RaisedButton : MaterialButton { ...@@ -26,7 +26,7 @@ public class RaisedButton : MaterialButton {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.white.color, forState: .Normal) setTitleColor(MaterialTheme.white.color, forState: .Normal)
backgroundColor = MaterialTheme.indigo.darken1 backgroundColor = MaterialTheme.indigo.darken1
contentEdgeInsets = UIEdgeInsetsMake(4, 4, 4, 4) contentEdgeInsets = UIEdgeInsetsMake(4, 16, 4, 16)
} }
// //
......
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