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
e1bece98
Commit
e1bece98
authored
May 03, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated SideNavigationController and animation pulse for .Center type
parent
ff3d131f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
44 deletions
+41
-44
Examples/Programmatic/App/App/AppNavigationController.swift
+1
-0
Sources/iOS/FabButton.swift
+1
-1
Sources/iOS/MaterialPulseAnimation.swift
+11
-5
Sources/iOS/NavigationBar.swift
+2
-2
Sources/iOS/SideNavigationController.swift
+26
-36
No files found.
Examples/Programmatic/App/App/AppNavigationController.swift
View file @
e1bece98
...
@@ -44,6 +44,7 @@ class AppNavigationController: NavigationController {
...
@@ -44,6 +44,7 @@ class AppNavigationController: NavigationController {
override
func
viewWillLayoutSubviews
()
{
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
super
.
viewWillLayoutSubviews
()
statusBarView
?
.
hidden
=
MaterialDevice
.
statusBarHidden
statusBarView
?
.
hidden
=
MaterialDevice
.
statusBarHidden
print
(
MaterialDevice
.
statusBarHidden
)
}
}
/// Prepares the statusBarView
/// Prepares the statusBarView
...
...
Sources/iOS/FabButton.swift
View file @
e1bece98
...
@@ -42,7 +42,7 @@ public class FabButton : MaterialButton {
...
@@ -42,7 +42,7 @@ public class FabButton : MaterialButton {
super
.
prepareView
()
super
.
prepareView
()
depth
=
.
Depth1
depth
=
.
Depth1
shape
=
.
Circle
shape
=
.
Circle
pulseAnimation
=
.
Center
pulseAnimation
=
.
Center
WithBacking
pulseColor
=
MaterialColor
.
white
pulseColor
=
MaterialColor
.
white
tintColor
=
MaterialColor
.
white
tintColor
=
MaterialColor
.
white
backgroundColor
=
MaterialColor
.
red
.
base
backgroundColor
=
MaterialColor
.
red
.
base
...
...
Sources/iOS/MaterialPulseAnimation.swift
View file @
e1bece98
...
@@ -74,17 +74,20 @@ internal extension MaterialAnimation {
...
@@ -74,17 +74,20 @@ internal extension MaterialAnimation {
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransformMakeScale
(
0
,
0
))
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransformMakeScale
(
0
,
0
))
})
})
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
let
duration
:
CFTimeInterval
=
.
Center
==
pulseAnimation
?
0.16125
:
0.325
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
CenterWithBacking
,
.
Backing
,
.
AtPointWithBacking
:
case
.
CenterWithBacking
,
.
Backing
,
.
AtPointWithBacking
:
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
pulseOpacity
/
2
),
duration
:
0.325
),
forKey
:
nil
)
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
pulseOpacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtPointWithBacking
:
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtPointWithBacking
:
pLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
0.325
),
forKey
:
nil
)
pLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
0.325
,
completion
:
{
MaterialAnimation
.
delay
(
duration
,
completion
:
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
})
})
}
}
...
@@ -102,20 +105,23 @@ internal extension MaterialAnimation {
...
@@ -102,20 +105,23 @@ internal extension MaterialAnimation {
let
animated
:
Bool
?
=
bLayer
.
valueForKey
(
"animated"
)
as?
Bool
let
animated
:
Bool
?
=
bLayer
.
valueForKey
(
"animated"
)
as?
Bool
MaterialAnimation
.
delay
(
true
==
animated
?
0
:
0.15
)
{
MaterialAnimation
.
delay
(
true
==
animated
?
0
:
0.15
)
{
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
let
duration
:
CFTimeInterval
=
0.325
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
CenterWithBacking
,
.
Backing
,
.
AtPointWithBacking
:
case
.
CenterWithBacking
,
.
Backing
,
.
AtPointWithBacking
:
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtPointWithBacking
:
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtPointWithBacking
:
pLayer
.
addAnimation
(
MaterialAnimation
.
animationGroup
([
pLayer
.
addAnimation
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
scale
(
.
Center
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
scale
(
.
Center
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
))
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
))
],
duration
:
0.325
),
forKey
:
nil
)
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
0.325
)
{
MaterialAnimation
.
delay
(
duration
)
{
pLayer
.
removeFromSuperlayer
()
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
e1bece98
...
@@ -396,9 +396,9 @@ public class NavigationBar : UINavigationBar {
...
@@ -396,9 +396,9 @@ public class NavigationBar : UINavigationBar {
when subclassing.
when subclassing.
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
barStyle
=
.
Black
barStyle
=
.
Default
translucent
=
false
translucent
=
false
backButtonImage
=
nil
backButtonImage
=
UIImage
.
imageWithColor
(
MaterialColor
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
backgroundColor
=
MaterialColor
.
white
backgroundColor
=
MaterialColor
.
white
depth
=
.
Depth1
depth
=
.
Depth1
contentInsetPreset
=
.
Square1
contentInsetPreset
=
.
Square1
...
...
Sources/iOS/SideNavigationController.swift
View file @
e1bece98
...
@@ -175,6 +175,16 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
...
@@ -175,6 +175,16 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Sets the statusBar style.
/// Sets the statusBar style.
public
var
statusBarStyle
:
UIStatusBarStyle
=
.
Default
public
var
statusBarStyle
:
UIStatusBarStyle
=
.
Default
/// Sets the statusBar to hidden or not.
public
var
statusBarHidden
:
Bool
{
get
{
return
MaterialDevice
.
statusBarHidden
}
set
(
value
)
{
MaterialDevice
.
statusBarHidden
=
value
}
}
/**
/**
A SideNavigationControllerDelegate property used to bind
A SideNavigationControllerDelegate property used to bind
the delegation object.
the delegation object.
...
@@ -958,49 +968,29 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
...
@@ -958,49 +968,29 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
}
}
}
}
// /// Shows the statusBar.
// private func showStatusBar() {
// willHideStatusBar = false
// UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
// animations: { [weak self] in
// self?.setNeedsStatusBarAppearanceUpdate()
// MaterialDevice.statusBarHidden = false
// })
// delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false)
// }
//
// /// Hides the statusBar.
// private func hideStatusBar() {
// if enableHideStatusbar {
// willHideStatusBar = true
// UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
// animations: { [weak self] in
// self?.setNeedsStatusBarAppearanceUpdate()
// MaterialDevice.statusBarHidden = true
// })
// delegate?.sideNavigationStatusBarHiddenState?(self, hidden: true)
// }
// }
/// Shows the statusBar.
/// Shows the statusBar.
private
func
showStatusBar
()
{
private
func
showStatusBar
()
{
willHideStatusBar
=
false
if
statusBarHidden
{
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
willHideStatusBar
=
false
animations
:
{
[
weak
self
]
in
print
(
"show"
)
self
?
.
setNeedsStatusBarAppearanceUpdate
()
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
MaterialDevice
.
statusBarHidden
=
false
animations
:
{
[
weak
self
]
in
})
self
?
.
setNeedsStatusBarAppearanceUpdate
()
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
self
?
.
statusBarHidden
=
false
})
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
}
}
}
/// Hides the statusBar.
/// Hides the statusBar.
private
func
hideStatusBar
()
{
private
func
hideStatusBar
()
{
if
enableHideStatusbar
{
if
enableHideStatusbar
&&
!
statusBarHidden
{
willHideStatusBar
=
true
willHideStatusBar
=
true
print
(
"hide"
)
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
self
?
.
setNeedsStatusBarAppearanceUpdate
()
MaterialDevice
.
statusBarHidden
=
true
self
?
.
statusBarHidden
=
true
})
})
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
true
)
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
true
)
}
}
...
@@ -1075,7 +1065,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
...
@@ -1075,7 +1065,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Layout subviews.
/// Layout subviews.
private
func
layoutSubviews
()
{
private
func
layoutSubviews
()
{
toggleStatusBar
()
//
toggleStatusBar()
if
let
v
:
MaterialView
=
leftView
{
if
let
v
:
MaterialView
=
leftView
{
v
.
width
=
leftViewWidth
v
.
width
=
leftViewWidth
v
.
height
=
view
.
bounds
.
height
v
.
height
=
view
.
bounds
.
height
...
...
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