Skip to content

Commit 0f6ec22

Browse files
SergeyDirinyigit
authored andcommittedJan 11, 2018
deprecated LivePagedListProvider (#272)
canged to DataSource.Factory and LivePagedListBuilder
1 parent 078e007 commit 0f6ec22

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

Diff for: ‎PagingSample/app/src/main/java/paging/android/example/com/pagingsample/CheeseDao.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package paging.android.example.com.pagingsample
1818

19-
import android.arch.paging.LivePagedListProvider
19+
import android.arch.paging.DataSource
2020
import android.arch.persistence.room.Dao
2121
import android.arch.persistence.room.Delete
2222
import android.arch.persistence.room.Insert
@@ -32,7 +32,7 @@ interface CheeseDao {
3232
* it back to UI via ViewModel.
3333
*/
3434
@Query("SELECT * FROM Cheese ORDER BY name COLLATE NOCASE ASC")
35-
fun allCheesesByName(): LivePagedListProvider<Int, Cheese>
35+
fun allCheesesByName(): DataSource.Factory<Int, Cheese>
3636

3737
@Insert
3838
fun insert(cheeses: List<Cheese>)

Diff for: ‎PagingSample/app/src/main/java/paging/android/example/com/pagingsample/CheeseViewModel.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package paging.android.example.com.pagingsample
1818

1919
import android.app.Application
2020
import android.arch.lifecycle.AndroidViewModel
21+
import android.arch.paging.LivePagedListBuilder
2122
import android.arch.paging.PagedList
2223

2324
/**
@@ -49,11 +50,10 @@ class CheeseViewModel(app: Application) : AndroidViewModel(app) {
4950
private const val ENABLE_PLACEHOLDERS = true
5051
}
5152

52-
val allCheeses = dao.allCheesesByName().create(0,
53-
PagedList.Config.Builder()
53+
val allCheeses = LivePagedListBuilder(dao.allCheesesByName(), PagedList.Config.Builder()
5454
.setPageSize(PAGE_SIZE)
5555
.setEnablePlaceholders(ENABLE_PLACEHOLDERS)
56-
.build())!!
56+
.build()).build()
5757

5858
fun insert(text: CharSequence) = ioThread {
5959
dao.insert(Cheese(id = 0, name = text.toString()))

0 commit comments

Comments
 (0)
Please sign in to comment.