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 {
...
@@ -37,8 +37,8 @@ public enum BottomSheetFABButtonPosition: Int {
case
center
case
center
}
}
@objc(BottomSheet
Layout
Style)
@objc(BottomSheetStyle)
public
enum
BottomSheet
Layout
Style
:
Int
{
public
enum
BottomSheetStyle
:
Int
{
case
modal
case
modal
case
persistent
case
persistent
}
}
...
@@ -51,6 +51,7 @@ open class BottomSheet: View {
...
@@ -51,6 +51,7 @@ open class BottomSheet: View {
open
var
fabButton
:
FABButton
?
{
open
var
fabButton
:
FABButton
?
{
didSet
{
didSet
{
fabButtonWasSet
?(
fabButton
)
fabButtonWasSet
?(
fabButton
)
fabButton
?
.
zPosition
=
6000
layoutSubviews
()
layoutSubviews
()
}
}
}
}
...
@@ -358,15 +359,17 @@ open class BottomSheetController: RootController {
...
@@ -358,15 +359,17 @@ open class BottomSheetController: RootController {
open
fileprivate
(
set
)
var
bottomSheetHeight
:
CGFloat
=
0
open
fileprivate
(
set
)
var
bottomSheetHeight
:
CGFloat
=
0
/// Determines the layout style for the bottomSheet.
/// Determines the layout style for the bottomSheet.
open
var
bottomSheetStyle
=
BottomSheet
Layout
Style
.
modal
{
open
var
bottomSheetStyle
=
BottomSheetStyle
.
modal
{
didSet
{
didSet
{
switch
bottomSheetStyle
{
switch
bottomSheetStyle
{
case
.
modal
:
case
.
modal
:
depthPreset
=
.
depth1
depthPreset
=
.
depth1
isBottomPanGestureEnabled
=
true
isBottomTapGestureEnabled
=
true
case
.
persistent
:
case
.
persistent
:
depthPreset
=
.
none
depthPreset
=
.
none
layoutSubviews
()
isBottomPanGestureEnabled
=
false
isBottom
Sheet
Enabled
=
false
isBottom
TapGesture
Enabled
=
false
}
}
}
}
}
}
...
@@ -406,6 +409,7 @@ open class BottomSheetController: RootController {
...
@@ -406,6 +409,7 @@ open class BottomSheetController: RootController {
super
.
layoutSubviews
()
super
.
layoutSubviews
()
bottomSheet
.
width
=
view
.
bounds
.
width
bottomSheet
.
width
=
view
.
bounds
.
width
bottomSheet
.
height
=
bottomSheetHeight
bottomSheet
.
height
=
bottomSheetHeight
bottomSheetThreshold
=
view
.
bounds
.
height
-
bottomSheetHeight
/
2
bottomSheetThreshold
=
view
.
bounds
.
height
-
bottomSheetHeight
/
2
if
.
persistent
==
bottomSheetStyle
{
if
.
persistent
==
bottomSheetStyle
{
...
@@ -459,8 +463,8 @@ open class BottomSheetController: RootController {
...
@@ -459,8 +463,8 @@ open class BottomSheetController: RootController {
}
}
v
.
bounds
.
size
.
height
=
height
v
.
bounds
.
size
.
height
=
height
v
.
position
.
y
=
-
height
/
2
v
.
position
.
y
=
s
.
view
.
bounds
.
height
-
height
/
2
s
.
rootViewController
.
view
.
alpha
=
1
//
s.rootViewController.view.alpha = 1
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
...
@@ -472,30 +476,30 @@ open class BottomSheetController: RootController {
...
@@ -472,30 +476,30 @@ open class BottomSheetController: RootController {
}
}
}
else
{
}
else
{
UIView
.
animate
(
withDuration
:
duration
,
UIView
.
animate
(
withDuration
:
duration
,
animations
:
{
[
weak
self
,
v
=
bottomSheet
]
in
animations
:
{
[
weak
self
,
v
=
bottomSheet
,
h
=
bottomSheetHeight
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
v
.
bounds
.
size
.
height
=
h
eight
v
.
bounds
.
size
.
height
=
h
v
.
position
.
y
=
height
/
2
v
.
position
.
y
=
s
.
view
.
bounds
.
height
-
h
/
2
s
.
rootViewController
.
view
.
alpha
=
0.5
//
s.rootViewController.view.alpha = 0.5
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
})
{
[
weak
self
,
v
=
bottomSheet
]
_
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
v
.
isShadowPathAutoSizing
=
true
v
.
isShadowPathAutoSizing
=
true
s
.
layoutSubviews
()
//
s.layoutSubviews()
s
.
showView
(
container
:
v
)
s
.
showView
(
container
:
v
)
}
}
}
}
}
else
{
}
else
{
bottomSheet
.
bounds
.
size
.
height
=
h
eight
bottomSheet
.
bounds
.
size
.
height
=
bottomSheetH
eight
if
isHidden
{
if
isHidden
{
hideView
(
container
:
bottomSheet
)
hideView
(
container
:
bottomSheet
)
bottomSheet
.
position
.
y
=
-
bottomSheet
.
bounds
.
h
eight
/
2
bottomSheet
.
position
.
y
=
view
.
bounds
.
height
-
bottomSheetH
eight
/
2
rootViewController
.
view
.
alpha
=
1
rootViewController
.
view
.
alpha
=
1
}
else
{
}
else
{
bottomSheet
.
isShadowPathAutoSizing
=
false
bottomSheet
.
isShadowPathAutoSizing
=
false
...
...
Sources/iOS/CollectionViewCard.swift
View file @
0ebe904f
...
@@ -60,6 +60,8 @@ open class CollectionViewCard: Card {
...
@@ -60,6 +60,8 @@ open class CollectionViewCard: Card {
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
pulseAnimation
=
.
none
prepareCollectionView
()
prepareCollectionView
()
prepareContentView
()
prepareContentView
()
}
}
...
@@ -112,6 +114,7 @@ extension CollectionViewCard: CollectionViewDataSource {
...
@@ -112,6 +114,7 @@ extension CollectionViewCard: CollectionViewDataSource {
@objc
@objc
open
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
open
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"CardCollectionViewCell"
,
for
:
indexPath
)
as!
CardCollectionViewCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"CardCollectionViewCell"
,
for
:
indexPath
)
as!
CardCollectionViewCell
cell
.
pulseAnimation
=
.
none
guard
let
card
=
dataSourceItems
[
indexPath
.
item
]
.
data
as?
Card
else
{
guard
let
card
=
dataSourceItems
[
indexPath
.
item
]
.
data
as?
Card
else
{
return
cell
return
cell
...
...
Sources/iOS/ImageCard.swift
View file @
0ebe904f
...
@@ -37,6 +37,17 @@ public enum ToolbarAlignment: Int {
...
@@ -37,6 +37,17 @@ public enum ToolbarAlignment: Int {
}
}
open
class
ImageCard
:
Card
{
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.
/// A preset wrapper around imageViewEdgeInsets.
open
var
imageViewEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
open
var
imageViewEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
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