-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
1,302 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
app/schemas/com.duckduckgo.app.global.db.AppDatabase/5.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 5, | ||
"identityHash": "df2202389ba5b11018b57a417457b11b", | ||
"entities": [ | ||
{ | ||
"tableName": "https_upgrade_domain", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`domain` TEXT NOT NULL, PRIMARY KEY(`domain`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "domain", | ||
"columnName": "domain", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"domain" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "disconnect_tracker", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `category` TEXT NOT NULL, `networkName` TEXT NOT NULL, `networkUrl` TEXT NOT NULL, PRIMARY KEY(`url`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "url", | ||
"columnName": "url", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "category", | ||
"columnName": "category", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "networkName", | ||
"columnName": "networkName", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "networkUrl", | ||
"columnName": "networkUrl", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"url" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "network_leaderboard", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`networkName` TEXT NOT NULL, `domainVisited` TEXT NOT NULL, PRIMARY KEY(`networkName`, `domainVisited`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "networkName", | ||
"columnName": "networkName", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "domainVisited", | ||
"columnName": "domainVisited", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"networkName", | ||
"domainVisited" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "app_configuration", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `appConfigurationDownloaded` INTEGER NOT NULL, PRIMARY KEY(`key`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "key", | ||
"columnName": "key", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "appConfigurationDownloaded", | ||
"columnName": "appConfigurationDownloaded", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"key" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
} | ||
], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"df2202389ba5b11018b57a417457b11b\")" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/src/androidTest/java/com/duckduckgo/app/global/view/ColorCombinerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2018 DuckDuckGo | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.duckduckgo.app.global.view | ||
|
||
import android.graphics.Color | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class ColorCombinerTest { | ||
|
||
private val testee = ColorCombiner() | ||
|
||
@Test | ||
fun whenColorsCombineWithZeroRatioThenCombinedColorIsFirstColor() { | ||
val from = Color.argb(200, 200, 200, 200) | ||
val to = Color.argb(100, 100, 100, 100) | ||
assertEquals(from, testee.combine(from, to, 0.toFloat())) | ||
} | ||
|
||
@Test | ||
fun whenColorsCombineWithFullRatioThenCombinedColorIsSecondColor() { | ||
val from = Color.argb(200, 200, 200, 200) | ||
val to = Color.argb(100, 100, 100, 100) | ||
assertEquals(to, testee.combine(from, to, 1.toFloat())) | ||
} | ||
|
||
@Test | ||
fun whenColorsCombinedWithHalfRatioThenCombinedColorIsMixed() { | ||
val from = Color.argb(200, 200, 200, 200) | ||
val to = Color.argb(100, 100, 100, 100) | ||
val expected = Color.argb(150, 150, 150, 150) | ||
val actual = testee.combine(from, to, 0.5.toFloat()) | ||
assertEquals(expected, actual) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.