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
0ebe904f
Unverified
Commit
0ebe904f
authored
Jan 08, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: BottomSheet respects persistent sizing
parent
07222ba0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
14 deletions
+32
-14
Sources/iOS/BottomSheetController.swift
+18
-14
Sources/iOS/CollectionViewCard.swift
+3
-0
Sources/iOS/ImageCard.swift
+11
-0
No files found.
Sources/iOS/BottomSheetController.swift
View file @
0ebe904f
...
...
@@ -37,8 +37,8 @@ public enum BottomSheetFABButtonPosition: Int {
case
center
}
@objc(BottomSheet
Layout
Style)
public
enum
BottomSheet
Layout
Style
:
Int
{
@objc(BottomSheetStyle)
public
enum
BottomSheetStyle
:
Int
{
case
modal
case
persistent
}
...
...
@@ -51,6 +51,7 @@ open class BottomSheet: View {
open
var
fabButton
:
FABButton
?
{
didSet
{
fabButtonWasSet
?(
fabButton
)
fabButton
?
.
zPosition
=
6000
layoutSubviews
()
}
}
...
...
@@ -358,15 +359,17 @@ open class BottomSheetController: RootController {
open
fileprivate
(
set
)
var
bottomSheetHeight
:
CGFloat
=
0
/// Determines the layout style for the bottomSheet.
open
var
bottomSheetStyle
=
BottomSheet
Layout
Style
.
modal
{
open
var
bottomSheetStyle
=
BottomSheetStyle
.
modal
{
didSet
{
switch
bottomSheetStyle
{
case
.
modal
:
depthPreset
=
.
depth1
isBottomPanGestureEnabled
=
true
isBottomTapGestureEnabled
=
true
case
.
persistent
:
depthPreset
=
.
none
layoutSubviews
()
isBottom
Sheet
Enabled
=
false
isBottomPanGestureEnabled
=
false
isBottom
TapGesture
Enabled
=
false
}
}
}
...
...
@@ -406,6 +409,7 @@ open class BottomSheetController: RootController {
super
.
layoutSubviews
()
bottomSheet
.
width
=
view
.
bounds
.
width
bottomSheet
.
height
=
bottomSheetHeight
bottomSheetThreshold
=
view
.
bounds
.
height
-
bottomSheetHeight
/
2
if
.
persistent
==
bottomSheetStyle
{
...
...
@@ -459,8 +463,8 @@ open class BottomSheetController: RootController {
}
v
.
bounds
.
size
.
height
=
height
v
.
position
.
y
=
-
height
/
2
s
.
rootViewController
.
view
.
alpha
=
1
v
.
position
.
y
=
s
.
view
.
bounds
.
height
-
height
/
2
//
s.rootViewController.view.alpha = 1
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
guard
let
s
=
self
else
{
return
...
...
@@ -472,30 +476,30 @@ open class BottomSheetController: RootController {
}
}
else
{
UIView
.
animate
(
withDuration
:
duration
,
animations
:
{
[
weak
self
,
v
=
bottomSheet
]
in
animations
:
{
[
weak
self
,
v
=
bottomSheet
,
h
=
bottomSheetHeight
]
in
guard
let
s
=
self
else
{
return
}
v
.
bounds
.
size
.
height
=
h
eight
v
.
position
.
y
=
height
/
2
s
.
rootViewController
.
view
.
alpha
=
0.5
v
.
bounds
.
size
.
height
=
h
v
.
position
.
y
=
s
.
view
.
bounds
.
height
-
h
/
2
//
s.rootViewController.view.alpha = 0.5
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
guard
let
s
=
self
else
{
return
}
v
.
isShadowPathAutoSizing
=
true
s
.
layoutSubviews
()
//
s.layoutSubviews()
s
.
showView
(
container
:
v
)
}
}
}
else
{
bottomSheet
.
bounds
.
size
.
height
=
h
eight
bottomSheet
.
bounds
.
size
.
height
=
bottomSheetH
eight
if
isHidden
{
hideView
(
container
:
bottomSheet
)
bottomSheet
.
position
.
y
=
-
bottomSheet
.
bounds
.
h
eight
/
2
bottomSheet
.
position
.
y
=
view
.
bounds
.
height
-
bottomSheetH
eight
/
2
rootViewController
.
view
.
alpha
=
1
}
else
{
bottomSheet
.
isShadowPathAutoSizing
=
false
...
...
Sources/iOS/CollectionViewCard.swift
View file @
0ebe904f
...
...
@@ -60,6 +60,8 @@ open class CollectionViewCard: Card {
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
prepareCollectionView
()
prepareContentView
()
}
...
...
@@ -112,6 +114,7 @@ extension CollectionViewCard: CollectionViewDataSource {
@objc
open
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"CardCollectionViewCell"
,
for
:
indexPath
)
as!
CardCollectionViewCell
cell
.
pulseAnimation
=
.
none
guard
let
card
=
dataSourceItems
[
indexPath
.
item
]
.
data
as?
Card
else
{
return
cell
...
...
Sources/iOS/ImageCard.swift
View file @
0ebe904f
...
...
@@ -37,6 +37,17 @@ public enum ToolbarAlignment: Int {
}
open
class
ImageCard
:
Card
{
/**
A Display value to indicate whether or not to
display the imageView to the full view
bounds.
*/
open
var
imageViewDisplay
=
Display
.
partial
{
didSet
{
layoutSubviews
()
}
}
/// A preset wrapper around imageViewEdgeInsets.
open
var
imageViewEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
...
...
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