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
1ef54bde
Commit
1ef54bde
authored
Sep 26, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added base button class
parent
dd2e3d5a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
358 additions
and
21 deletions
+358
-21
MaterialKit.xcodeproj/project.pbxproj
+16
-0
Source/FlatButton.swift
+45
-0
Source/MaterialButton.swift
+207
-0
Source/MaterialTheme.swift
+62
-0
Source/MaterialView.swift
+19
-12
Source/NavigationBarView.swift
+9
-9
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
1ef54bde
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
65BDD14F1BB5EE4A006F7F2B
/* MaterialGravity.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD14F1BB5EE4A006F7F2B
/* MaterialGravity.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1511BB6EE7C006F7F2B
/* RobotoFont.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1511BB6EE7C006F7F2B
/* RobotoFont.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1531BB6F473006F7F2B
/* MaterialShadow.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1531BB6F473006F7F2B
/* MaterialShadow.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1571BB6FC82006F7F2B
/* MaterialButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1561BB6FC82006F7F2B
/* MaterialButton.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1581BB6FE3E006F7F2B
/* FlatButton.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
...
@@ -44,6 +46,8 @@
...
@@ -44,6 +46,8 @@
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialGravity.swift
;
sourceTree
=
"<group>"
;
};
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialGravity.swift
;
sourceTree
=
"<group>"
;
};
65BDD1511BB6EE7C006F7F2B
/* RobotoFont.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RobotoFont.swift
;
sourceTree
=
"<group>"
;
};
65BDD1511BB6EE7C006F7F2B
/* RobotoFont.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RobotoFont.swift
;
sourceTree
=
"<group>"
;
};
65BDD1531BB6F473006F7F2B
/* MaterialShadow.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialShadow.swift
;
sourceTree
=
"<group>"
;
};
65BDD1531BB6F473006F7F2B
/* MaterialShadow.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialShadow.swift
;
sourceTree
=
"<group>"
;
};
65BDD1561BB6FC82006F7F2B
/* MaterialButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialButton.swift
;
sourceTree
=
"<group>"
;
};
65BDD1581BB6FE3E006F7F2B
/* FlatButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FlatButton.swift
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -99,6 +103,15 @@
...
@@ -99,6 +103,15 @@
name
=
Roboto
;
name
=
Roboto
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
65BDD1551BB6FC60006F7F2B
/* Button */
=
{
isa
=
PBXGroup
;
children
=
(
65BDD1561BB6FC82006F7F2B
/* MaterialButton.swift */
,
65BDD1581BB6FE3E006F7F2B
/* FlatButton.swift */
,
);
name
=
Button
;
sourceTree
=
"<group>"
;
};
9638322C1B88DFD80015F710
=
{
9638322C1B88DFD80015F710
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -125,6 +138,7 @@
...
@@ -125,6 +138,7 @@
96B57D4C1B90AF6A00DE7BBB
/* Theme */
,
96B57D4C1B90AF6A00DE7BBB
/* Theme */
,
9AAC38521B89553800FE6B2D
/* Font */
,
9AAC38521B89553800FE6B2D
/* Font */
,
65B965851B8BEEB00055B139
/* View */
,
65B965851B8BEEB00055B139
/* View */
,
65BDD1551BB6FC60006F7F2B
/* Button */
,
);
);
path
=
Source
;
path
=
Source
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -291,9 +305,11 @@
...
@@ -291,9 +305,11 @@
files
=
(
files
=
(
65BDD1471BB5B916006F7F2B
/* MaterialView.swift in Sources */
,
65BDD1471BB5B916006F7F2B
/* MaterialView.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
,
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
,
65BDD14F1BB5EE4A006F7F2B
/* MaterialGravity.swift in Sources */
,
65BDD14F1BB5EE4A006F7F2B
/* MaterialGravity.swift in Sources */
,
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
,
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
,
65BDD1571BB6FC82006F7F2B
/* MaterialButton.swift in Sources */
,
65BDD14B1BB5DD02006F7F2B
/* MaterialFont.swift in Sources */
,
65BDD14B1BB5DD02006F7F2B
/* MaterialFont.swift in Sources */
,
65BDD1491BB5DC98006F7F2B
/* MaterialColor.swift in Sources */
,
65BDD1491BB5DC98006F7F2B
/* MaterialColor.swift in Sources */
,
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
,
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
,
...
...
Source/FlatButton.swift
0 → 100644
View file @
1ef54bde
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import
UIKit
public
class
FlatButton
:
MaterialButton
{
//
// :name: prepareView
//
internal
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
button
.
flat
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
titleLabel
!.
font
=
MaterialTheme
.
button
.
flat
.
titleLabelFont
backgroundColor
=
MaterialColor
.
red
.
base
//MaterialTheme.button.flat.backgroudColor
// contentEdgeInsets = UIEdgeInsetsMake(8, 12, 8, 12)
}
//
// :name: prepareLayer
//
internal
override
func
prepareLayer
()
{
super
.
prepareLayer
()
shadow
=
MaterialTheme
.
button
.
flat
.
shadow
shadowColor
=
MaterialTheme
.
button
.
flat
.
shadowColor
zPosition
=
MaterialTheme
.
button
.
flat
.
zPosition
masksToBounds
=
MaterialTheme
.
button
.
flat
.
masksToBounds
}
}
\ No newline at end of file
Source/MaterialButton.swift
0 → 100644
View file @
1ef54bde
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import
UIKit
public
class
MaterialButton
:
UIButton
{
/**
:name: backgroundColor
*/
public
override
var
backgroundColor
:
UIColor
?
{
get
{
return
nil
==
layer
.
backgroundColor
?
nil
:
UIColor
(
CGColor
:
layer
.
backgroundColor
!
)
}
set
(
value
)
{
layer
.
backgroundColor
=
value
?
.
CGColor
}
}
/**
:name: x
*/
public
var
x
:
CGFloat
!
{
didSet
{
layer
.
bounds
.
origin
.
x
=
x
}
}
/**
:name: y
*/
public
var
y
:
CGFloat
!
{
didSet
{
layer
.
bounds
.
origin
=
CGPointMake
(
x
,
y
)
}
}
/**
:name: width
*/
public
var
width
:
CGFloat
!
{
didSet
{
layer
.
bounds
.
size
.
width
=
width
}
}
/**
:name: height
*/
public
var
height
:
CGFloat
!
{
didSet
{
layer
.
bounds
.
size
.
height
=
height
}
}
/**
:name: shadowColor
*/
public
var
shadowColor
:
UIColor
!
{
didSet
{
layer
.
shadowColor
=
shadowColor
.
CGColor
}
}
/**
:name: shadowOffset
*/
public
var
shadowOffset
:
CGSize
!
{
didSet
{
layer
.
shadowOffset
=
shadowOffset
}
}
/**
:name: shadowOpacity
*/
public
var
shadowOpacity
:
Float
!
{
didSet
{
layer
.
shadowOpacity
=
shadowOpacity
}
}
/**
:name: shadowRadius
*/
public
var
shadowRadius
:
CGFloat
!
{
didSet
{
layer
.
shadowRadius
=
shadowRadius
}
}
/**
:name: masksToBounds
*/
public
var
masksToBounds
:
Bool
!
{
didSet
{
layer
.
masksToBounds
=
masksToBounds
}
}
/**
:name: shadow
*/
public
var
shadow
:
MaterialShadow
!
{
didSet
{
let
value
:
(
offset
:
CGSize
,
opacity
:
Float
,
radius
:
CGFloat
)
=
MaterialShadowToValues
(
shadow
)
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
}
}
/**
:name: zPosition
*/
public
var
zPosition
:
CGFloat
!
{
didSet
{
layer
.
zPosition
=
zPosition
}
}
/**
:name: pulseColor
*/
public
var
pulseColor
:
UIColor
?
=
MaterialColor
.
white
/**
:name: init
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
/**
:name: init
*/
public
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
prepareView
()
prepareLayer
()
prepareBounds
()
}
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectMake
(
0
,
0
,
100
,
100
))
}
/**
:name: touchesBegan
*/
public
override
func
touchesBegan
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
}
/**
:name: touchesEnded
*/
public
override
func
touchesEnded
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
withEvent
:
event
)
}
/**
:name: touchesCancelled
*/
public
override
func
touchesCancelled
(
touches
:
Set
<
UITouch
>
?,
withEvent
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
withEvent
:
event
)
}
//
// :name: prepareView
//
internal
func
prepareView
()
{
userInteractionEnabled
=
MaterialTheme
.
button
.
userInteractionEnabled
}
//
// :name: prepareBounds
//
internal
func
prepareBounds
()
{
x
=
frame
.
origin
.
x
y
=
frame
.
origin
.
y
width
=
frame
.
size
.
width
height
=
frame
.
size
.
height
}
//
// :name: prepareLayer
//
internal
func
prepareLayer
()
{
}
}
\ No newline at end of file
Source/MaterialTheme.swift
View file @
1ef54bde
...
@@ -21,6 +21,11 @@ import UIKit
...
@@ -21,6 +21,11 @@ import UIKit
public
struct
MaterialTheme
{
public
struct
MaterialTheme
{
public
struct
view
{}
public
struct
view
{}
public
struct
navigation
{}
public
struct
navigation
{}
public
struct
button
{
public
struct
fab
{}
public
struct
flat
{}
public
struct
raised
{}
}
}
}
// view
// view
...
@@ -47,6 +52,9 @@ public extension MaterialTheme.view {
...
@@ -47,6 +52,9 @@ public extension MaterialTheme.view {
public
static
let
contentsCenter
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
let
contentsCenter
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
let
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
public
static
let
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
public
static
let
contentsGravity
:
MaterialGravity
=
.
ResizeAspectFill
public
static
let
contentsGravity
:
MaterialGravity
=
.
ResizeAspectFill
// position
public
static
let
zPosition
:
CGFloat
=
0
}
}
// navigation
// navigation
...
@@ -74,5 +82,59 @@ public extension MaterialTheme.navigation {
...
@@ -74,5 +82,59 @@ public extension MaterialTheme.navigation {
public
static
let
contentsCenter
:
CGRect
=
MaterialTheme
.
view
.
contentsCenter
public
static
let
contentsCenter
:
CGRect
=
MaterialTheme
.
view
.
contentsCenter
public
static
let
contentsScale
:
CGFloat
=
MaterialTheme
.
view
.
contentsScale
public
static
let
contentsScale
:
CGFloat
=
MaterialTheme
.
view
.
contentsScale
public
static
let
contentsGravity
:
MaterialGravity
=
MaterialTheme
.
view
.
contentsGravity
public
static
let
contentsGravity
:
MaterialGravity
=
MaterialTheme
.
view
.
contentsGravity
// position
public
static
let
zPosition
:
CGFloat
=
100
}
// button
public
extension
MaterialTheme
.
button
{
// shadow
public
static
let
shadow
:
MaterialShadow
=
.
Depth0
public
static
let
shadowColor
:
UIColor
=
MaterialTheme
.
view
.
shadowColor
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
// color
public
static
let
backgroudColor
:
UIColor
=
MaterialColor
.
clear
public
static
let
titleLabelColorForNormalState
:
UIColor
=
MaterialColor
.
blueGrey
.
darken4
// interaction
public
static
let
userInteractionEnabled
:
Bool
=
true
// position
public
static
let
zPosition
:
CGFloat
=
200
// font
public
static
let
titleLabelFont
:
UIFont
=
RobotoFont
.
regular
}
}
// button.flat
public
extension
MaterialTheme
.
button
.
flat
{
// shadow
public
static
let
shadow
:
MaterialShadow
=
MaterialTheme
.
button
.
shadow
public
static
let
shadowColor
:
UIColor
=
MaterialTheme
.
button
.
shadowColor
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
button
.
masksToBounds
// color
public
static
let
backgroudColor
:
UIColor
=
MaterialTheme
.
button
.
backgroudColor
public
static
let
titleLabelColorForNormalState
:
UIColor
=
MaterialTheme
.
button
.
titleLabelColorForNormalState
// interaction
public
static
let
userInteractionEnabled
:
Bool
=
MaterialTheme
.
button
.
userInteractionEnabled
// position
public
static
let
zPosition
:
CGFloat
=
MaterialTheme
.
button
.
zPosition
// font
public
static
let
titleLabelFont
:
UIFont
=
RobotoFont
.
regular
}
// button.fab
public
extension
MaterialTheme
.
button
.
fab
{
}
// button.raised
public
extension
MaterialTheme
.
button
.
raised
{
}
Source/MaterialView.swift
View file @
1ef54bde
...
@@ -170,6 +170,15 @@ public class MaterialView: UIView {
...
@@ -170,6 +170,15 @@ public class MaterialView: UIView {
}
}
/**
/**
:name: zPosition
*/
public
var
zPosition
:
CGFloat
!
{
didSet
{
layer
.
zPosition
=
zPosition
}
}
/**
:name: init
:name: init
*/
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
...
@@ -191,22 +200,19 @@ public class MaterialView: UIView {
...
@@ -191,22 +200,19 @@ public class MaterialView: UIView {
*/
*/
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
view
.
x
,
MaterialTheme
.
view
.
y
,
MaterialTheme
.
view
.
width
,
MaterialTheme
.
view
.
height
))
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
view
.
x
,
MaterialTheme
.
view
.
y
,
MaterialTheme
.
view
.
width
,
MaterialTheme
.
view
.
height
))
prepareView
()
prepareLayer
()
prepareBounds
()
}
}
/
**
/
/
:name: prepareView
//
:name: prepareView
*
/
/
/
internal
func
prepareView
()
{
internal
func
prepareView
()
{
userInteractionEnabled
=
MaterialTheme
.
view
.
userInteractionEnabled
userInteractionEnabled
=
MaterialTheme
.
view
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
view
.
backgroudColor
backgroundColor
=
MaterialTheme
.
view
.
backgroudColor
}
}
/
**
/
/
:name: prepareBounds
//
:name: prepareBounds
*
/
/
/
internal
func
prepareBounds
()
{
internal
func
prepareBounds
()
{
x
=
frame
.
origin
.
x
x
=
frame
.
origin
.
x
y
=
frame
.
origin
.
y
y
=
frame
.
origin
.
y
...
@@ -214,9 +220,9 @@ public class MaterialView: UIView {
...
@@ -214,9 +220,9 @@ public class MaterialView: UIView {
height
=
frame
.
size
.
height
height
=
frame
.
size
.
height
}
}
/
**
/
/
:name: prepareLayer
//
:name: prepareLayer
*
/
/
/
internal
func
prepareLayer
()
{
internal
func
prepareLayer
()
{
contentsRect
=
MaterialTheme
.
view
.
contentsRect
contentsRect
=
MaterialTheme
.
view
.
contentsRect
contentsCenter
=
MaterialTheme
.
view
.
contentsCenter
contentsCenter
=
MaterialTheme
.
view
.
contentsCenter
...
@@ -224,6 +230,7 @@ public class MaterialView: UIView {
...
@@ -224,6 +230,7 @@ public class MaterialView: UIView {
contentsGravity
=
MaterialTheme
.
view
.
contentsGravity
contentsGravity
=
MaterialTheme
.
view
.
contentsGravity
shadow
=
MaterialTheme
.
view
.
shadow
shadow
=
MaterialTheme
.
view
.
shadow
shadowColor
=
MaterialTheme
.
view
.
shadowColor
shadowColor
=
MaterialTheme
.
view
.
shadowColor
zPosition
=
MaterialTheme
.
view
.
zPosition
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
}
}
}
}
...
...
Source/NavigationBarView.swift
View file @
1ef54bde
...
@@ -33,30 +33,30 @@ public class NavigationBarView: MaterialView {
...
@@ -33,30 +33,30 @@ public class NavigationBarView: MaterialView {
*/
*/
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
navigation
.
x
,
MaterialTheme
.
navigation
.
y
,
MaterialTheme
.
navigation
.
width
,
MaterialTheme
.
navigation
.
height
))
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
navigation
.
x
,
MaterialTheme
.
navigation
.
y
,
MaterialTheme
.
navigation
.
width
,
MaterialTheme
.
navigation
.
height
))
prepareView
()
prepareLayer
()
prepareBounds
()
}
}
/
**
/
/
:name: prepareView
//
:name: prepareView
*
/
/
/
internal
override
func
prepareView
()
{
internal
override
func
prepareView
()
{
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
navigation
.
userInteractionEnabled
userInteractionEnabled
=
MaterialTheme
.
navigation
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
navigation
.
backgroudColor
backgroundColor
=
MaterialTheme
.
navigation
.
backgroudColor
lightContentStatusBar
=
MaterialTheme
.
navigation
.
lightContentStatusBar
lightContentStatusBar
=
MaterialTheme
.
navigation
.
lightContentStatusBar
}
}
/
**
/
/
:name: prepareLayer
//
:name: prepareLayer
*
/
/
/
internal
override
func
prepareLayer
()
{
internal
override
func
prepareLayer
()
{
super
.
prepareLayer
()
contentsRect
=
MaterialTheme
.
navigation
.
contentsRect
contentsRect
=
MaterialTheme
.
navigation
.
contentsRect
contentsCenter
=
MaterialTheme
.
navigation
.
contentsCenter
contentsCenter
=
MaterialTheme
.
navigation
.
contentsCenter
contentsScale
=
MaterialTheme
.
navigation
.
contentsScale
contentsScale
=
MaterialTheme
.
navigation
.
contentsScale
contentsGravity
=
MaterialTheme
.
navigation
.
contentsGravity
contentsGravity
=
MaterialTheme
.
navigation
.
contentsGravity
shadow
=
MaterialTheme
.
navigation
.
shadow
shadow
=
MaterialTheme
.
navigation
.
shadow
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
zPosition
=
MaterialTheme
.
navigation
.
zPosition
masksToBounds
=
MaterialTheme
.
navigation
.
masksToBounds
masksToBounds
=
MaterialTheme
.
navigation
.
masksToBounds
}
}
}
}
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