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
a5a35b4c
Commit
a5a35b4c
authored
Sep 03, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue-27: updated default colors
parent
e991d1ff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
18 deletions
+23
-18
Source/FlatButton.swift
+1
-1
Source/MaterialButton.swift
+1
-1
Source/MaterialCardView.swift
+1
-1
Source/RaisedButton.swift
+1
-1
Source/TextView.swift
+19
-14
No files found.
Source/FlatButton.swift
View file @
a5a35b4c
...
...
@@ -24,7 +24,7 @@ public class FlatButton : MaterialButton {
//
internal
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
blue
.
darken1
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
blue
Grey
.
darken1
,
forState
:
.
Normal
)
backgroundColor
=
MaterialTheme
.
clear
.
color
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
}
...
...
Source/MaterialButton.swift
View file @
a5a35b4c
...
...
@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
/**
:name: pulseColor
*/
public
var
pulseColor
:
UIColor
?
=
MaterialTheme
.
blue
.
lighten3
public
var
pulseColor
:
UIColor
?
=
MaterialTheme
.
blue
Grey
.
lighten3
/**
:name: init
...
...
Source/MaterialCardView.swift
View file @
a5a35b4c
...
...
@@ -49,7 +49,7 @@ public class MaterialCardView : UIView {
/**
:name: pulseColor
*/
public
var
pulseColor
:
UIColor
=
MaterialTheme
.
blue
.
lighten3
public
var
pulseColor
:
UIColor
=
MaterialTheme
.
blue
Grey
.
lighten3
/**
:name: init
...
...
Source/RaisedButton.swift
View file @
a5a35b4c
...
...
@@ -25,7 +25,7 @@ public class RaisedButton : MaterialButton {
internal
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
white
.
color
,
forState
:
.
Normal
)
backgroundColor
=
MaterialTheme
.
blue
.
darken1
backgroundColor
=
MaterialTheme
.
blue
Grey
.
darken1
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
}
...
...
Source/TextView.swift
View file @
a5a35b4c
...
...
@@ -57,12 +57,16 @@ public class TextView: UITextView {
*/
public
var
placeholderLabel
:
UILabel
?
{
didSet
{
placeholderLabel
!.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
placeholderLabel
!.
font
=
font
placeholderLabel
!.
textAlignment
=
textAlignment
placeholderLabel
!.
numberOfLines
=
0
placeholderLabel
!.
backgroundColor
=
MaterialTheme
.
clear
.
color
addSubview
(
placeholderLabel
!
)
if
let
p
=
placeholderLabel
{
p
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
p
.
font
=
font
p
.
textAlignment
=
textAlignment
p
.
numberOfLines
=
0
p
.
backgroundColor
=
MaterialTheme
.
clear
.
color
addSubview
(
p
)
updateLabelConstraints
()
textViewTextDidChange
()
}
}
}
...
...
@@ -107,7 +111,9 @@ public class TextView: UITextView {
// :description: Updates the label visibility when text is empty or not.
//
internal
func
textViewTextDidChange
()
{
placeholderLabel
?
.
hidden
=
!
text
.
isEmpty
if
let
p
=
placeholderLabel
{
p
.
hidden
=
!
text
.
isEmpty
}
}
//
...
...
@@ -118,7 +124,7 @@ public class TextView: UITextView {
// label needs to be added to the view
// hierarchy before setting insets
textContainerInset
=
UIEdgeInsetsMake
(
16
,
16
,
16
,
16
)
backgroundColor
=
MaterialTheme
.
clear
.
color
NSNotificationCenter
.
defaultCenter
()
.
addObserver
(
self
,
selector
:
"textViewTextDidChange"
,
name
:
UITextViewTextDidChangeNotification
,
object
:
nil
)
updateLabelConstraints
()
}
...
...
@@ -128,27 +134,26 @@ public class TextView: UITextView {
// :description: Updates the placeholder constraints.
//
private
func
updateLabelConstraints
()
{
if
nil
!
=
placeholderLabel
{
if
let
p
=
placeholderLabel
{
NSLayoutConstraint
.
deactivateConstraints
(
layoutConstraints
)
layoutConstraints
=
Layout
.
constraint
(
"H:|-(left)-[placeholder]-(right)-|"
,
layoutConstraints
=
Layout
.
constraint
(
"H:|-(left)-[placeholder
Label
]-(right)-|"
,
options
:
nil
,
metrics
:
[
"left"
:
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
,
"right"
:
textContainerInset
.
right
+
textContainer
.
lineFragmentPadding
],
views
:
[
"placeholder
"
:
placeholderLabel
!
"placeholder
Label"
:
p
])
layoutConstraints
+=
Layout
.
constraint
(
"V:|-(top)-[placeholder]-(>=bottom)-|"
,
layoutConstraints
+=
Layout
.
constraint
(
"V:|-(top)-[placeholder
Label
]-(>=bottom)-|"
,
options
:
nil
,
metrics
:
[
"top"
:
textContainerInset
.
top
,
"bottom"
:
textContainerInset
.
bottom
],
views
:
[
"placeholder
"
:
placeholderLabel
!
"placeholder
Label"
:
p
])
NSLayoutConstraint
.
activateConstraints
(
layoutConstraints
)
}
}
...
...
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