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
654641a9
Commit
654641a9
authored
Oct 18, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated internals to use less code for Card views
parent
471c38bd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
119 deletions
+94
-119
Source/BasicCardView.swift
+41
-54
Source/ImageCardView.swift
+52
-65
Source/SearchBarView.swift
+1
-0
No files found.
Source/BasicCardView.swift
View file @
654641a9
...
@@ -45,18 +45,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -45,18 +45,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: dividerInsets
:name: dividerInsets
*/
*/
public
var
dividerInsets
:
MaterialInsets
?
{
public
var
dividerInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsets
?
nil
:
MaterialInsetsToValue
(
dividerInsets
!
)
dividerInsetsRef
=
MaterialInsetsToValue
(
dividerInsets
)
}
}
}
}
/**
/**
:name: dividerInsetsRef
:name: dividerInsetsRef
*/
*/
public
var
dividerInsetsRef
:
MaterialInsetsType
!
{
public
var
dividerInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
dividerInsetsRef
{
didSet
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
dividerInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -64,18 +63,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -64,18 +63,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
contentInsets
:
MaterialInsets
?
{
public
var
contentInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
contentInsetsRef
=
nil
==
contentInsets
?
nil
:
MaterialInsetsToValue
(
contentInsets
!
)
contentInsetsRef
=
MaterialInsetsToValue
(
contentInsets
)
}
}
}
}
/**
/**
:name: contentInsetsRef
:name: contentInsetsRef
*/
*/
public
var
contentInsetsRef
:
MaterialInsetsType
!
{
public
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
contentInsetsRef
{
didSet
{
didSet
{
contentInsetsRef
=
nil
==
contentInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
contentInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -83,18 +81,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -83,18 +81,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabelInsets
:
MaterialInsets
?
{
public
var
titleLabelInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsets
?
nil
:
MaterialInsetsToValue
(
titleLabelInsets
!
)
titleLabelInsetsRef
=
MaterialInsetsToValue
(
titleLabelInsets
)
}
}
}
}
/**
/**
:name: titleLabelInsetsRef
:name: titleLabelInsetsRef
*/
*/
public
var
titleLabelInsetsRef
:
MaterialInsetsType
!
{
public
var
titleLabelInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
titleLabelInsetsRef
{
didSet
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
titleLabelInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -112,18 +109,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -112,18 +109,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: detailLabelInsets
:name: detailLabelInsets
*/
*/
public
var
detailLabelInsets
:
MaterialInsets
?
{
public
var
detailLabelInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsets
?
nil
:
MaterialInsetsToValue
(
detailLabelInsets
!
)
detailLabelInsetsRef
=
MaterialInsetsToValue
(
detailLabelInsets
)
}
}
}
}
/**
/**
:name: detailLabelInsetsRef
:name: detailLabelInsetsRef
*/
*/
public
var
detailLabelInsetsRef
:
MaterialInsetsType
!
{
public
var
detailLabelInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
detailLabelInsetsRef
{
didSet
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
detailLabelInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -141,18 +137,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -141,18 +137,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: leftButtonsInsets
:name: leftButtonsInsets
*/
*/
public
var
leftButtonsInsets
:
MaterialInsets
?
{
public
var
leftButtonsInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsets
?
nil
:
MaterialInsetsToValue
(
leftButtonsInsets
!
)
leftButtonsInsetsRef
=
MaterialInsetsToValue
(
leftButtonsInsets
)
}
}
}
}
/**
/**
:name: leftButtonsInsetsRef
:name: leftButtonsInsetsRef
*/
*/
public
var
leftButtonsInsetsRef
:
MaterialInsetsType
!
{
public
var
leftButtonsInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
leftButtonsInsetsRef
{
didSet
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
leftButtonsInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -174,18 +169,17 @@ public class BasicCardView : MaterialPulseView {
...
@@ -174,18 +169,17 @@ public class BasicCardView : MaterialPulseView {
/**
/**
:name: rightButtonsInsets
:name: rightButtonsInsets
*/
*/
public
var
rightButtonsInsets
:
MaterialInsets
?
{
public
var
rightButtonsInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsets
?
nil
:
MaterialInsetsToValue
(
rightButtonsInsets
!
)
rightButtonsInsetsRef
=
MaterialInsetsToValue
(
rightButtonsInsets
)
}
}
}
}
/**
/**
:name: rightButtonsInsetsRef
:name: rightButtonsInsetsRef
*/
*/
public
var
rightButtonsInsetsRef
:
MaterialInsetsType
!
{
public
var
rightButtonsInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
basicCardView
.
rightButtonsInsetsRef
{
didSet
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
rightButtonsInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -240,11 +234,11 @@ public class BasicCardView : MaterialPulseView {
...
@@ -240,11 +234,11 @@ public class BasicCardView : MaterialPulseView {
super
.
layoutSublayersOfLayer
(
layer
)
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
if
self
.
layer
==
layer
{
if
divider
{
if
divider
{
var
y
:
CGFloat
=
contentInsetsRef
!.
bottom
+
dividerInsetsRef
!
.
bottom
var
y
:
CGFloat
=
contentInsetsRef
.
bottom
+
dividerInsetsRef
.
bottom
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
y
+=
leftButtonsInsetsRef
!.
top
+
leftButtonsInsetsRef
!
.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
leftButtonsInsetsRef
.
top
+
leftButtonsInsetsRef
.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
y
+=
rightButtonsInsetsRef
!.
top
+
rightButtonsInsetsRef
!
.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
rightButtonsInsetsRef
.
top
+
rightButtonsInsetsRef
.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
}
}
if
0
<
y
{
if
0
<
y
{
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
...
@@ -265,13 +259,6 @@ public class BasicCardView : MaterialPulseView {
...
@@ -265,13 +259,6 @@ public class BasicCardView : MaterialPulseView {
backgroundColor
=
MaterialTheme
.
basicCardView
.
backgroundColor
backgroundColor
=
MaterialTheme
.
basicCardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
basicCardView
.
pulseColor
pulseColor
=
MaterialTheme
.
basicCardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
basicCardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
basicCardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
basicCardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
basicCardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
basicCardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
basicCardView
.
dividerInsetsRef
contentsRect
=
MaterialTheme
.
basicCardView
.
contentsRect
contentsRect
=
MaterialTheme
.
basicCardView
.
contentsRect
contentsCenter
=
MaterialTheme
.
basicCardView
.
contentsCenter
contentsCenter
=
MaterialTheme
.
basicCardView
.
contentsCenter
contentsScale
=
MaterialTheme
.
basicCardView
.
contentsScale
contentsScale
=
MaterialTheme
.
basicCardView
.
contentsScale
...
@@ -300,10 +287,10 @@ public class BasicCardView : MaterialPulseView {
...
@@ -300,10 +287,10 @@ public class BasicCardView : MaterialPulseView {
if
nil
!=
titleLabel
{
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetTop)"
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
titleLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
contentInsetsRef
.
top
+
titleLabelInsetsRef
.
top
}
else
if
nil
!=
detailLabel
{
}
else
if
nil
!=
detailLabel
{
verticalFormat
+=
"-(insetTop)"
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
contentInsetsRef
.
top
+
detailLabelInsetsRef
.
top
}
}
// title
// title
...
@@ -313,7 +300,7 @@ public class BasicCardView : MaterialPulseView {
...
@@ -313,7 +300,7 @@ public class BasicCardView : MaterialPulseView {
verticalFormat
+=
"-[titleLabel]"
verticalFormat
+=
"-[titleLabel]"
views
[
"titleLabel"
]
=
v
views
[
"titleLabel"
]
=
v
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
titleLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
titleLabelInsetsRef
!
.
right
)
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
.
left
+
titleLabelInsetsRef
.
left
,
right
:
contentInsetsRef
.
right
+
titleLabelInsetsRef
.
right
)
}
}
// detail
// detail
...
@@ -321,16 +308,16 @@ public class BasicCardView : MaterialPulseView {
...
@@ -321,16 +308,16 @@ public class BasicCardView : MaterialPulseView {
addSubview
(
v
)
addSubview
(
v
)
if
nil
==
titleLabel
{
if
nil
==
titleLabel
{
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detailLabelInsetsRef
.
top
}
else
{
}
else
{
verticalFormat
+=
"-(insetB)"
verticalFormat
+=
"-(insetB)"
metrics
[
"insetB"
]
=
titleLabelInsetsRef
!.
bottom
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetB"
]
=
titleLabelInsetsRef
.
bottom
+
detailLabelInsetsRef
.
top
}
}
verticalFormat
+=
"-[detailLabel]"
verticalFormat
+=
"-[detailLabel]"
views
[
"detailLabel"
]
=
v
views
[
"detailLabel"
]
=
v
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
detailLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
detailLabelInsetsRef
!
.
right
)
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
.
left
+
detailLabelInsetsRef
.
left
,
right
:
contentInsetsRef
.
right
+
detailLabelInsetsRef
.
right
)
}
}
// leftButtons
// leftButtons
...
@@ -353,10 +340,10 @@ public class BasicCardView : MaterialPulseView {
...
@@ -353,10 +340,10 @@ public class BasicCardView : MaterialPulseView {
h
+=
"[
\(
k
)
]"
h
+=
"[
\(
k
)
]"
addSubview
(
b
)
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
contentInsetsRef
!.
left
+
leftButtonsInsetsRef
!.
left
,
"left_right"
:
leftButtonsInsetsRef
!.
left
+
leftButtonsInsetsRef
!
.
right
],
views
:
d
))
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
contentInsetsRef
.
left
+
leftButtonsInsetsRef
.
left
,
"left_right"
:
leftButtonsInsetsRef
.
left
+
leftButtonsInsetsRef
.
right
],
views
:
d
))
}
}
}
}
...
@@ -381,39 +368,39 @@ public class BasicCardView : MaterialPulseView {
...
@@ -381,39 +368,39 @@ public class BasicCardView : MaterialPulseView {
}
}
addSubview
(
b
)
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
contentInsetsRef
!.
right
+
rightButtonsInsetsRef
!.
right
,
"right_left"
:
rightButtonsInsetsRef
!.
right
+
rightButtonsInsetsRef
!
.
left
],
views
:
d
))
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
contentInsetsRef
.
right
+
rightButtonsInsetsRef
.
right
,
"right_left"
:
rightButtonsInsetsRef
.
right
+
rightButtonsInsetsRef
.
left
],
views
:
d
))
}
}
}
}
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
views
[
"button"
]
=
leftButtons
!
[
0
]
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
rightButtons
!
[
0
]
views
[
"button"
]
=
rightButtons
!
[
0
]
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
}
}
if
nil
!=
detailLabel
{
if
nil
!=
detailLabel
{
if
nil
==
metrics
[
"insetC"
]
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
else
{
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
!=
titleLabel
{
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
titleLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
else
{
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
titleLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
!=
metrics
[
"insetC"
]
{
}
else
if
nil
!=
metrics
[
"insetC"
]
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
!.
top
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
.
top
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
...
@@ -433,7 +420,7 @@ public class BasicCardView : MaterialPulseView {
...
@@ -433,7 +420,7 @@ public class BasicCardView : MaterialPulseView {
layer
.
addSublayer
(
dividerLayer
!
)
layer
.
addSublayer
(
dividerLayer
!
)
}
}
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
?
.
frame
=
CGRectMake
(
dividerInsetsRef
!.
left
,
y
,
width
-
dividerInsetsRef
!.
left
-
dividerInsetsRef
!
.
right
,
1
)
dividerLayer
?
.
frame
=
CGRectMake
(
dividerInsetsRef
.
left
,
y
,
width
-
dividerInsetsRef
.
left
-
dividerInsetsRef
.
right
,
1
)
}
}
//
//
...
...
Source/ImageCardView.swift
View file @
654641a9
...
@@ -45,18 +45,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -45,18 +45,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: dividerInsets
:name: dividerInsets
*/
*/
public
var
dividerInsets
:
MaterialInsets
?
{
public
var
dividerInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsets
?
nil
:
MaterialInsetsToValue
(
dividerInsets
!
)
dividerInsetsRef
=
MaterialInsetsToValue
(
dividerInsets
)
}
}
}
}
/**
/**
:name: dividerInsetsRef
:name: dividerInsetsRef
*/
*/
public
var
dividerInsetsRef
:
MaterialInsetsType
!
{
public
var
dividerInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
dividerInsetsRef
{
didSet
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
dividerInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -154,18 +153,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -154,18 +153,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
contentInsets
:
MaterialInsets
?
{
public
var
contentInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
contentInsetsRef
=
nil
==
contentInsets
?
nil
:
MaterialInsetsToValue
(
contentInsets
!
)
contentInsetsRef
=
MaterialInsetsToValue
(
contentInsets
)
}
}
}
}
/**
/**
:name: contentInsetsRef
:name: contentInsetsRef
*/
*/
public
var
contentInsetsRef
:
MaterialInsetsType
!
{
public
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
contentInsetsRef
{
didSet
{
didSet
{
contentInsetsRef
=
nil
==
contentInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
contentInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -173,18 +171,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -173,18 +171,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabelInsets
:
MaterialInsets
?
{
public
var
titleLabelInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsets
?
nil
:
MaterialInsetsToValue
(
titleLabelInsets
!
)
titleLabelInsetsRef
=
MaterialInsetsToValue
(
titleLabelInsets
)
}
}
}
}
/**
/**
:name: titleLabelInsetsRef
:name: titleLabelInsetsRef
*/
*/
public
var
titleLabelInsetsRef
:
MaterialInsetsType
!
{
public
var
titleLabelInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
titleLabelInsetsRef
{
didSet
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
titleLabelInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -202,18 +199,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -202,18 +199,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: detailLabelInsets
:name: detailLabelInsets
*/
*/
public
var
detailLabelInsets
:
MaterialInsets
?
{
public
var
detailLabelInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsets
?
nil
:
MaterialInsetsToValue
(
detailLabelInsets
!
)
detailLabelInsetsRef
=
MaterialInsetsToValue
(
detailLabelInsets
)
}
}
}
}
/**
/**
:name: detailLabelInsetsRef
:name: detailLabelInsetsRef
*/
*/
public
var
detailLabelInsetsRef
:
MaterialInsetsType
!
{
public
var
detailLabelInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
detailLabelInsetsRef
{
didSet
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
detailLabelInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -231,18 +227,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -231,18 +227,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: leftButtonsInsets
:name: leftButtonsInsets
*/
*/
public
var
leftButtonsInsets
:
MaterialInsets
?
{
public
var
leftButtonsInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsets
?
nil
:
MaterialInsetsToValue
(
leftButtonsInsets
!
)
leftButtonsInsetsRef
=
MaterialInsetsToValue
(
leftButtonsInsets
)
}
}
}
}
/**
/**
:name: leftButtonsInsetsRef
:name: leftButtonsInsetsRef
*/
*/
public
var
leftButtonsInsetsRef
:
MaterialInsetsType
!
{
public
var
leftButtonsInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
leftButtonsInsetsRef
{
didSet
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
leftButtonsInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -264,18 +259,17 @@ public class ImageCardView : MaterialPulseView {
...
@@ -264,18 +259,17 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: rightButtonsInsets
:name: rightButtonsInsets
*/
*/
public
var
rightButtonsInsets
:
MaterialInsets
?
{
public
var
rightButtonsInsets
:
MaterialInsets
=
.
None
{
didSet
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsets
?
nil
:
MaterialInsetsToValue
(
rightButtonsInsets
!
)
rightButtonsInsetsRef
=
MaterialInsetsToValue
(
rightButtonsInsets
)
}
}
}
}
/**
/**
:name: rightButtonsInsetsRef
:name: rightButtonsInsetsRef
*/
*/
public
var
rightButtonsInsetsRef
:
MaterialInsetsType
!
{
public
var
rightButtonsInsetsRef
:
MaterialInsetsType
=
MaterialTheme
.
imageCardView
.
rightButtonsInsetsRef
{
didSet
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
rightButtonsInsetsRef
!
reloadView
()
reloadView
()
}
}
}
}
...
@@ -334,11 +328,11 @@ public class ImageCardView : MaterialPulseView {
...
@@ -334,11 +328,11 @@ public class ImageCardView : MaterialPulseView {
// divider
// divider
if
divider
{
if
divider
{
var
y
:
CGFloat
=
contentInsetsRef
!.
bottom
+
dividerInsetsRef
!
.
bottom
var
y
:
CGFloat
=
contentInsetsRef
.
bottom
+
dividerInsetsRef
.
bottom
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
y
+=
leftButtonsInsetsRef
!.
top
+
leftButtonsInsetsRef
!
.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
leftButtonsInsetsRef
.
top
+
leftButtonsInsetsRef
.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
y
+=
rightButtonsInsetsRef
!.
top
+
rightButtonsInsetsRef
!
.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
rightButtonsInsetsRef
.
top
+
rightButtonsInsetsRef
.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
}
}
if
0
<
y
{
if
0
<
y
{
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
...
@@ -359,13 +353,6 @@ public class ImageCardView : MaterialPulseView {
...
@@ -359,13 +353,6 @@ public class ImageCardView : MaterialPulseView {
backgroundColor
=
MaterialTheme
.
imageCardView
.
backgroundColor
backgroundColor
=
MaterialTheme
.
imageCardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
imageCardView
.
pulseColor
pulseColor
=
MaterialTheme
.
imageCardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
imageCardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
imageCardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
imageCardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
imageCardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
imageCardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
imageCardView
.
dividerInsetsRef
contentsRect
=
MaterialTheme
.
imageCardView
.
contentsRect
contentsRect
=
MaterialTheme
.
imageCardView
.
contentsRect
contentsCenter
=
MaterialTheme
.
imageCardView
.
contentsCenter
contentsCenter
=
MaterialTheme
.
imageCardView
.
contentsCenter
contentsScale
=
MaterialTheme
.
imageCardView
.
contentsScale
contentsScale
=
MaterialTheme
.
imageCardView
.
contentsScale
...
@@ -397,10 +384,10 @@ public class ImageCardView : MaterialPulseView {
...
@@ -397,10 +384,10 @@ public class ImageCardView : MaterialPulseView {
metrics
[
"insetTop"
]
=
imageLayer
?
.
frame
.
size
.
height
metrics
[
"insetTop"
]
=
imageLayer
?
.
frame
.
size
.
height
}
else
if
nil
!=
titleLabel
{
}
else
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetTop)"
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
titleLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
contentInsetsRef
.
top
+
titleLabelInsetsRef
.
top
}
else
if
nil
!=
detailLabel
{
}
else
if
nil
!=
detailLabel
{
verticalFormat
+=
"-(insetTop)"
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
contentInsetsRef
.
top
+
detailLabelInsetsRef
.
top
}
}
// title
// title
...
@@ -411,9 +398,9 @@ public class ImageCardView : MaterialPulseView {
...
@@ -411,9 +398,9 @@ public class ImageCardView : MaterialPulseView {
verticalFormat
+=
"-[titleLabel]"
verticalFormat
+=
"-[titleLabel]"
views
[
"titleLabel"
]
=
v
views
[
"titleLabel"
]
=
v
}
else
{
}
else
{
MaterialLayout
.
alignFromTop
(
self
,
child
:
v
,
top
:
contentInsetsRef
!.
top
+
titleLabelInsetsRef
!
.
top
)
MaterialLayout
.
alignFromTop
(
self
,
child
:
v
,
top
:
contentInsetsRef
.
top
+
titleLabelInsetsRef
.
top
)
}
}
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
titleLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
titleLabelInsetsRef
!
.
right
)
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
.
left
+
titleLabelInsetsRef
.
left
,
right
:
contentInsetsRef
.
right
+
titleLabelInsetsRef
.
right
)
}
}
// detail
// detail
...
@@ -422,15 +409,15 @@ public class ImageCardView : MaterialPulseView {
...
@@ -422,15 +409,15 @@ public class ImageCardView : MaterialPulseView {
if
nil
==
imageLayer
?
.
contents
&&
nil
!=
titleLabel
{
if
nil
==
imageLayer
?
.
contents
&&
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetB)"
verticalFormat
+=
"-(insetB)"
metrics
[
"insetB"
]
=
titleLabelInsetsRef
!.
bottom
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetB"
]
=
titleLabelInsetsRef
.
bottom
+
detailLabelInsetsRef
.
top
}
else
{
}
else
{
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!
.
top
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
detailLabelInsetsRef
.
top
}
}
verticalFormat
+=
"-[detailLabel]"
verticalFormat
+=
"-[detailLabel]"
views
[
"detailLabel"
]
=
v
views
[
"detailLabel"
]
=
v
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
detailLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
detailLabelInsetsRef
!
.
right
)
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
.
left
+
detailLabelInsetsRef
.
left
,
right
:
contentInsetsRef
.
right
+
detailLabelInsetsRef
.
right
)
}
}
// leftButtons
// leftButtons
...
@@ -453,10 +440,10 @@ public class ImageCardView : MaterialPulseView {
...
@@ -453,10 +440,10 @@ public class ImageCardView : MaterialPulseView {
h
+=
"[
\(
k
)
]"
h
+=
"[
\(
k
)
]"
addSubview
(
b
)
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
contentInsetsRef
!.
left
+
leftButtonsInsetsRef
!.
left
,
"left_right"
:
leftButtonsInsetsRef
!.
left
+
leftButtonsInsetsRef
!
.
right
],
views
:
d
))
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
contentInsetsRef
.
left
+
leftButtonsInsetsRef
.
left
,
"left_right"
:
leftButtonsInsetsRef
.
left
+
leftButtonsInsetsRef
.
right
],
views
:
d
))
}
}
}
}
...
@@ -481,10 +468,10 @@ public class ImageCardView : MaterialPulseView {
...
@@ -481,10 +468,10 @@ public class ImageCardView : MaterialPulseView {
}
}
addSubview
(
b
)
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
contentInsetsRef
!.
right
+
rightButtonsInsetsRef
!.
right
,
"right_left"
:
rightButtonsInsetsRef
!.
right
+
rightButtonsInsetsRef
!
.
left
],
views
:
d
))
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
contentInsetsRef
.
right
+
rightButtonsInsetsRef
.
right
,
"right_left"
:
rightButtonsInsetsRef
.
right
+
rightButtonsInsetsRef
.
left
],
views
:
d
))
}
}
}
}
...
@@ -492,59 +479,59 @@ public class ImageCardView : MaterialPulseView {
...
@@ -492,59 +479,59 @@ public class ImageCardView : MaterialPulseView {
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
views
[
"button"
]
=
leftButtons
!
[
0
]
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
rightButtons
!
[
0
]
views
[
"button"
]
=
rightButtons
!
[
0
]
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
}
}
if
nil
!=
detailLabel
{
if
nil
!=
detailLabel
{
if
nil
==
metrics
[
"insetC"
]
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
else
{
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
!=
titleLabel
{
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
titleLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
else
{
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
titleLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
!=
metrics
[
"insetC"
]
{
}
else
if
nil
!=
metrics
[
"insetC"
]
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
!.
top
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
.
top
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
!=
detailLabel
{
}
else
if
nil
!=
detailLabel
{
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
views
[
"button"
]
=
leftButtons
!
[
0
]
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
rightButtons
!
[
0
]
views
[
"button"
]
=
rightButtons
!
[
0
]
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
!
.
top
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
}
}
if
nil
==
metrics
[
"insetC"
]
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
else
{
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
.
bottom
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
}
}
}
else
if
nil
==
detailLabel
{
}
else
if
nil
==
detailLabel
{
if
0
<
leftButtons
?
.
count
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-[button]"
verticalFormat
+=
"-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
views
[
"button"
]
=
leftButtons
!
[
0
]
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
leftButtonsInsetsRef
!.
top
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
leftButtonsInsetsRef
.
top
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
leftButtonsInsetsRef
.
bottom
}
else
if
0
<
rightButtons
?
.
count
{
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-[button]"
verticalFormat
+=
"-[button]"
views
[
"button"
]
=
rightButtons
!
[
0
]
views
[
"button"
]
=
rightButtons
!
[
0
]
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
rightButtonsInsetsRef
!.
top
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!
.
bottom
:
0
)
metrics
[
"insetTop"
]
=
(
metrics
[
"insetTop"
]
as!
CGFloat
)
+
rightButtonsInsetsRef
.
top
+
(
divider
?
dividerInsetsRef
.
top
+
dividerInsetsRef
.
bottom
:
0
)
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!
.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
.
bottom
+
rightButtonsInsetsRef
.
bottom
}
}
}
}
...
@@ -576,7 +563,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -576,7 +563,7 @@ public class ImageCardView : MaterialPulseView {
layer
.
addSublayer
(
dividerLayer
!
)
layer
.
addSublayer
(
dividerLayer
!
)
}
}
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
?
.
frame
=
CGRectMake
(
dividerInsetsRef
!.
left
,
y
,
width
-
dividerInsetsRef
!.
left
-
dividerInsetsRef
!
.
right
,
1
)
dividerLayer
?
.
frame
=
CGRectMake
(
dividerInsetsRef
.
left
,
y
,
width
-
dividerInsetsRef
.
left
-
dividerInsetsRef
.
right
,
1
)
}
}
//
//
...
...
Source/SearchBarView.swift
View file @
654641a9
...
@@ -313,6 +313,7 @@ public class SearchBarView : MaterialView, UITextFieldDelegate {
...
@@ -313,6 +313,7 @@ public class SearchBarView : MaterialView, UITextFieldDelegate {
public
func
textFieldShouldEndEditing
(
textField
:
UITextField
)
->
Bool
{
public
func
textFieldShouldEndEditing
(
textField
:
UITextField
)
->
Bool
{
backgroundColor
=
internalBackgroundColor
backgroundColor
=
internalBackgroundColor
internalBackgroundColor
=
nil
return
true
return
true
}
}
}
}
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