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
f3705791
Commit
f3705791
authored
Aug 04, 2020
by
Gabriel Luong
Browse files
Issue #7978: Part 2 - Rename TopSiteEntity to PinnedSiteEntity
parent
348b02c7
Changes
6
Hide whitespace changes
Inline
Side-by-side
components/feature/top-sites/src/androidTest/java/mozilla/components/feature/top/sites/db/TopSiteDaoTest.kt
View file @
f3705791
...
@@ -43,7 +43,7 @@ class TopSiteDaoTest {
...
@@ -43,7 +43,7 @@ class TopSiteDaoTest {
@Test
@Test
fun
testAddingTopSite
()
{
fun
testAddingTopSite
()
{
val
topSite
=
Top
SiteEntity
(
val
topSite
=
Pinned
SiteEntity
(
title
=
"Mozilla"
,
title
=
"Mozilla"
,
url
=
"https://www.mozilla.org"
,
url
=
"https://www.mozilla.org"
,
isDefault
=
false
,
isDefault
=
false
,
...
@@ -65,7 +65,7 @@ class TopSiteDaoTest {
...
@@ -65,7 +65,7 @@ class TopSiteDaoTest {
@Test
@Test
fun
testRemovingTopSite
()
{
fun
testRemovingTopSite
()
{
val
topSite1
=
Top
SiteEntity
(
val
topSite1
=
Pinned
SiteEntity
(
title
=
"Mozilla"
,
title
=
"Mozilla"
,
url
=
"https://www.mozilla.org"
,
url
=
"https://www.mozilla.org"
,
isDefault
=
false
,
isDefault
=
false
,
...
@@ -74,7 +74,7 @@ class TopSiteDaoTest {
...
@@ -74,7 +74,7 @@ class TopSiteDaoTest {
it
.
id
=
topSiteDao
.
insertTopSite
(
it
)
it
.
id
=
topSiteDao
.
insertTopSite
(
it
)
}
}
val
topSite2
=
Top
SiteEntity
(
val
topSite2
=
Pinned
SiteEntity
(
title
=
"Firefox"
,
title
=
"Firefox"
,
url
=
"https://www.firefox.com"
,
url
=
"https://www.firefox.com"
,
isDefault
=
false
,
isDefault
=
false
,
...
...
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/PinnedSiteStorage.kt
View file @
f3705791
...
@@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.Flow
...
@@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.Flow
import
kotlinx.coroutines.flow.map
import
kotlinx.coroutines.flow.map
import
mozilla.components.feature.top.sites.adapter.TopSiteAdapter
import
mozilla.components.feature.top.sites.adapter.TopSiteAdapter
import
mozilla.components.feature.top.sites.db.TopSiteDatabase
import
mozilla.components.feature.top.sites.db.TopSiteDatabase
import
mozilla.components.feature.top.sites.db.
Top
SiteEntity
import
mozilla.components.feature.top.sites.db.
Pinned
SiteEntity
/**
/**
* A storage implementation for organizing top sites.
* A storage implementation for organizing top sites.
...
@@ -29,7 +29,7 @@ class PinnedSiteStorage(
...
@@ -29,7 +29,7 @@ class PinnedSiteStorage(
* used to identify top sites that are added by the application.
* used to identify top sites that are added by the application.
*/
*/
fun
addTopSite
(
title
:
String
,
url
:
String
,
isDefault
:
Boolean
=
false
)
{
fun
addTopSite
(
title
:
String
,
url
:
String
,
isDefault
:
Boolean
=
false
)
{
Top
SiteEntity
(
Pinned
SiteEntity
(
title
=
title
,
title
=
title
,
url
=
url
,
url
=
url
,
isDefault
=
isDefault
,
isDefault
=
isDefault
,
...
...
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/adapter/TopSiteAdapter.kt
View file @
f3705791
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
package
mozilla.components.feature.top.sites.adapter
package
mozilla.components.feature.top.sites.adapter
import
mozilla.components.feature.top.sites.TopSite
import
mozilla.components.feature.top.sites.TopSite
import
mozilla.components.feature.top.sites.db.
Top
SiteEntity
import
mozilla.components.feature.top.sites.db.
Pinned
SiteEntity
internal
class
TopSiteAdapter
(
internal
class
TopSiteAdapter
(
internal
val
entity
:
Top
SiteEntity
internal
val
entity
:
Pinned
SiteEntity
)
:
TopSite
{
)
:
TopSite
{
override
val
id
:
Long
override
val
id
:
Long
get
()
=
entity
.
id
!!
get
()
=
entity
.
id
!!
...
...
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/
Top
SiteEntity.kt
→
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/
Pinned
SiteEntity.kt
View file @
f3705791
...
@@ -12,7 +12,7 @@ import androidx.room.PrimaryKey
...
@@ -12,7 +12,7 @@ import androidx.room.PrimaryKey
* Internal entity representing a top site.
* Internal entity representing a top site.
*/
*/
@Entity
(
tableName
=
"top_sites"
)
@Entity
(
tableName
=
"top_sites"
)
internal
data class
Top
SiteEntity
(
internal
data class
Pinned
SiteEntity
(
@PrimaryKey
(
autoGenerate
=
true
)
@PrimaryKey
(
autoGenerate
=
true
)
@ColumnInfo
(
name
=
"id"
)
@ColumnInfo
(
name
=
"id"
)
var
id
:
Long
?
=
null
,
var
id
:
Long
?
=
null
,
...
...
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteDao.kt
View file @
f3705791
...
@@ -13,21 +13,21 @@ import androidx.room.Transaction
...
@@ -13,21 +13,21 @@ import androidx.room.Transaction
import
kotlinx.coroutines.flow.Flow
import
kotlinx.coroutines.flow.Flow
/**
/**
* Internal DAO for accessing [
Top
SiteEntity] instances.
* Internal DAO for accessing [
Pinned
SiteEntity] instances.
*/
*/
@Dao
@Dao
internal
interface
TopSiteDao
{
internal
interface
TopSiteDao
{
@Insert
@Insert
fun
insertTopSite
(
site
:
Top
SiteEntity
):
Long
fun
insertTopSite
(
site
:
Pinned
SiteEntity
):
Long
@Delete
@Delete
fun
deleteTopSite
(
site
:
Top
SiteEntity
)
fun
deleteTopSite
(
site
:
Pinned
SiteEntity
)
@Transaction
@Transaction
@Query
(
"SELECT * FROM top_sites"
)
@Query
(
"SELECT * FROM top_sites"
)
fun
getTopSites
():
Flow
<
List
<
Top
SiteEntity
>>
fun
getTopSites
():
Flow
<
List
<
Pinned
SiteEntity
>>
@Transaction
@Transaction
@Query
(
"SELECT * FROM top_sites"
)
@Query
(
"SELECT * FROM top_sites"
)
fun
getTopSitesPaged
():
DataSource
.
Factory
<
Int
,
Top
SiteEntity
>
fun
getTopSitesPaged
():
DataSource
.
Factory
<
Int
,
Pinned
SiteEntity
>
}
}
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteDatabase.kt
View file @
f3705791
...
@@ -14,7 +14,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
...
@@ -14,7 +14,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase
/**
/**
* Internal database for storing top sites.
* Internal database for storing top sites.
*/
*/
@Database
(
entities
=
[
Top
SiteEntity
::
class
],
version
=
3
)
@Database
(
entities
=
[
Pinned
SiteEntity
::
class
],
version
=
3
)
internal
abstract
class
TopSiteDatabase
:
RoomDatabase
()
{
internal
abstract
class
TopSiteDatabase
:
RoomDatabase
()
{
abstract
fun
topSiteDao
():
TopSiteDao
abstract
fun
topSiteDao
():
TopSiteDao
...
...
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