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
4ee81dce
Unverified
Commit
4ee81dce
authored
Oct 22, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: progression commit on Cards
parent
7aee3d67
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
81 deletions
+31
-81
Sources/iOS/BasicAnimation.swift
+1
-1
Sources/iOS/Card.swift
+6
-7
Sources/iOS/CollectionViewLayout.swift
+1
-0
Sources/iOS/ImageCard.swift
+11
-62
Sources/iOS/Material+CALayer.swift
+4
-2
Sources/iOS/MenuController.swift
+1
-1
Sources/iOS/PresenterCard.swift
+7
-8
No files found.
Sources/iOS/BasicAnimation.swift
View file @
4ee81dce
...
@@ -292,7 +292,7 @@ extension Animation {
...
@@ -292,7 +292,7 @@ extension Animation {
animation
.
toValue
=
path
animation
.
toValue
=
path
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
forwards
)
animation
.
fillMode
=
AnimationFillModeToValue
(
mode
:
.
forwards
)
animation
.
isRemovedOnCompletion
=
false
animation
.
isRemovedOnCompletion
=
false
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunction
EaseInEaseOut
)
animation
.
timingFunction
=
CAMediaTimingFunction
(
name
:
kCAMediaTimingFunction
Linear
)
if
let
v
=
duration
{
if
let
v
=
duration
{
animation
.
duration
=
v
animation
.
duration
=
v
}
}
...
...
Sources/iOS/Card.swift
View file @
4ee81dce
...
@@ -195,9 +195,6 @@ open class Card: PulseView {
...
@@ -195,9 +195,6 @@ open class Card: PulseView {
open
func
reload
()
{
open
func
reload
()
{
// Clear constraints so new ones do not conflict.
// Clear constraints so new ones do not conflict.
container
.
removeConstraints
(
container
.
constraints
)
container
.
removeConstraints
(
container
.
constraints
)
for
v
in
container
.
subviews
{
v
.
removeFromSuperview
()
}
var
format
=
"V:|"
var
format
=
"V:|"
var
views
=
[
String
:
Any
]()
var
views
=
[
String
:
Any
]()
...
@@ -209,7 +206,7 @@ open class Card: PulseView {
...
@@ -209,7 +206,7 @@ open class Card: PulseView {
format
+=
"-(toolbarTop)-[toolbar]-(toolbarBottom)"
format
+=
"-(toolbarTop)-[toolbar]-(toolbarBottom)"
views
[
"toolbar"
]
=
v
views
[
"toolbar"
]
=
v
container
.
layout
(
v
)
.
horizontally
(
left
:
toolbarEdgeInsets
.
left
,
right
:
toolbarEdgeInsets
.
right
)
.
height
(
v
.
height
)
container
.
layout
(
v
)
.
horizontally
(
left
:
toolbarEdgeInsets
.
left
,
right
:
toolbarEdgeInsets
.
right
)
}
}
if
let
v
=
contentView
{
if
let
v
=
contentView
{
...
@@ -231,6 +228,8 @@ open class Card: PulseView {
...
@@ -231,6 +228,8 @@ open class Card: PulseView {
}
}
if
let
v
=
bottomBar
{
if
let
v
=
bottomBar
{
metrics
[
"bottomBarBottom"
]
=
bottomBarEdgeInsets
.
bottom
if
nil
!=
contentView
{
if
nil
!=
contentView
{
metrics
[
"contentViewBottom"
]
=
(
metrics
[
"contentViewBottom"
]
as!
CGFloat
)
+
bottomBarEdgeInsets
.
top
metrics
[
"contentViewBottom"
]
=
(
metrics
[
"contentViewBottom"
]
as!
CGFloat
)
+
bottomBarEdgeInsets
.
top
format
+=
"-[bottomBar]-(bottomBarBottom)"
format
+=
"-[bottomBar]-(bottomBarBottom)"
...
@@ -239,18 +238,18 @@ open class Card: PulseView {
...
@@ -239,18 +238,18 @@ open class Card: PulseView {
format
+=
"-[bottomBar]-(bottomBarBottom)"
format
+=
"-[bottomBar]-(bottomBarBottom)"
}
else
{
}
else
{
metrics
[
"bottomBarTop"
]
=
bottomBarEdgeInsets
.
top
metrics
[
"bottomBarTop"
]
=
bottomBarEdgeInsets
.
top
format
+=
"-(bottomBarTop)-[bottomBar]"
format
+=
"-(bottomBarTop)-[bottomBar]
-(bottomBarBottom)
"
}
}
views
[
"bottomBar"
]
=
v
views
[
"bottomBar"
]
=
v
container
.
layout
(
v
)
.
horizontally
(
left
:
bottomBarEdgeInsets
.
left
,
right
:
bottomBarEdgeInsets
.
right
)
.
height
(
v
.
height
)
.
bottom
(
bottomBarEdgeInsets
.
bottom
)
container
.
layout
(
v
)
.
horizontally
(
left
:
bottomBarEdgeInsets
.
left
,
right
:
bottomBarEdgeInsets
.
right
)
}
}
guard
0
<
views
.
count
else
{
guard
0
<
views
.
count
else
{
return
return
}
}
container
.
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
container
.
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
-
|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
}
}
/**
/**
...
...
Sources/iOS/CollectionViewLayout.swift
View file @
4ee81dce
...
@@ -121,6 +121,7 @@ open class CollectionViewLayout: UICollectionViewLayout {
...
@@ -121,6 +121,7 @@ open class CollectionViewLayout: UICollectionViewLayout {
guard
let
dataSource
=
collectionView
?
.
dataSource
as?
CollectionViewDataSource
else
{
guard
let
dataSource
=
collectionView
?
.
dataSource
as?
CollectionViewDataSource
else
{
return
return
}
}
prepareLayoutForItems
(
dataSourceItems
:
dataSource
.
dataSourceItems
)
prepareLayoutForItems
(
dataSourceItems
:
dataSource
.
dataSourceItems
)
}
}
...
...
Sources/iOS/ImageCard.swift
View file @
4ee81dce
...
@@ -56,6 +56,10 @@ open class ImageCard: Card {
...
@@ -56,6 +56,10 @@ open class ImageCard: Card {
@IBInspectable
@IBInspectable
open
var
imageView
:
UIImageView
?
{
open
var
imageView
:
UIImageView
?
{
didSet
{
didSet
{
oldValue
?
.
removeFromSuperview
()
if
let
v
=
imageView
{
container
.
addSubview
(
v
)
}
layoutSubviews
()
layoutSubviews
()
}
}
}
}
...
@@ -68,71 +72,16 @@ open class ImageCard: Card {
...
@@ -68,71 +72,16 @@ open class ImageCard: Card {
}
}
open
override
func
reload
()
{
open
override
func
reload
()
{
guard
let
iv
=
imageView
else
{
var
h
:
CGFloat
=
0
super
.
reload
()
return
}
// Clear constraints so new ones do not conflict.
container
.
removeConstraints
(
container
.
constraints
)
for
v
in
container
.
subviews
{
v
.
removeFromSuperview
()
}
var
format
=
"V:|"
var
views
=
[
String
:
Any
]()
var
metrics
=
[
String
:
Any
]()
metrics
[
"imageViewTop"
]
=
imageViewEdgeInsets
.
top
metrics
[
"imageViewBottom"
]
=
imageViewEdgeInsets
.
bottom
format
+=
"-(imageViewTop)-[imageView]-(imageViewBottom)"
views
[
"imageView"
]
=
iv
container
.
layout
(
iv
)
.
horizontally
(
left
:
imageViewEdgeInsets
.
left
,
right
:
imageViewEdgeInsets
.
right
)
iv
.
grid
.
reload
()
h
=
prepare
(
view
:
imageView
,
with
:
imageViewEdgeInsets
,
from
:
h
)
iv
.
divider
.
reload
()
if
let
v
=
toolbar
{
h
=
prepare
(
view
:
toolbar
,
with
:
toolbarEdgeInsets
,
from
:
h
)
iv
.
layoutIfNeeded
()
container
.
layout
(
v
)
.
horizontally
(
left
:
toolbarEdgeInsets
.
left
,
right
:
toolbarEdgeInsets
.
right
)
.
top
(
.
top
==
toolbarAlignment
?
toolbarEdgeInsets
.
top
:
iv
.
height
-
v
.
height
-
toolbarEdgeInsets
.
bottom
)
.
height
(
v
.
height
)
}
if
let
v
=
contentView
{
metrics
[
"imageViewBottom"
]
=
(
metrics
[
"imageViewBottom"
]
as!
CGFloat
)
+
contentViewEdgeInsets
.
top
metrics
[
"contentViewBottom"
]
=
contentViewEdgeInsets
.
bottom
format
+=
"-[contentView]-(contentViewBottom)"
views
[
"contentView"
]
=
v
container
.
layout
(
v
)
.
horizontally
(
left
:
contentViewEdgeInsets
.
left
,
right
:
contentViewEdgeInsets
.
right
)
v
.
grid
.
reload
()
v
.
divider
.
reload
()
}
if
let
v
=
bottomBar
{
h
=
prepare
(
view
:
contentView
,
with
:
contentViewEdgeInsets
,
from
:
h
)
metrics
[
"bottomBarBottom"
]
=
bottomBarEdgeInsets
.
bottom
h
=
prepare
(
view
:
bottomBar
,
with
:
bottomBarEdgeInsets
,
from
:
h
)
if
nil
!=
contentView
{
metrics
[
"contentViewBottom"
]
=
(
metrics
[
"contentViewBottom"
]
as!
CGFloat
)
+
bottomBarEdgeInsets
.
top
format
+=
"-[bottomBar]-(bottomBarBottom)"
}
else
{
metrics
[
"imageViewBottom"
]
=
(
metrics
[
"imageViewBottom"
]
as!
CGFloat
)
+
bottomBarEdgeInsets
.
top
format
+=
"-[bottomBar]-(bottomBarBottom)"
}
views
[
"bottomBar"
]
=
v
container
.
layout
(
v
)
.
horizontally
(
left
:
bottomBarEdgeInsets
.
left
,
right
:
bottomBarEdgeInsets
.
right
)
.
height
(
v
.
height
)
}
guard
0
<
views
.
count
else
{
return
}
container
.
addConstraints
(
Layout
.
constraint
(
format
:
"
\(
format
)
-|"
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
container
.
height
=
h
height
=
h
}
}
}
}
Sources/iOS/Material+CALayer.swift
View file @
4ee81dce
...
@@ -315,13 +315,15 @@ extension CALayer {
...
@@ -315,13 +315,15 @@ extension CALayer {
guard
isShadowPathAutoSizing
else
{
guard
isShadowPathAutoSizing
else
{
return
return
}
}
z
if
.
none
==
depthPreset
{
if
.
none
==
depthPreset
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
}
else
{
}
else
{
animate
(
animation
:
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
,
duration
:
0
))
let
a
=
Animation
.
shadowPath
(
path
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
)
a
.
fromValue
=
shadowPath
animate
(
animation
:
a
)
}
}
}
}
}
}
Sources/iOS/MenuController.swift
View file @
4ee81dce
...
@@ -64,7 +64,7 @@ open class MenuController: RootController {
...
@@ -64,7 +64,7 @@ open class MenuController: RootController {
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
s
.
rootViewController
.
view
.
alpha
=
0.
2
5
s
.
rootViewController
.
view
.
alpha
=
0.
1
5
})
})
menu
.
open
{
[
completion
=
completion
]
(
view
)
in
menu
.
open
{
[
completion
=
completion
]
(
view
)
in
completion
?(
view
)
completion
?(
view
)
...
...
Sources/iOS/PresenterCard.swift
View file @
4ee81dce
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
import
UIKit
import
UIKit
@available(iOS 9.0, *)
open
class
PresenterCard
:
Card
{
open
class
PresenterCard
:
Card
{
/// A preset wrapper around presenterViewEdgeInsets.
/// A preset wrapper around presenterViewEdgeInsets.
open
var
presenterViewEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
open
var
presenterViewEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
...
@@ -61,14 +60,14 @@ open class PresenterCard: Card {
...
@@ -61,14 +60,14 @@ open class PresenterCard: Card {
}
}
open
override
func
reload
()
{
open
override
func
reload
()
{
var
top
:
CGFloat
=
0
var
h
:
CGFloat
=
0
top
=
prepare
(
view
:
toolbar
,
with
:
toolbarEdgeInsets
,
from
:
top
)
h
=
prepare
(
view
:
toolbar
,
with
:
toolbarEdgeInsets
,
from
:
h
)
top
=
prepare
(
view
:
presenterView
,
with
:
presenterViewEdgeInsets
,
from
:
top
)
h
=
prepare
(
view
:
presenterView
,
with
:
presenterViewEdgeInsets
,
from
:
h
)
top
=
prepare
(
view
:
contentView
,
with
:
contentViewEdgeInsets
,
from
:
top
)
h
=
prepare
(
view
:
contentView
,
with
:
contentViewEdgeInsets
,
from
:
h
)
top
=
prepare
(
view
:
bottomBar
,
with
:
bottomBarEdgeInsets
,
from
:
top
)
h
=
prepare
(
view
:
bottomBar
,
with
:
bottomBarEdgeInsets
,
from
:
h
)
container
.
height
=
top
container
.
height
=
h
height
=
top
height
=
h
}
}
}
}
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