Skip to content

Commit

Permalink
Update Paging Library to alpha5 (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkranich authored and elihart committed Jan 25, 2018
1 parent 59fa4db commit ecc8a83
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion blessedDeps.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rootProject.ext.MIN_SDK_VERSION_LITHO = 15
rootProject.ext.ANDROID_BUILD_TOOLS_VERSION = "26.0.2"
rootProject.ext.ANDROID_SUPPORT_LIBS_VERSION = "26.1.0"
rootProject.ext.ANDROID_DATA_BINDING = "1.3.1"
rootProject.ext.ANDROID_PAGING = "1.0.0-alpha2"
rootProject.ext.ANDROID_PAGING = "1.0.0-alpha5"
rootProject.ext.BUTTERKNIFE_VERSION = "8.8.1"
rootProject.ext.SQUARE_JAVAPOET_VERSION = "1.9.0"
rootProject.ext.SQUARE_KOTLINPOET_VERSION = "0.5.0"
Expand Down
4 changes: 2 additions & 2 deletions epoxy-pagingsample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ dependencies {
compile rootProject.deps.kotlin

compile "org.jetbrains.anko:anko-coroutines:0.10.1"
compile 'android.arch.persistence.room:runtime:1.0.0-beta1'
kapt 'android.arch.persistence.room:compiler:1.0.0-beta1'
compile 'android.arch.persistence.room:runtime:1.0.0'
kapt 'android.arch.persistence.room:compiler:1.0.0'

compile project(':epoxy-adapter')
compile project(':epoxy-paging')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data class User(
@Dao
interface UserDao {
@get:Query("SELECT * FROM user")
val dataSource: TiledDataSource<User>
val dataSource: DataSource.Factory<Int, User>

@get:Query("SELECT * FROM user")
val all: List<User>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,21 @@ class PagingSampleActivity : AppCompatActivity() {
db.userDao().insertAll(User(i))
}

return@bg PagedList.Builder<Int, User>().run {
setDataSource(db.userDao().dataSource)
return@bg PagedList.Builder<Int, User>(
db.userDao().dataSource.create(),
PagedList.Config.Builder().run {
setEnablePlaceholders(true)
setPageSize(40)
setInitialLoadSizeHint(80)
setPrefetchDistance(50)
build()
}).run {
setMainThreadExecutor(UiThreadExecutor)
setBackgroundThreadExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
setConfig(PagedList.Config.Builder().run {
setEnablePlaceholders(false)
setPageSize(40)
setInitialLoadSizeHint(80)
setPrefetchDistance(50)
build()
})
build()
}
}


pagingController.setList(pagedList.await())
}

Expand All @@ -64,13 +63,15 @@ class TestController : PagingEpoxyController<User>() {
setDebugLoggingEnabled(true)
}

override fun buildModels(users: List<User>) {
override fun buildModels(users: List<User?>) {
println("build ${users.size}")

users.forEach {
pagingView {
id(it.uid)
name("Id: ${it.uid}")
if (it != null) {
pagingView {
id(it.uid)
name("Id: ${it.uid}")
}
}
}
}
Expand Down

0 comments on commit ecc8a83

Please sign in to comment.