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
62f29b52
Unverified
Commit
62f29b52
authored
Jan 03, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated FABMenuController handler for FABButton user interactions
parent
3724bbd3
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
83 additions
and
37 deletions
+83
-37
Sources/iOS/Capture/Capture.swift
+1
-1
Sources/iOS/Divider.swift
+1
-1
Sources/iOS/FABMenu.swift
+54
-10
Sources/iOS/FABMenuController.swift
+19
-17
Sources/iOS/Grid.swift
+1
-1
Sources/iOS/Layout.swift
+1
-1
Sources/iOS/NavigationItem.swift
+2
-2
Sources/iOS/PageTabBarController.swift
+1
-1
Sources/iOS/Switch.swift
+1
-1
Sources/iOS/TabBar.swift
+1
-1
Sources/iOS/Toolbar.swift
+1
-1
No files found.
Sources/iOS/Capture/Capture.swift
View file @
62f29b52
...
@@ -37,7 +37,7 @@ public enum CaptureMode: Int {
...
@@ -37,7 +37,7 @@ public enum CaptureMode: Int {
case
video
case
video
}
}
private
var
CaptureAdjustingExposureContext
:
UInt8
=
0
file
private
var
CaptureAdjustingExposureContext
:
UInt8
=
0
@objc(CapturePreset)
@objc(CapturePreset)
public
enum
CapturePreset
:
Int
{
public
enum
CapturePreset
:
Int
{
...
...
Sources/iOS/Divider.swift
View file @
62f29b52
...
@@ -135,7 +135,7 @@ public struct Divider {
...
@@ -135,7 +135,7 @@ public struct Divider {
}
}
/// A memory reference to the Divider instance.
/// A memory reference to the Divider instance.
private
var
DividerKey
:
UInt8
=
0
file
private
var
DividerKey
:
UInt8
=
0
extension
UIView
{
extension
UIView
{
/// TabBarItem reference.
/// TabBarItem reference.
...
...
Sources/iOS/FABMenu.swift
View file @
62f29b52
...
@@ -214,10 +214,13 @@ open class FABMenu: View {
...
@@ -214,10 +214,13 @@ open class FABMenu: View {
}
}
addSubview
(
v
)
addSubview
(
v
)
v
.
addTarget
(
self
,
action
:
#selector(
handle
ToggleMenu
(button:)
)
,
for
:
.
touchUpInside
)
v
.
addTarget
(
self
,
action
:
#selector(
handle
FABButton
(button:)
)
,
for
:
.
touchUpInside
)
}
}
}
}
/// An internal handler for the FABButton.
internal
var
handleFABButtonCallback
:
((
UIButton
)
->
Void
)?
/// Size of FABMenuItems.
/// Size of FABMenuItems.
open
var
fabMenuItemSize
:
CGSize
{
open
var
fabMenuItemSize
:
CGSize
{
get
{
get
{
...
@@ -314,16 +317,34 @@ extension FABMenu {
...
@@ -314,16 +317,34 @@ extension FABMenu {
- Parameter completion: A completion block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
*/
open
func
open
(
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
open
func
open
(
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
open
(
isTriggeredByUserInteraction
:
false
,
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
,
completion
:
completion
)
}
/**
Open the Menu component with animation options.
- Parameter isTriggeredByUserInteraction: A boolean indicating whether the
state was changed by a user interaction, true if yes, false otherwise.
- Parameter duration: The time for each view's animation.
- Parameter delay: A delay time for each view's animation.
- Parameter usingSpringWithDamping: A damping ratio for the animation.
- Parameter initialSpringVelocity: The initial velocity for the animation.
- Parameter options: Options to pass to the animation.
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
internal
func
open
(
isTriggeredByUserInteraction
:
Bool
,
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
if
isTriggeredByUserInteraction
{
delegate
?
.
fabMenuWillOpen
?(
fabMenu
:
self
)
delegate
?
.
fabMenuWillOpen
?(
fabMenu
:
self
)
}
spring
.
expand
(
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
)
{
[
weak
self
,
completion
=
completion
]
(
view
)
in
spring
.
expand
(
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
)
{
[
weak
self
,
isTriggeredByUserInteraction
=
isTriggeredByUserInteraction
,
completion
=
completion
]
(
view
)
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
(
view
as?
FABMenuItem
)?
.
showTitleLabel
()
(
view
as?
FABMenuItem
)?
.
showTitleLabel
()
if
view
==
s
.
fabMenuItems
.
last
{
if
isTriggeredByUserInteraction
&&
view
==
s
.
fabMenuItems
.
last
{
s
.
delegate
?
.
fabMenuDidOpen
?(
fabMenu
:
s
)
s
.
delegate
?
.
fabMenuDidOpen
?(
fabMenu
:
s
)
}
}
...
@@ -342,16 +363,34 @@ extension FABMenu {
...
@@ -342,16 +363,34 @@ extension FABMenu {
- Parameter completion: A completion block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
*/
open
func
close
(
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
open
func
close
(
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
close
(
isTriggeredByUserInteraction
:
false
,
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
,
completion
:
completion
)
}
/**
Close the Menu component with animation options.
- Parameter isTriggeredByUserInteraction: A boolean indicating whether the
state was changed by a user interaction, true if yes, false otherwise.
- Parameter duration: The time for each view's animation.
- Parameter delay: A delay time for each view's animation.
- Parameter usingSpringWithDamping: A damping ratio for the animation.
- Parameter initialSpringVelocity: The initial velocity for the animation.
- Parameter options: Options to pass to the animation.
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
internal
func
close
(
isTriggeredByUserInteraction
:
Bool
,
duration
:
TimeInterval
=
0.15
,
delay
:
TimeInterval
=
0
,
usingSpringWithDamping
:
CGFloat
=
0.5
,
initialSpringVelocity
:
CGFloat
=
0
,
options
:
UIViewAnimationOptions
=
[],
animations
:
((
UIView
)
->
Void
)?
=
nil
,
completion
:
((
UIView
)
->
Void
)?
=
nil
)
{
if
isTriggeredByUserInteraction
{
delegate
?
.
fabMenuWillClose
?(
fabMenu
:
self
)
delegate
?
.
fabMenuWillClose
?(
fabMenu
:
self
)
}
spring
.
contract
(
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
)
{
[
weak
self
,
completion
=
completion
]
(
view
)
in
spring
.
contract
(
duration
:
duration
,
delay
:
delay
,
usingSpringWithDamping
:
usingSpringWithDamping
,
initialSpringVelocity
:
initialSpringVelocity
,
options
:
options
,
animations
:
animations
)
{
[
weak
self
,
isTriggeredByUserInteraction
=
isTriggeredByUserInteraction
,
completion
=
completion
]
(
view
)
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
(
view
as?
FABMenuItem
)?
.
hideTitleLabel
()
(
view
as?
FABMenuItem
)?
.
hideTitleLabel
()
if
view
==
s
.
fabMenuItems
.
last
{
if
isTriggeredByUserInteraction
&&
view
==
s
.
fabMenuItems
.
last
{
s
.
delegate
?
.
fabMenuDidClose
?(
fabMenu
:
s
)
s
.
delegate
?
.
fabMenuDidClose
?(
fabMenu
:
s
)
}
}
...
@@ -382,9 +421,9 @@ extension FABMenu {
...
@@ -382,9 +421,9 @@ extension FABMenu {
delegate
?
.
fabMenu
?(
fabMenu
:
self
,
tappedAt
:
point
,
isOutside
:
true
)
delegate
?
.
fabMenu
?(
fabMenu
:
self
,
tappedAt
:
point
,
isOutside
:
true
)
close
()
close
(
isTriggeredByUserInteraction
:
true
)
return
s
elf
.
hitTest
(
point
,
with
:
event
)
return
s
uper
.
hitTest
(
point
,
with
:
event
)
}
}
}
}
...
@@ -394,12 +433,17 @@ extension FABMenu {
...
@@ -394,12 +433,17 @@ extension FABMenu {
- Parameter button: A UIButton.
- Parameter button: A UIButton.
*/
*/
@objc
@objc
fileprivate
func
handleToggleMenu
(
button
:
UIButton
)
{
fileprivate
func
handleFABButton
(
button
:
UIButton
)
{
guard
nil
==
handleFABButtonCallback
else
{
handleFABButtonCallback
?(
button
)
return
}
guard
isOpened
else
{
guard
isOpened
else
{
open
()
open
(
isTriggeredByUserInteraction
:
true
)
return
return
}
}
close
()
close
(
isTriggeredByUserInteraction
:
true
)
}
}
}
}
Sources/iOS/FABMenuController.swift
View file @
62f29b52
...
@@ -86,11 +86,14 @@ open class FABMenuController: RootController {
...
@@ -86,11 +86,14 @@ open class FABMenuController: RootController {
}
}
}
}
extension
FABMenuController
:
FABMenuDelegate
{}
extension
FABMenuController
{
extension
FABMenuController
{
/// Prepares the fabMenu.
/// Prepares the fabMenu.
fileprivate
func
prepareFABMenu
()
{
fileprivate
func
prepareFABMenu
()
{
fabMenu
.
delegate
=
self
fabMenu
.
delegate
=
self
fabMenu
.
zPosition
=
1000
fabMenu
.
zPosition
=
1000
fabMenu
.
handleFABButtonCallback
=
handleFABButton
view
.
addSubview
(
fabMenu
)
view
.
addSubview
(
fabMenu
)
}
}
}
}
...
@@ -174,33 +177,32 @@ extension FABMenuController {
...
@@ -174,33 +177,32 @@ extension FABMenuController {
}
}
}
}
extension
FABMenuController
:
FABMenuDelegate
{
extension
FABMenuController
{
/**
Handler to toggle the FABMenu opened or closed.
- Parameter button: A UIButton.
*/
@objc
@objc
open
func
fabMenuWillOpen
(
fabMenu
:
FABMenu
)
{
fileprivate
func
handleFABButton
(
button
:
UIButton
)
{
guard
fabMenu
.
isOpened
else
{
isUserInteractionEnabled
=
false
isUserInteractionEnabled
=
false
showFabMenuBacking
()
showFabMenuBacking
()
fabMenu
.
open
(
isTriggeredByUserInteraction
:
true
,
completion
:
handleCompletion
)
return
}
}
@objc
open
func
fabMenuDidOpen
(
fabMenu
:
FABMenu
)
{
isUserInteractionEnabled
=
true
}
@objc
open
func
fabMenuWillClose
(
fabMenu
:
FABMenu
)
{
isUserInteractionEnabled
=
false
isUserInteractionEnabled
=
false
hideFabMenuBacking
()
hideFabMenuBacking
()
fabMenu
.
close
(
isTriggeredByUserInteraction
:
true
,
completion
:
handleCompletion
)
}
}
@objc
/**
open
func
fabMenuDidClose
(
fabMenu
:
FABMenu
)
{
Completion handler for FABMenu open and close calls.
- Parameter view: A UIView.
*/
fileprivate
func
handleCompletion
(
view
:
UIView
)
{
if
view
==
fabMenu
.
fabMenuItems
.
last
{
isUserInteractionEnabled
=
true
isUserInteractionEnabled
=
true
}
}
@objc
open
func
fabMenu
(
fabMenu
:
FABMenu
,
tappedAt
point
:
CGPoint
,
isOutside
:
Bool
)
{
guard
isOutside
else
{
return
}
}
}
}
}
Sources/iOS/Grid.swift
View file @
62f29b52
...
@@ -266,7 +266,7 @@ public struct Grid {
...
@@ -266,7 +266,7 @@ public struct Grid {
}
}
/// A memory reference to the Grid instance for UIView extensions.
/// A memory reference to the Grid instance for UIView extensions.
private
var
GridKey
:
UInt8
=
0
file
private
var
GridKey
:
UInt8
=
0
/// Grid extension for UIView.
/// Grid extension for UIView.
extension
UIView
{
extension
UIView
{
...
...
Sources/iOS/Layout.swift
View file @
62f29b52
...
@@ -961,7 +961,7 @@ extension Layout {
...
@@ -961,7 +961,7 @@ extension Layout {
}
}
/// A memory reference to the LayoutKey instance for UIView extensions.
/// A memory reference to the LayoutKey instance for UIView extensions.
private
var
LayoutKey
:
UInt8
=
0
file
private
var
LayoutKey
:
UInt8
=
0
/// Layout extension for UIView.
/// Layout extension for UIView.
extension
UIView
{
extension
UIView
{
...
...
Sources/iOS/NavigationItem.swift
View file @
62f29b52
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
import
UIKit
import
UIKit
/// A memory reference to the NavigationItem instance.
/// A memory reference to the NavigationItem instance.
private
var
NavigationItemKey
:
UInt8
=
0
file
private
var
NavigationItemKey
:
UInt8
=
0
private
var
NavigationItemContext
:
UInt8
=
0
file
private
var
NavigationItemContext
:
UInt8
=
0
public
class
NavigationItem
:
NSObject
{
public
class
NavigationItem
:
NSObject
{
/// Should center the contentView.
/// Should center the contentView.
...
...
Sources/iOS/PageTabBarController.swift
View file @
62f29b52
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
import
UIKit
import
UIKit
/// A memory reference to the PageTabBarItem instance for UIViewController extensions.
/// A memory reference to the PageTabBarItem instance for UIViewController extensions.
private
var
PageTabBarItemKey
:
UInt8
=
0
file
private
var
PageTabBarItemKey
:
UInt8
=
0
open
class
PageTabBarItem
:
FlatButton
{
open
class
PageTabBarItem
:
FlatButton
{
open
override
func
prepare
()
{
open
override
func
prepare
()
{
...
...
Sources/iOS/Switch.swift
View file @
62f29b52
...
@@ -388,7 +388,7 @@ extension Switch {
...
@@ -388,7 +388,7 @@ extension Switch {
internalSwitchState
=
state
internalSwitchState
=
state
if
animated
{
if
animated
{
animateToState
(
state
:
state
)
{
[
weak
self
]
_
in
animateToState
(
state
:
state
)
{
[
weak
self
,
isTriggeredByUserInteraction
=
isTriggeredByUserInteraction
]
_
in
guard
isTriggeredByUserInteraction
else
{
guard
isTriggeredByUserInteraction
else
{
return
return
}
}
...
...
Sources/iOS/TabBar.swift
View file @
62f29b52
...
@@ -254,7 +254,7 @@ extension TabBar {
...
@@ -254,7 +254,7 @@ extension TabBar {
s
.
line
.
center
.
x
=
button
.
center
.
x
s
.
line
.
center
.
x
=
button
.
center
.
x
s
.
line
.
width
=
button
.
width
s
.
line
.
width
=
button
.
width
})
{
[
weak
self
,
button
=
button
,
completion
=
completion
]
_
in
})
{
[
weak
self
,
isTriggeredByUserInteraction
=
isTriggeredByUserInteraction
,
button
=
button
,
completion
=
completion
]
_
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
...
...
Sources/iOS/Toolbar.swift
View file @
62f29b52
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
import
UIKit
import
UIKit
private
var
ToolbarContext
:
UInt8
=
0
file
private
var
ToolbarContext
:
UInt8
=
0
open
class
Toolbar
:
Bar
{
open
class
Toolbar
:
Bar
{
/// A convenience property to set the titleLabel.text.
/// A convenience property to set the titleLabel.text.
...
...
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