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
2c82f509
Commit
2c82f509
authored
Sep 02, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: working cards :)
parent
9e453dbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
Source/ImageCard.swift
+1
-1
Source/MaterialCard.swift
+24
-2
No files found.
Source/ImageCard.swift
View file @
2c82f509
...
...
@@ -69,7 +69,7 @@ public class ImageCard : MaterialCard, Comparable, Equatable {
imageViewContainer
=
UIView
()
imageViewContainer
!.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
imageViewContainer
!.
backgroundColor
=
MaterialTheme
.
clear
.
color
insertSubview
(
imageViewContainer
!
,
belowSubview
:
backgroundColorView
)
addSubview
(
imageViewContainer
!
)
}
// text
...
...
Source/MaterialCard.swift
View file @
2c82f509
...
...
@@ -25,6 +25,11 @@ public class MaterialCard : UIView {
internal
lazy
var
backgroundColorView
:
UIView
=
UIView
()
//
// :name: pulseViewContainer
//
internal
lazy
var
pulseViewContainer
:
UIView
=
UIView
()
//
// :name: pulseView
//
internal
var
pulseView
:
UIView
?
...
...
@@ -101,6 +106,7 @@ public class MaterialCard : UIView {
internal
func
prepareView
()
{
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
prepareBackgroundColorView
()
preparePulseViewContainer
()
prepareCard
()
}
...
...
@@ -145,8 +151,10 @@ public class MaterialCard : UIView {
pulseView
=
UIView
(
frame
:
CGRectMake
(
0
,
0
,
width
,
width
))
pulseView
!.
layer
.
cornerRadius
=
width
/
2
pulseView
!.
center
=
(
touches
.
first
as!
UITouch
)
.
locationInView
(
self
)
pulseView
!.
backgroundColor
=
pulseColor
.
colorWithAlphaComponent
(
0.5
)
backgroundColorView
.
addSubview
(
pulseView
!
)
pulseView
!.
backgroundColor
=
pulseColor
.
colorWithAlphaComponent
(
0.3
)
addSubview
(
pulseViewContainer
)
Layout
.
expandToParent
(
self
,
child
:
pulseViewContainer
)
pulseViewContainer
.
addSubview
(
pulseView
!
)
UIView
.
animateWithDuration
(
0.3
,
animations
:
{
self
.
pulseView
!.
transform
=
CGAffineTransformMakeScale
(
3
,
3
)
self
.
transform
=
CGAffineTransformMakeScale
(
1.05
,
1.05
)
...
...
@@ -162,6 +170,7 @@ public class MaterialCard : UIView {
self
.
pulseView
?
.
alpha
=
0
}
)
{
_
in
self
.
pulseViewContainer
.
removeFromSuperview
()
self
.
pulseView
?
.
removeFromSuperview
()
self
.
pulseView
=
nil
}
...
...
@@ -183,6 +192,19 @@ public class MaterialCard : UIView {
}
//
// :name: preparePulseViewContainer
//
// We need this view so we can use the masksToBounds
// so the pulse doesn't animate off the button
private
func
preparePulseViewContainer
()
{
pulseViewContainer
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
pulseViewContainer
.
layer
.
cornerRadius
=
2
pulseViewContainer
.
layer
.
masksToBounds
=
true
pulseViewContainer
.
clipsToBounds
=
true
pulseViewContainer
.
userInteractionEnabled
=
false
}
//
// :name: shrink
//
private
func
shrink
()
{
...
...
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