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
...
@@ -81,24 +81,42 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
*/
*/
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
flatButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
flatButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
flatButton
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
flatButton
.
pulseColor
shadowDepth
=
MaterialTheme
.
flatButton
.
shadowDepth
userInteractionEnabled
=
MaterialTheme
.
pulseCollectionView
.
userInteractionEnabled
shadowColor
=
MaterialTheme
.
flatButton
.
shadowColor
backgroundColor
=
MaterialTheme
.
pulseCollectionView
.
backgroundColor
zPosition
=
MaterialTheme
.
flatButton
.
zPosition
pulseColorOpacity
=
MaterialTheme
.
pulseCollectionView
.
pulseColorOpacity
cornerRadius
=
MaterialTheme
.
flatButton
.
cornerRadius
pulseColor
=
MaterialTheme
.
pulseCollectionView
.
pulseColor
borderWidth
=
MaterialTheme
.
flatButton
.
borderWidth
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
shadowDepth
=
MaterialTheme
.
pulseCollectionView
.
shadowDepth
shape
=
MaterialTheme
.
flatButton
.
shape
shadowColor
=
MaterialTheme
.
pulseCollectionView
.
shadowColor
zPosition
=
MaterialTheme
.
pulseCollectionView
.
zPosition
borderWidth
=
MaterialTheme
.
pulseCollectionView
.
borderWidth
borderColor
=
MaterialTheme
.
pulseCollectionView
.
bordercolor
masksToBounds
=
true
prepareLeftLayer
()
prepareLeftLayer
()
prepareRightLayer
()
prepareRightLayer
()
preparePanGesture
()
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
// :name: prepareLeftLayer
//
//
...
@@ -124,7 +142,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
...
@@ -124,7 +142,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
addGestureRecognizer
(
panRecognizer
)
addGestureRecognizer
(
panRecognizer
)
}
}
//
//
// :name: handlePanGesture
// :name: handlePanGesture
//
//
...
@@ -132,7 +149,7 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
...
@@ -132,7 +149,7 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
switch
recognizer
.
state
{
switch
recognizer
.
state
{
case
.
Began
:
case
.
Began
:
originalPosition
=
position
originalPosition
=
position
masksToBounds
=
false
rightOnDragRelease
=
x
<
-
width
/
2
rightOnDragRelease
=
x
<
-
width
/
2
leftOnDragRelease
=
x
>
width
/
2
leftOnDragRelease
=
x
>
width
/
2
...
@@ -162,16 +179,9 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
...
@@ -162,16 +179,9 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
case
.
Ended
:
case
.
Ended
:
revealed
=
false
revealed
=
false
// snap back
// snap back
animation
(
MaterialAnimation
.
position
(
CGPointMake
(
width
/
2
,
y
+
height
/
2
),
duration
:
0.25
))
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
default
:
break
}
}
}
}
...
...
Source/MaterialTheme.swift
View file @
8333cdd2
...
@@ -256,6 +256,8 @@ public extension MaterialTheme.pulseCollectionView {
...
@@ -256,6 +256,8 @@ public extension MaterialTheme.pulseCollectionView {
// color
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
white
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten4
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
// interaction
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
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