Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Paging Library to alpha4 #360

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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