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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
36 deletions
+33
-36
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
+18
-28
No files found.
Examples/Programmatic/App/App/AppNavigationController.swift
View file @
e1bece98
...
...
@@ -44,6 +44,7 @@ class AppNavigationController: NavigationController {
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
statusBarView
?
.
hidden
=
MaterialDevice
.
statusBarHidden
print
(
MaterialDevice
.
statusBarHidden
)
}
/// Prepares the statusBarView
...
...
Sources/iOS/FabButton.swift
View file @
e1bece98
...
...
@@ -42,7 +42,7 @@ public class FabButton : MaterialButton {
super
.
prepareView
()
depth
=
.
Depth1
shape
=
.
Circle
pulseAnimation
=
.
Center
pulseAnimation
=
.
Center
WithBacking
pulseColor
=
MaterialColor
.
white
tintColor
=
MaterialColor
.
white
backgroundColor
=
MaterialColor
.
red
.
base
...
...
Sources/iOS/MaterialPulseAnimation.swift
View file @
e1bece98
...
...
@@ -74,17 +74,20 @@ internal extension MaterialAnimation {
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransformMakeScale
(
0
,
0
))
})
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
let
duration
:
CFTimeInterval
=
.
Center
==
pulseAnimation
?
0.16125
:
0.325
switch
pulseAnimation
{
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
}
switch
pulseAnimation
{
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
}
MaterialAnimation
.
delay
(
0.325
,
completion
:
{
MaterialAnimation
.
delay
(
duration
,
completion
:
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
})
}
...
...
@@ -102,20 +105,23 @@ internal extension MaterialAnimation {
let
animated
:
Bool
?
=
bLayer
.
valueForKey
(
"animated"
)
as?
Bool
MaterialAnimation
.
delay
(
true
==
animated
?
0
:
0.15
)
{
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
let
duration
:
CFTimeInterval
=
0.325
switch
pulseAnimation
{
case
.
CenterWithBacking
,
.
Backing
,
.
AtPointWithBacking
:
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
default
:
break
}
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtPointWithBacking
:
pLayer
.
addAnimation
(
MaterialAnimation
.
animationGroup
([
MaterialAnimation
.
scale
(
.
Center
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
))
],
duration
:
0.325
),
forKey
:
nil
)
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
}
MaterialAnimation
.
delay
(
0.325
)
{
MaterialAnimation
.
delay
(
duration
)
{
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
...
...
Sources/iOS/NavigationBar.swift
View file @
e1bece98
...
...
@@ -396,9 +396,9 @@ public class NavigationBar : UINavigationBar {
when subclassing.
*/
public
func
prepareView
()
{
barStyle
=
.
Black
barStyle
=
.
Default
translucent
=
false
backButtonImage
=
nil
backButtonImage
=
UIImage
.
imageWithColor
(
MaterialColor
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
backgroundColor
=
MaterialColor
.
white
depth
=
.
Depth1
contentInsetPreset
=
.
Square1
...
...
Sources/iOS/SideNavigationController.swift
View file @
e1bece98
...
...
@@ -175,6 +175,16 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Sets the statusBar style.
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
the delegation object.
...
...
@@ -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.
private
func
showStatusBar
()
{
if
statusBarHidden
{
willHideStatusBar
=
false
print
(
"show"
)
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
MaterialDevice
.
statusBarHidden
=
false
self
?
.
statusBarHidden
=
false
})
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
}
}
/// Hides the statusBar.
private
func
hideStatusBar
()
{
if
enableHideStatusbar
{
if
enableHideStatusbar
&&
!
statusBarHidden
{
willHideStatusBar
=
true
print
(
"hide"
)
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
MaterialDevice
.
statusBarHidden
=
true
self
?
.
statusBarHidden
=
true
})
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
true
)
}
...
...
@@ -1075,7 +1065,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Layout subviews.
private
func
layoutSubviews
()
{
toggleStatusBar
()
//
toggleStatusBar()
if
let
v
:
MaterialView
=
leftView
{
v
.
width
=
leftViewWidth
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