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
ee0fc0d9
Commit
ee0fc0d9
authored
Oct 14, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update pulse in MaterialPulseCollectionViewCell
parent
c7ffe7a3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
64 deletions
+45
-64
MaterialKit.xcodeproj/project.pbxproj
+4
-4
Source/MaterialButton.swift
+12
-10
Source/MaterialPanCollectionViewCell.swift
+6
-28
Source/MaterialPulseCollectionViewCell.swift
+13
-14
Source/MaterialPulseView.swift
+10
-8
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
ee0fc0d9
...
...
@@ -67,7 +67,7 @@
9693BF961BCCCB520087054A
/* BasicCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF951BCCCB520087054A
/* BasicCardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9693BF971BCCCCB30087054A
/* BasicCardView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF951BCCCB520087054A
/* BasicCardView.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9693BF991BCDC1450087054A
/* SideNavigationViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF981BCDC1450087054A
/* SideNavigationViewController.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9693BF9C1BCDC16C0087054A
/* Material
CollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF9B1BCDC16C0087054A
/* Material
CollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9693BF9C1BCDC16C0087054A
/* Material
PanCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF9B1BCDC16C0087054A
/* MaterialPan
CollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9693BF9E1BCDC1840087054A
/* BasicCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF9D1BCDC1840087054A
/* BasicCollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9693BFA01BCF36A40087054A
/* MaterialPulseCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF9F1BCF36A40087054A
/* MaterialPulseCollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9699879C1BC5FE49006D678E
/* MaterialTextLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9699879B1BC5FE49006D678E
/* MaterialTextLayer.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
...
...
@@ -125,7 +125,7 @@
9693BF851BCB0E0A0087054A
/* Material+UIFont.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIFont.swift"
;
sourceTree
=
"<group>"
;
};
9693BF951BCCCB520087054A
/* BasicCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCardView.swift
;
sourceTree
=
"<group>"
;
};
9693BF981BCDC1450087054A
/* SideNavigationViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SideNavigationViewController.swift
;
sourceTree
=
"<group>"
;
};
9693BF9B1BCDC16C0087054A
/* Material
CollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Material
CollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9693BF9B1BCDC16C0087054A
/* Material
PanCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialPan
CollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9693BF9D1BCDC1840087054A
/* BasicCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9693BF9F1BCF36A40087054A
/* MaterialPulseCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialPulseCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9699879B1BC5FE49006D678E
/* MaterialTextLayer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTextLayer.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -318,7 +318,7 @@
isa
=
PBXGroup
;
children
=
(
9693BF9F1BCF36A40087054A
/* MaterialPulseCollectionViewCell.swift */
,
9693BF9B1BCDC16C0087054A
/* MaterialCollectionViewCell.swift */
,
9693BF9B1BCDC16C0087054A
/* Material
Pan
CollectionViewCell.swift */
,
9693BF9D1BCDC1840087054A
/* BasicCollectionViewCell.swift */
,
);
name
=
Collection
;
...
...
@@ -505,7 +505,7 @@
65BDD1791BB99C0F006F7F2B
/* RaisedButton.swift in Sources */
,
964B17B41BBA447F002A9CA0
/* MaterialLayout.swift in Sources */
,
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
,
9693BF9C1BCDC16C0087054A
/* MaterialCollectionViewCell.swift in Sources */
,
9693BF9C1BCDC16C0087054A
/* Material
Pan
CollectionViewCell.swift in Sources */
,
65BDD14F1BB5EE4A006F7F2B
/* MaterialGravity.swift in Sources */
,
65BDD1541BB6F473006F7F2B
/* MaterialDepth.swift in Sources */
,
65BDD1571BB6FC82006F7F2B
/* MaterialButton.swift in Sources */
,
...
...
Source/MaterialButton.swift
View file @
ee0fc0d9
...
...
@@ -385,11 +385,11 @@ public class MaterialButton : UIButton {
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
4
let
v
:
CGFloat
=
s
/
f
let
r
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
v
:
CGFloat
=
r
/
f
let
d
:
CGFloat
=
2
*
f
let
r
:
CGFloat
=
1.05
let
s
:
CGFloat
=
1.05
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
...
...
@@ -397,13 +397,13 @@ public class MaterialButton : UIButton {
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
s
/
d
self
.
pulseLayer
.
cornerRadius
=
r
/
d
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
1.5
*
d
,
duration
:
t
),
forKey
:
nil
)
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
d
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
r
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
...
...
@@ -415,7 +415,7 @@ public class MaterialButton : UIButton {
super
.
touchesMoved
(
touches
,
withEvent
:
event
)
if
spotlight
{
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
if
layer
.
containsPoint
(
point
)
{
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
position
=
point
})
...
...
@@ -502,16 +502,17 @@ public class MaterialButton : UIButton {
//
internal
func
shrink
()
{
let
t
:
CFTimeInterval
=
0.25
let
s
:
CGFloat
=
1
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
pulseLayer
.
hidden
=
true
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
\ No newline at end of file
Source/MaterialCollectionViewCell.swift
→
Source/Material
Pan
CollectionViewCell.swift
View file @
ee0fc0d9
...
...
@@ -36,6 +36,11 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
private
var
panRecognizer
:
UIPanGestureRecognizer
!
//
// :name: originalPosition
//
private
var
originalPosition
:
CGPoint
!
//
// :name: leftOnDragRelease
//
private
lazy
var
leftOnDragRelease
:
Bool
=
false
...
...
@@ -45,11 +50,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
//
private
lazy
var
rightOnDragRelease
:
Bool
=
false
//
// :name: originalPosition
//
private
var
originalPosition
:
CGPoint
!
/**
:name: leftLayer
*/
...
...
@@ -66,27 +66,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
public
private(set)
lazy
var
revealed
:
Bool
=
false
/**
:name: init
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
/**
:name: init
*/
public
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
}
/**
:name: init
*/
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectNull
)
}
/**
:name: gestureRecognizerShouldBegin
*/
public
override
func
gestureRecognizerShouldBegin
(
gestureRecognizer
:
UIGestureRecognizer
)
->
Bool
{
...
...
@@ -101,6 +80,7 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
:name: prepareView
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
flatButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
flatButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
flatButton
.
pulseColorOpacity
...
...
@@ -114,8 +94,6 @@ public class MaterialPanCollectionViewCell : MaterialPulseCollectionViewCell, UI
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
shape
=
MaterialTheme
.
flatButton
.
shape
prepareVisualLayer
()
preparePulseLayer
()
prepareLeftLayer
()
prepareRightLayer
()
preparePanGesture
()
...
...
Source/MaterialPulseCollectionViewCell.swift
View file @
ee0fc0d9
...
...
@@ -53,7 +53,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
/**
:name: pulseFill
*/
public
var
pulseFill
:
Bool
=
fals
e
{
public
var
pulseFill
:
Bool
=
tru
e
{
didSet
{
if
pulseFill
{
spotlight
=
false
...
...
@@ -427,25 +427,22 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
v
:
CGFloat
=
s
/
f
let
d
:
CGFloat
=
2
*
f
let
r
:
CGFloat
=
1.05
let
w
:
CGFloat
=
width
let
h
:
CGFloat
=
height
let
s
:
CGFloat
=
1.05
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
2
*
w
,
2
*
h
)
})
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
s
/
d
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
d
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
r
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
...
...
@@ -457,7 +454,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
super
.
touchesMoved
(
touches
,
withEvent
:
event
)
if
spotlight
{
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
if
layer
.
containsPoint
(
point
)
{
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
position
=
point
})
...
...
@@ -544,16 +541,17 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
//
internal
func
shrink
()
{
let
t
:
CFTimeInterval
=
0.25
let
s
:
CGFloat
=
1
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
pulseLayer
.
hidden
=
true
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
\ No newline at end of file
Source/MaterialPulseView.swift
View file @
ee0fc0d9
...
...
@@ -76,11 +76,11 @@ public class MaterialPulseView : MaterialView {
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
let
s
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
r
:
CGFloat
=
(
width
<
height
?
height
:
width
)
/
2
let
f
:
CGFloat
=
3
let
v
:
CGFloat
=
s
/
f
let
v
:
CGFloat
=
r
/
f
let
d
:
CGFloat
=
2
*
f
let
r
:
CGFloat
=
1.05
let
s
:
CGFloat
=
1.05
let
t
:
CFTimeInterval
=
0.25
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
...
...
@@ -88,13 +88,13 @@ public class MaterialPulseView : MaterialView {
self
.
pulseLayer
.
hidden
=
false
self
.
pulseLayer
.
bounds
=
CGRectMake
(
0
,
0
,
v
,
v
)
self
.
pulseLayer
.
position
=
point
self
.
pulseLayer
.
cornerRadius
=
s
/
d
self
.
pulseLayer
.
cornerRadius
=
r
/
d
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
pulseFill
?
3
*
d
:
d
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
r
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
...
...
@@ -106,7 +106,7 @@ public class MaterialPulseView : MaterialView {
super
.
touchesMoved
(
touches
,
withEvent
:
event
)
if
spotlight
{
let
point
:
CGPoint
=
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
)
if
true
==
layer
.
containsPoint
(
point
)
{
if
layer
.
containsPoint
(
point
)
{
MaterialAnimation
.
animationDisabled
({
self
.
pulseLayer
.
position
=
point
})
...
...
@@ -180,16 +180,17 @@ public class MaterialPulseView : MaterialView {
//
internal
func
shrink
()
{
let
t
:
CFTimeInterval
=
0.25
let
s
:
CGFloat
=
1
if
nil
!=
pulseColor
&&
0
<
pulseColorOpacity
{
MaterialAnimation
.
animationWithDuration
(
t
,
animations
:
{
self
.
pulseLayer
.
hidden
=
true
})
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
pulseLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
if
pulseScale
{
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
t
),
forKey
:
nil
)
layer
.
addAnimation
(
MaterialAnimation
.
scale
(
s
,
duration
:
t
),
forKey
:
nil
)
}
}
}
\ No newline at end of file
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