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
afb96ee8
Commit
afb96ee8
authored
Nov 06, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option for disabling snackbar layout edge inset calculation
parent
ad7a9aee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
Sources/iOS/SnackbarController.swift
+20
-10
No files found.
Sources/iOS/SnackbarController.swift
View file @
afb96ee8
...
@@ -110,6 +110,13 @@ open class SnackbarController: TransitionController {
...
@@ -110,6 +110,13 @@ open class SnackbarController: TransitionController {
layoutSubviews
()
layoutSubviews
()
}
}
}
}
/**
A boolean that controls if layoutEdgeInsets of snackbar is adjusted
automatically.
*/
@IBInspectable
open
var
automaticallyAdjustSnackbarLayoutEdgeInsets
=
true
/**
/**
Animates to a SnackbarStatus.
Animates to a SnackbarStatus.
...
@@ -179,17 +186,20 @@ open class SnackbarController: TransitionController {
...
@@ -179,17 +186,20 @@ open class SnackbarController: TransitionController {
snackbar
.
frame
.
origin
.
x
=
snackbarEdgeInsets
.
left
snackbar
.
frame
.
origin
.
x
=
snackbarEdgeInsets
.
left
snackbar
.
frame
.
size
.
width
=
view
.
bounds
.
width
-
snackbarEdgeInsets
.
left
-
snackbarEdgeInsets
.
right
snackbar
.
frame
.
size
.
width
=
view
.
bounds
.
width
-
snackbarEdgeInsets
.
left
-
snackbarEdgeInsets
.
right
snackbar
.
frame
.
size
.
height
=
snackbar
.
heightPreset
.
rawValue
snackbar
.
frame
.
size
.
height
=
snackbar
.
heightPreset
.
rawValue
snackbar
.
layoutEdgeInsets
=
.
zero
if
.
bottom
==
snackbarAlignment
{
snackbar
.
frame
.
size
.
height
+=
bottomLayoutGuide
.
length
snackbar
.
layoutEdgeInsets
.
bottom
+=
bottomLayoutGuide
.
length
}
else
{
snackbar
.
frame
.
size
.
height
+=
topLayoutGuide
.
length
snackbar
.
layoutEdgeInsets
.
top
+=
topLayoutGuide
.
length
}
rootViewController
.
view
.
frame
=
view
.
bounds
if
automaticallyAdjustSnackbarLayoutEdgeInsets
{
layoutSnackbar
(
status
:
snackbar
.
status
)
snackbar
.
layoutEdgeInsets
=
.
zero
if
.
bottom
==
snackbarAlignment
{
snackbar
.
frame
.
size
.
height
+=
bottomLayoutGuide
.
length
snackbar
.
layoutEdgeInsets
.
bottom
+=
bottomLayoutGuide
.
length
}
else
{
snackbar
.
frame
.
size
.
height
+=
topLayoutGuide
.
length
snackbar
.
layoutEdgeInsets
.
top
+=
topLayoutGuide
.
length
}
rootViewController
.
view
.
frame
=
view
.
bounds
layoutSnackbar
(
status
:
snackbar
.
status
)
}
}
}
open
override
func
prepare
()
{
open
override
func
prepare
()
{
...
...
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