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
4e2e0f24
Commit
4e2e0f24
authored
Nov 14, 2015
by
danieldahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated to latest
parent
9a2e6a45
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
45 deletions
+62
-45
Source/BasicCollectionViewCell.swift
+7
-6
Source/MaterialButton.swift
+6
-6
Source/MaterialLayer.swift
+2
-2
Source/MaterialPanCollectionViewCell.swift
+35
-19
Source/MaterialPulseCollectionViewCell.swift
+4
-4
Source/MaterialPulseView.swift
+4
-4
Source/MaterialView.swift
+4
-4
Source/SideNavigationViewController.swift
+0
-0
No files found.
Source/BasicCollectionViewCell.swift
View file @
4e2e0f24
...
...
@@ -20,14 +20,14 @@ import UIKit
public
class
BasicCollectionViewCell
:
MaterialPanCollectionViewCell
{
/**
:name: titleLa
yer
:name: titleLa
bel
*/
public
private(set)
lazy
var
titleLa
yer
:
MaterialTextLayer
=
MaterialTextLayer
()
public
private(set)
lazy
var
titleLa
bel
:
MaterialLabel
=
MaterialLabel
()
/**
:name: detailLa
yer
:name: detailLa
bel
*/
public
private(set)
lazy
var
detailLa
yer
:
MaterialTextLayer
=
MaterialTextLayer
()
public
private(set)
lazy
var
detailLa
bel
:
MaterialLabel
=
MaterialLabel
()
/**
:name: prepareView
...
...
@@ -36,9 +36,9 @@ public class BasicCollectionViewCell : MaterialPanCollectionViewCell {
super
.
prepareView
()
// title
layer
.
addSublayer
(
titleLayer
)
addSubview
(
titleLabel
)
// detail
layer
.
addSublayer
(
detailLayer
)
addSubview
(
detailLabel
)
}
}
\ No newline at end of file
Source/MaterialButton.swift
View file @
4e2e0f24
...
...
@@ -364,9 +364,9 @@ public class MaterialButton : UIButton {
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
anim
as?
CAPropertyAnimation
{
if
let
b
:
CABasicAnimation
=
a
as?
CABasicAnimation
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
layer
.
setValue
(
nil
==
b
.
toValue
?
b
.
byValue
:
b
.
toValue
,
forKey
:
b
.
keyPath
!
)
}
)
}
}
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
anim
,
finished
:
flag
)
layer
.
removeAnimationForKey
(
a
.
keyPath
!
)
...
...
@@ -393,12 +393,12 @@ public class MaterialButton : UIButton {
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
r
/
d
}
)
}
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
1.5
*
d
,
duration
:
t
),
forKey
:
nil
)
}
...
...
@@ -416,9 +416,9 @@ public class MaterialButton : UIButton {
if
spotlight
{
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
layer
.
containsPoint
(
point
)
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
pulseLayer
.
position
=
point
}
)
}
}
}
}
...
...
Source/MaterialLayer.swift
View file @
4e2e0f24
...
...
@@ -254,9 +254,9 @@ public class MaterialLayer : CAShapeLayer {
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
anim
as?
CAPropertyAnimation
{
if
let
b
:
CABasicAnimation
=
a
as?
CABasicAnimation
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
setValue
(
nil
==
b
.
toValue
?
b
.
byValue
:
b
.
toValue
,
forKey
:
b
.
keyPath
!
)
}
)
}
}
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
anim
,
finished
:
flag
)
removeAnimationForKey
(
a
.
keyPath
!
)
...
...
Source/MaterialPanCollectionViewCell.swift
View file @
4e2e0f24
...
...
@@ -51,14 +51,14 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
private
lazy
var
rightOnDragRelease
:
Bool
=
false
/**
:name: left
Layer
:name: left
View
*/
public
private(set)
lazy
var
left
Layer
:
MaterialLayer
=
MaterialLayer
()
public
private(set)
lazy
var
left
View
:
MaterialView
=
MaterialView
()
/**
:name: right
Layer
:name: right
View
*/
public
private(set)
lazy
var
right
Layer
:
MaterialLayer
=
MaterialLayer
()
public
private(set)
lazy
var
right
View
:
MaterialView
=
MaterialView
()
/**
:name: revealed
...
...
@@ -66,6 +66,11 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
public
private(set)
lazy
var
revealed
:
Bool
=
false
/**
:name: closeAutomatically
*/
public
lazy
var
closeAutomatically
:
Bool
=
true
/**
:name: gestureRecognizerShouldBegin
*/
public
override
func
gestureRecognizerShouldBegin
(
gestureRecognizer
:
UIGestureRecognizer
)
->
Bool
{
...
...
@@ -94,8 +99,8 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
borderColor
=
MaterialTheme
.
pulseCollectionView
.
bordercolor
masksToBounds
=
true
prepareLeft
Layer
()
prepareRight
Layer
()
prepareLeft
View
()
prepareRight
View
()
preparePanGesture
()
}
...
...
@@ -117,20 +122,27 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
}
}
/**
:name: close
*/
public
func
close
()
{
animation
(
MaterialAnimation
.
position
(
CGPointMake
(
width
/
2
,
y
+
height
/
2
),
duration
:
0.25
))
}
//
// :name: prepareLeft
Layer
// :name: prepareLeft
View
//
internal
func
prepareLeft
Layer
()
{
left
Layer
.
frame
=
CGRectMake
(
-
width
,
0
,
width
,
height
)
layer
.
addSublayer
(
leftLayer
)
internal
func
prepareLeft
View
()
{
left
View
.
frame
=
CGRectMake
(
-
width
,
0
,
width
,
height
)
addSubview
(
leftView
)
}
//
// :name: prepareRight
Layer
// :name: prepareRight
View
//
internal
func
prepareRight
Layer
()
{
right
Layer
.
frame
=
CGRectMake
(
width
,
0
,
width
,
height
)
layer
.
addSublayer
(
rightLayer
)
internal
func
prepareRight
View
()
{
right
View
.
frame
=
CGRectMake
(
width
,
0
,
width
,
height
)
addSubview
(
rightView
)
}
//
...
...
@@ -150,17 +162,17 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
case
.
Began
:
originalPosition
=
position
masksToBounds
=
false
rightOnDragRelease
=
x
<
-
width
/
2
leftOnDragRelease
=
x
>
width
/
2
rightOnDragRelease
=
x
<
-
width
/
2
case
.
Changed
:
let
translation
=
recognizer
.
translationInView
(
self
)
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
position
.
x
=
self
.
originalPosition
.
x
+
translation
.
x
}
)
}
rightOnDragRelease
=
x
<
-
width
/
2
leftOnDragRelease
=
x
>
width
/
2
rightOnDragRelease
=
x
<
-
width
/
2
if
!
revealed
&&
(
leftOnDragRelease
||
rightOnDragRelease
)
{
revealed
=
true
...
...
@@ -180,7 +192,11 @@ 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
||
!
rightOnDragRelease
{
close
()
}
else
if
closeAutomatically
&&
(
leftOnDragRelease
||
rightOnDragRelease
)
{
close
()
}
default
:
break
}
...
...
Source/MaterialPulseCollectionViewCell.swift
View file @
4e2e0f24
...
...
@@ -385,9 +385,9 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
anim
as?
CAPropertyAnimation
{
if
let
b
:
CABasicAnimation
=
a
as?
CABasicAnimation
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
layer
.
setValue
(
nil
==
b
.
toValue
?
b
.
byValue
:
b
.
toValue
,
forKey
:
b
.
keyPath
!
)
}
)
}
}
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
anim
,
finished
:
flag
)
layer
.
removeAnimationForKey
(
a
.
keyPath
!
)
...
...
@@ -411,9 +411,9 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
2
*
w
,
2
*
h
)
}
)
}
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
pulseLayer
.
hidden
=
false
})
...
...
Source/MaterialPulseView.swift
View file @
4e2e0f24
...
...
@@ -84,12 +84,12 @@ public class MaterialPulseView : MaterialView {
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
r
/
d
}
)
}
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
d
,
duration
:
t
),
forKey
:
nil
)
}
...
...
@@ -107,9 +107,9 @@ public class MaterialPulseView : MaterialView {
if
spotlight
{
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
layer
.
containsPoint
(
point
)
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
pulseLayer
.
position
=
point
}
)
}
}
}
}
...
...
Source/MaterialView.swift
View file @
4e2e0f24
...
...
@@ -101,10 +101,10 @@ public class MaterialView : UIView {
*/
public
var
x
:
CGFloat
{
get
{
return
frame
.
origin
.
x
return
layer
.
frame
.
origin
.
x
}
set
(
value
)
{
frame
.
origin
.
x
=
value
layer
.
frame
.
origin
.
x
=
value
}
}
...
...
@@ -365,9 +365,9 @@ public class MaterialView : UIView {
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
anim
as?
CAPropertyAnimation
{
if
let
b
:
CABasicAnimation
=
a
as?
CABasicAnimation
{
MaterialAnimation
.
animationDisabled
(
{
MaterialAnimation
.
animationDisabled
{
self
.
layer
.
setValue
(
nil
==
b
.
toValue
?
b
.
byValue
:
b
.
toValue
,
forKey
:
b
.
keyPath
!
)
}
)
}
}
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
anim
,
finished
:
flag
)
layer
.
removeAnimationForKey
(
a
.
keyPath
!
)
...
...
Source/SideNavigationViewController.swift
View file @
4e2e0f24
This diff is collapsed.
Click to expand it.
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