Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
8eed8b5d
Commit
8eed8b5d
authored
Aug 29, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue-7: working on card interactivity
parent
676b31ec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
17 deletions
+16
-17
Source/BasicCard.swift
+6
-12
Source/FlatButton.swift
+3
-3
Source/MaterialTheme.swift
+5
-0
Source/RaisedButton.swift
+2
-2
No files found.
Source/BasicCard.swift
View file @
8eed8b5d
...
@@ -34,13 +34,12 @@ public class BasicCard : MaterialCard {
...
@@ -34,13 +34,12 @@ public class BasicCard : MaterialCard {
prepareDetailTextLabel
()
prepareDetailTextLabel
()
prepareHorizontalSeparator
()
prepareHorizontalSeparator
()
prepareButtons
()
prepareButtons
()
// super.constrainSubviews()
addConstraints
(
Layout
.
constraint
(
"H:|-(20)-[titleLabel]-(20)-|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"titleLabel"
:
titleLabel
]))
// addConstraints(Layout.constraint("H:|-(20)-[titleLabel]-(20)-|", options: nil, metrics: nil, views: views))
addConstraints
(
Layout
.
constraint
(
"H:|-(20)-[detailTextLabel]-(20)-|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"detailTextLabel"
:
detailTextLabel
]))
// addConstraints(Layout.constraint("H:|-(20)-[detailTextLabel]-(20)-|", options: nil, metrics: nil, views: views))
addConstraints
(
Layout
.
constraint
(
"H:|[horizontalSeparator]|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"horizontalSeparator"
:
horizontalSeparator
]))
// addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: views))
addConstraints
(
Layout
.
constraint
(
"H:|-(10)-[cancelButton(80)]-(10)-[otherButton(80)]"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"cancelButton"
:
cancelButton
,
"otherButton"
:
otherButton
]))
// addConstraints(Layout.constraint("H:|-(10)-[cancelButton(80)]-(10)-[otherButton(80)]", options: nil, metrics: nil, views: views))
addConstraints
(
Layout
.
constraint
(
"V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[cancelButton]-(10)-|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"titleLabel"
:
titleLabel
,
"detailTextLabel"
:
detailTextLabel
,
"horizontalSeparator"
:
horizontalSeparator
,
"cancelButton"
:
cancelButton
,
"otherButton"
:
otherButton
]))
// addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[cancelButton]-(10)-|", options: nil, metrics: nil, views: views))
addConstraints
(
Layout
.
constraint
(
"V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[otherButton]-(10)-|"
,
options
:
nil
,
metrics
:
nil
,
views
:
[
"titleLabel"
:
titleLabel
,
"detailTextLabel"
:
detailTextLabel
,
"horizontalSeparator"
:
horizontalSeparator
,
"otherButton"
:
otherButton
]))
// addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[horizontalSeparator(1)]-(10)-[otherButton]-(10)-|", options: nil, metrics: nil, views: views))
}
}
private
func
prepareTitleLabel
()
{
private
func
prepareTitleLabel
()
{
...
@@ -49,7 +48,6 @@ public class BasicCard : MaterialCard {
...
@@ -49,7 +48,6 @@ public class BasicCard : MaterialCard {
titleLabel
.
textColor
=
UIColor
.
whiteColor
()
titleLabel
.
textColor
=
UIColor
.
whiteColor
()
titleLabel
.
text
=
"Card Title"
titleLabel
.
text
=
"Card Title"
addSubview
(
titleLabel
)
addSubview
(
titleLabel
)
views
[
"titleLabel"
]
=
titleLabel
}
}
private
func
prepareDetailTextLabel
()
{
private
func
prepareDetailTextLabel
()
{
...
@@ -60,7 +58,6 @@ public class BasicCard : MaterialCard {
...
@@ -60,7 +58,6 @@ public class BasicCard : MaterialCard {
detailTextLabel
.
numberOfLines
=
0
detailTextLabel
.
numberOfLines
=
0
detailTextLabel
.
lineBreakMode
=
NSLineBreakMode
.
ByWordWrapping
detailTextLabel
.
lineBreakMode
=
NSLineBreakMode
.
ByWordWrapping
addSubview
(
detailTextLabel
)
addSubview
(
detailTextLabel
)
views
[
"detailTextLabel"
]
=
detailTextLabel
}
}
private
func
prepareHorizontalSeparator
()
{
private
func
prepareHorizontalSeparator
()
{
...
@@ -68,7 +65,6 @@ public class BasicCard : MaterialCard {
...
@@ -68,7 +65,6 @@ public class BasicCard : MaterialCard {
horizontalSeparator
.
backgroundColor
=
UIColor
.
whiteColor
()
horizontalSeparator
.
backgroundColor
=
UIColor
.
whiteColor
()
horizontalSeparator
.
alpha
=
0.2
horizontalSeparator
.
alpha
=
0.2
addSubview
(
horizontalSeparator
)
addSubview
(
horizontalSeparator
)
views
[
"horizontalSeparator"
]
=
horizontalSeparator
}
}
private
func
prepareButtons
()
{
private
func
prepareButtons
()
{
...
@@ -82,7 +78,6 @@ public class BasicCard : MaterialCard {
...
@@ -82,7 +78,6 @@ public class BasicCard : MaterialCard {
cancelButton
.
setTitleColor
(
buttonColor
,
forState
:
.
Normal
)
cancelButton
.
setTitleColor
(
buttonColor
,
forState
:
.
Normal
)
cancelButton
.
pulseColor
=
buttonColor
cancelButton
.
pulseColor
=
buttonColor
addSubview
(
cancelButton
)
addSubview
(
cancelButton
)
views
[
"cancelButton"
]
=
cancelButton
}
}
private
func
prepareOtherButton
()
{
private
func
prepareOtherButton
()
{
...
@@ -91,6 +86,5 @@ public class BasicCard : MaterialCard {
...
@@ -91,6 +86,5 @@ public class BasicCard : MaterialCard {
otherButton
.
setTitleColor
(
buttonColor
,
forState
:
.
Normal
)
otherButton
.
setTitleColor
(
buttonColor
,
forState
:
.
Normal
)
otherButton
.
pulseColor
=
buttonColor
otherButton
.
pulseColor
=
buttonColor
addSubview
(
otherButton
)
addSubview
(
otherButton
)
views
[
"otherButton"
]
=
otherButton
}
}
}
}
Source/FlatButton.swift
View file @
8eed8b5d
...
@@ -24,9 +24,9 @@ public class FlatButton : MaterialButton {
...
@@ -24,9 +24,9 @@ public class FlatButton : MaterialButton {
//
//
internal
override
func
prepareButton
()
{
internal
override
func
prepareButton
()
{
super
.
prepareButton
()
super
.
prepareButton
()
setTitleColor
(
UIColor
.
purpleColor
()
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
indigo
.
darken1
,
forState
:
.
Normal
)
pulseColor
=
MaterialTheme
.
purple
.
darken1
pulseColor
=
MaterialTheme
.
indigo
.
darken1
backgroundColor
=
.
clearColor
()
backgroundColor
=
MaterialTheme
.
clear
.
color
backgroundColorView
.
layer
.
cornerRadius
=
3
backgroundColorView
.
layer
.
cornerRadius
=
3
}
}
...
...
Source/MaterialTheme.swift
View file @
8eed8b5d
...
@@ -19,6 +19,11 @@
...
@@ -19,6 +19,11 @@
import
UIKit
import
UIKit
public
struct
MaterialTheme
{
public
struct
MaterialTheme
{
// clear
public
struct
clear
{
public
static
let
color
:
UIColor
=
UIColor
.
clearColor
()
}
// white
// white
public
struct
white
{
public
struct
white
{
public
static
let
color
:
UIColor
=
UIColor
(
red
:
255
/
255
,
green
:
255
/
255
,
blue
:
255
/
255
,
alpha
:
1
)
public
static
let
color
:
UIColor
=
UIColor
(
red
:
255
/
255
,
green
:
255
/
255
,
blue
:
255
/
255
,
alpha
:
1
)
...
...
Source/RaisedButton.swift
View file @
8eed8b5d
...
@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton {
...
@@ -25,8 +25,8 @@ public class RaisedButton : MaterialButton {
internal
override
func
prepareButton
()
{
internal
override
func
prepareButton
()
{
super
.
prepareButton
()
super
.
prepareButton
()
prepareShadow
()
prepareShadow
()
setTitleColor
(
UIColor
.
whiteColor
()
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
white
.
color
,
forState
:
.
Normal
)
backgroundColor
=
MaterialTheme
.
purple
.
darken1
backgroundColor
=
MaterialTheme
.
indigo
.
darken1
backgroundColorView
.
layer
.
cornerRadius
=
3
backgroundColorView
.
layer
.
cornerRadius
=
3
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment