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
dd2e3d5a
Commit
dd2e3d5a
authored
Sep 26, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added MaterialShadow enum facility
parent
ee9cc8d1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
14 deletions
+70
-14
MaterialKit.xcodeproj/project.pbxproj
+4
-0
Source/MaterialShadow.swift
+48
-0
Source/MaterialTheme.swift
+4
-8
Source/MaterialView.swift
+13
-3
Source/NavigationBarView.swift
+1
-3
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
dd2e3d5a
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
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
=
();
};
};
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 */
;
};
...
@@ -42,6 +43,7 @@
...
@@ -42,6 +43,7 @@
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTheme.swift
;
sourceTree
=
"<group>"
;
};
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTheme.swift
;
sourceTree
=
"<group>"
;
};
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>"
;
};
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>"
;
};
...
@@ -158,6 +160,7 @@
...
@@ -158,6 +160,7 @@
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
,
65BDD14C1BB5ED9F006F7F2B
/* MaterialTheme.swift */
,
65BDD1481BB5DC98006F7F2B
/* MaterialColor.swift */
,
65BDD1481BB5DC98006F7F2B
/* MaterialColor.swift */
,
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
,
65BDD14E1BB5EE4A006F7F2B
/* MaterialGravity.swift */
,
65BDD1531BB6F473006F7F2B
/* MaterialShadow.swift */
,
);
);
name
=
Theme
;
name
=
Theme
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -290,6 +293,7 @@
...
@@ -290,6 +293,7 @@
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.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 */
,
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/MaterialShadow.swift
0 → 100644
View file @
dd2e3d5a
//
// 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
enum
MaterialShadow
{
case
Depth0
case
Depth1
case
Depth2
case
Depth3
case
Depth4
case
Depth5
}
/**
:name: MaterialShadowToValues
*/
public
func
MaterialShadowToValues
(
shadow
:
MaterialShadow
)
->
(
offset
:
CGSize
,
opacity
:
Float
,
radius
:
CGFloat
)
{
switch
shadow
{
case
.
Depth0
:
return
(
offset
:
CGSizeZero
,
opacity
:
0
,
radius
:
0
)
case
.
Depth1
:
return
(
offset
:
CGSizeMake
(
0.2
,
0.2
),
opacity
:
0.5
,
radius
:
1
)
case
.
Depth2
:
return
(
offset
:
CGSizeMake
(
0.4
,
0.4
),
opacity
:
0.5
,
radius
:
2
)
case
.
Depth3
:
return
(
offset
:
CGSizeMake
(
0.6
,
0.6
),
opacity
:
0.5
,
radius
:
3
)
case
.
Depth4
:
return
(
offset
:
CGSizeMake
(
0.8
,
0.8
),
opacity
:
0.5
,
radius
:
4
)
case
.
Depth5
:
return
(
offset
:
CGSizeMake
(
1
,
1
),
opacity
:
0.5
,
radius
:
5
)
}
}
Source/MaterialTheme.swift
View file @
dd2e3d5a
...
@@ -31,11 +31,9 @@ public extension MaterialTheme.view {
...
@@ -31,11 +31,9 @@ public extension MaterialTheme.view {
public
static
let
width
:
CGFloat
=
UIScreen
.
mainScreen
()
.
bounds
.
width
public
static
let
width
:
CGFloat
=
UIScreen
.
mainScreen
()
.
bounds
.
width
public
static
let
height
:
CGFloat
=
UIScreen
.
mainScreen
()
.
bounds
.
height
public
static
let
height
:
CGFloat
=
UIScreen
.
mainScreen
()
.
bounds
.
height
// layer
// shadow
public
static
let
shadow
:
MaterialShadow
=
.
Depth0
public
static
let
shadowColor
:
UIColor
=
MaterialColor
.
blueGrey
.
darken4
public
static
let
shadowColor
:
UIColor
=
MaterialColor
.
blueGrey
.
darken4
public
static
let
shadowOffset
:
CGSize
=
CGSizeMake
(
0.2
,
0.2
)
public
static
let
shadowOpacity
:
Float
=
0.5
public
static
let
shadowRadius
:
CGFloat
=
1
public
static
let
masksToBounds
:
Bool
=
false
public
static
let
masksToBounds
:
Bool
=
false
// color
// color
...
@@ -59,11 +57,9 @@ public extension MaterialTheme.navigation {
...
@@ -59,11 +57,9 @@ public extension MaterialTheme.navigation {
public
static
let
width
:
CGFloat
=
MaterialTheme
.
view
.
width
public
static
let
width
:
CGFloat
=
MaterialTheme
.
view
.
width
public
static
let
height
:
CGFloat
=
70
public
static
let
height
:
CGFloat
=
70
// layer
// shadow
public
static
let
shadow
:
MaterialShadow
=
.
Depth1
public
static
let
shadowColor
:
UIColor
=
MaterialTheme
.
view
.
shadowColor
public
static
let
shadowColor
:
UIColor
=
MaterialTheme
.
view
.
shadowColor
public
static
let
shadowOffset
:
CGSize
=
MaterialTheme
.
view
.
shadowOffset
public
static
let
shadowOpacity
:
Float
=
MaterialTheme
.
view
.
shadowOpacity
public
static
let
shadowRadius
:
CGFloat
=
MaterialTheme
.
view
.
shadowRadius
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
// color
// color
...
...
Source/MaterialView.swift
View file @
dd2e3d5a
...
@@ -158,6 +158,18 @@ public class MaterialView: UIView {
...
@@ -158,6 +158,18 @@ public class MaterialView: UIView {
}
}
/**
/**
: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: init
:name: init
*/
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
...
@@ -210,10 +222,8 @@ public class MaterialView: UIView {
...
@@ -210,10 +222,8 @@ public class MaterialView: UIView {
contentsCenter
=
MaterialTheme
.
view
.
contentsCenter
contentsCenter
=
MaterialTheme
.
view
.
contentsCenter
contentsScale
=
MaterialTheme
.
view
.
contentsScale
contentsScale
=
MaterialTheme
.
view
.
contentsScale
contentsGravity
=
MaterialTheme
.
view
.
contentsGravity
contentsGravity
=
MaterialTheme
.
view
.
contentsGravity
shadow
=
MaterialTheme
.
view
.
shadow
shadowColor
=
MaterialTheme
.
view
.
shadowColor
shadowColor
=
MaterialTheme
.
view
.
shadowColor
shadowOffset
=
MaterialTheme
.
view
.
shadowOffset
shadowOpacity
=
MaterialTheme
.
view
.
shadowOpacity
shadowRadius
=
MaterialTheme
.
view
.
shadowRadius
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
}
}
}
}
...
...
Source/NavigationBarView.swift
View file @
dd2e3d5a
...
@@ -55,10 +55,8 @@ public class NavigationBarView: MaterialView {
...
@@ -55,10 +55,8 @@ public class NavigationBarView: MaterialView {
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
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
shadowOffset
=
MaterialTheme
.
navigation
.
shadowOffset
shadowOpacity
=
MaterialTheme
.
navigation
.
shadowOpacity
shadowRadius
=
MaterialTheme
.
navigation
.
shadowRadius
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