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
8333cdd2
Commit
8333cdd2
authored
Oct 20, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated delegation calls in Material CollectionViewCell
parent
7fbb656d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
20 deletions
+32
-20
Source/MaterialPanCollectionViewCell.swift
+30
-20
Source/MaterialTheme.swift
+2
-0
No files found.
Source/MaterialPanCollectionViewCell.swift
View file @
8333cdd2
...
...
@@ -81,24 +81,42 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
flatButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
flatButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
flatButton
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
flatButton
.
pulseColor
shadowDepth
=
MaterialTheme
.
flatButton
.
shadowDepth
shadowColor
=
MaterialTheme
.
flatButton
.
shadowColor
zPosition
=
MaterialTheme
.
flatButton
.
zPosition
cornerRadius
=
MaterialTheme
.
flatButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
flatButton
.
borderWidth
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
shape
=
MaterialTheme
.
flatButton
.
shape
userInteractionEnabled
=
MaterialTheme
.
pulseCollectionView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
pulseCollectionView
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
pulseCollectionView
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
pulseCollectionView
.
pulseColor
shadowDepth
=
MaterialTheme
.
pulseCollectionView
.
shadowDepth
shadowColor
=
MaterialTheme
.
pulseCollectionView
.
shadowColor
zPosition
=
MaterialTheme
.
pulseCollectionView
.
zPosition
borderWidth
=
MaterialTheme
.
pulseCollectionView
.
borderWidth
borderColor
=
MaterialTheme
.
pulseCollectionView
.
bordercolor
masksToBounds
=
true
prepareLeftLayer
()
prepareRightLayer
()
preparePanGesture
()
}
/**
:name: animationDidStop
*/
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
super
.
animationDidStop
(
anim
,
finished
:
flag
)
if
let
a
:
CABasicAnimation
=
anim
as?
CABasicAnimation
{
if
"position"
==
a
.
keyPath
{
masksToBounds
=
true
if
leftOnDragRelease
{
(
delegate
as?
MaterialPanCollectionViewCellDelegate
)?
.
materialCollectionViewCellDidCloseLeftLayer
?(
self
)
}
else
if
rightOnDragRelease
{
(
delegate
as?
MaterialPanCollectionViewCellDelegate
)?
.
materialCollectionViewCellDidCloseRightLayer
?(
self
)
}
}
}
}
//
// :name: prepareLeftLayer
//
...
...
@@ -124,7 +142,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
addGestureRecognizer
(
panRecognizer
)
}
//
// :name: handlePanGesture
//
...
...
@@ -132,7 +149,7 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
switch
recognizer
.
state
{
case
.
Began
:
originalPosition
=
position
masksToBounds
=
false
rightOnDragRelease
=
x
<
-
width
/
2
leftOnDragRelease
=
x
>
width
/
2
...
...
@@ -162,16 +179,9 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
case
.
Ended
:
revealed
=
false
// snap back
animation
(
MaterialAnimation
.
position
(
CGPointMake
(
width
/
2
,
y
+
height
/
2
),
duration
:
0.25
))
if
leftOnDragRelease
{
(
delegate
as?
MaterialPanCollectionViewCellDelegate
)?
.
materialCollectionViewCellDidCloseLeftLayer
?(
self
)
}
else
if
rightOnDragRelease
{
(
delegate
as?
MaterialPanCollectionViewCellDelegate
)?
.
materialCollectionViewCellDidCloseRightLayer
?(
self
)
}
default
:
break
}
}
...
...
Source/MaterialTheme.swift
View file @
8333cdd2
...
...
@@ -256,6 +256,8 @@ public extension MaterialTheme.pulseCollectionView {
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten4
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
...
...
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