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
f7ba4c9e
Commit
f7ba4c9e
authored
Oct 06, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added state-aware pulse coloring for Radio and CheckButton
parent
6a22d0ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Sources/iOS/BaseIconLayerButton.swift
+17
-0
No files found.
Sources/iOS/BaseIconLayerButton.swift
View file @
f7ba4c9e
...
@@ -20,6 +20,7 @@ open class BaseIconLayerButton: Button {
...
@@ -20,6 +20,7 @@ open class BaseIconLayerButton: Button {
open
override
var
isSelected
:
Bool
{
open
override
var
isSelected
:
Bool
{
didSet
{
didSet
{
iconLayer
.
setSelected
(
isSelected
,
animated
:
false
)
iconLayer
.
setSelected
(
isSelected
,
animated
:
false
)
updatePulseColor
()
}
}
}
}
...
@@ -150,6 +151,10 @@ open class BaseIconLayerButton: Button {
...
@@ -150,6 +151,10 @@ open class BaseIconLayerButton: Button {
setIconColor
(
theme
.
secondary
,
for
:
.
selected
)
setIconColor
(
theme
.
secondary
,
for
:
.
selected
)
setIconColor
(
theme
.
onSurface
.
withAlphaComponent
(
0.38
),
for
:
.
normal
)
setIconColor
(
theme
.
onSurface
.
withAlphaComponent
(
0.38
),
for
:
.
normal
)
titleColor
=
theme
.
onSurface
.
withAlphaComponent
(
0.60
)
titleColor
=
theme
.
onSurface
.
withAlphaComponent
(
0.60
)
selectedPulseColor
=
theme
.
secondary
normalPulseColor
=
theme
.
onSurface
updatePulseColor
()
}
}
...
@@ -168,6 +173,18 @@ open class BaseIconLayerButton: Button {
...
@@ -168,6 +173,18 @@ open class BaseIconLayerButton: Button {
UIGraphicsEndImageContext
()
UIGraphicsEndImageContext
()
self
.
image
=
image
self
.
image
=
image
}
}
/// Pulse color for selected state.
open
var
selectedPulseColor
=
Color
.
white
/// Pulse color for normal state.
open
var
normalPulseColor
=
Color
.
white
}
private
extension
BaseIconLayerButton
{
func
updatePulseColor
()
{
pulseColor
=
isSelected
?
selectedPulseColor
:
normalPulseColor
}
}
}
// MARK: - BaseIconLayer
// MARK: - BaseIconLayer
...
...
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