Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
3a529446
Commit
3a529446
authored
Apr 02, 2019
by
Sawyer Blatz
Committed by
Jonathan Almeida
Apr 10, 2019
Browse files
Fixes #2620: Immediately update site security icon color
parent
3f368711
Changes
2
Hide whitespace changes
Inline
Side-by-side
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt
View file @
3a529446
...
...
@@ -179,7 +179,13 @@ internal class DisplayToolbar(
private
val
defaultColor
=
ContextCompat
.
getColor
(
context
,
R
.
color
.
photonWhite
)
private
var
currentSiteSecurity
=
SiteSecurity
.
INSECURE
internal
var
securityIconColor
=
Pair
(
defaultColor
,
defaultColor
)
set
(
value
)
{
field
=
value
setSiteSecurity
(
currentSiteSecurity
)
}
internal
var
menuViewColor
=
defaultColor
set
(
value
)
{
...
...
@@ -274,6 +280,8 @@ internal class DisplayToolbar(
setImageResource
(
image
)
setColorFilter
(
color
)
}
currentSiteSecurity
=
secure
}
/**
...
...
components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/display/DisplayToolbarTest.kt
View file @
3a529446
...
...
@@ -684,7 +684,7 @@ class DisplayToolbarTest {
}
@Test
fun
`
iconView
changes
image
color
filter
on
update
`
()
{
fun
`
securityIconColor
is
set
when
securityIconColor
changes
`
()
{
val
toolbar
=
mock
(
BrowserToolbar
::
class
.
java
)
val
displayToolbar
=
DisplayToolbar
(
RuntimeEnvironment
.
application
,
toolbar
)
...
...
@@ -694,6 +694,18 @@ class DisplayToolbarTest {
assertEquals
(
R
.
color
.
photonBlue40
,
displayToolbar
.
securityIconColor
.
second
)
}
@Test
fun
`setSiteSecurity
is
called
when
securityIconColor
changes`
()
{
val
toolbar
=
BrowserToolbar
(
context
)
toolbar
.
displayToolbar
assertNull
(
toolbar
.
displayToolbar
.
siteSecurityIconView
.
colorFilter
)
toolbar
.
siteSecurityColor
=
Pair
(
R
.
color
.
photonBlue40
,
R
.
color
.
photonBlue40
)
assertNotNull
(
toolbar
.
displayToolbar
.
siteSecurityIconView
.
colorFilter
)
}
@Test
fun
`clicking
menu
button
emits
fact`
()
{
CollectionProcessor
.
withFactCollection
{
facts
->
...
...
Write
Preview
Supports
Markdown
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