-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from mkaomwakuni/Bookmarks-Integration
Feature Bookmarks
- Loading branch information
Showing
22 changed files
with
447 additions
and
283 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
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
19 changes: 2 additions & 17 deletions
19
app/src/main/java/dev/mkao/weaver/data/remote/NewsDatabase.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 |
---|---|---|
@@ -1,27 +1,12 @@ | ||
package dev.mkao.weaver.data.remote | ||
|
||
import android.content.Context | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
import androidx.room.TypeConverters | ||
import dev.mkao.weaver.domain.model.Article | ||
|
||
@Database(entities = [Article::class], version = 1) | ||
@TypeConverters(NewsTypeConvertor::class) | ||
abstract class NewsDatabase: RoomDatabase(){ | ||
abstract fun articleDao(): NewsDao | ||
|
||
companion object { | ||
@Volatile private var instance: NewsDatabase? = null | ||
|
||
fun getDatabase(context: Context): NewsDatabase = | ||
instance ?: synchronized(this) { | ||
instance ?: Room.databaseBuilder( | ||
context.applicationContext, | ||
NewsDatabase::class.java, | ||
"articles" | ||
).build().also { instance = it } | ||
} | ||
} | ||
abstract class NewsDatabase : RoomDatabase() { | ||
abstract fun articleDao(): NewsDao | ||
} |
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
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.