diff --git a/blessedDeps.gradle b/blessedDeps.gradle index d4585509c1..32c79ececd 100644 --- a/blessedDeps.gradle +++ b/blessedDeps.gradle @@ -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" diff --git a/epoxy-pagingsample/build.gradle b/epoxy-pagingsample/build.gradle index edeed0d2f3..5bb5713d17 100644 --- a/epoxy-pagingsample/build.gradle +++ b/epoxy-pagingsample/build.gradle @@ -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') diff --git a/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/DataBaseSetup.kt b/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/DataBaseSetup.kt index 1ecdf68033..4779f2a18d 100644 --- a/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/DataBaseSetup.kt +++ b/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/DataBaseSetup.kt @@ -23,7 +23,7 @@ data class User( @Dao interface UserDao { @get:Query("SELECT * FROM user") - val dataSource: TiledDataSource + val dataSource: DataSource.Factory @get:Query("SELECT * FROM user") val all: List diff --git a/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/PagingSampleActivity.kt b/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/PagingSampleActivity.kt index 527b67e924..ce9b52b8d1 100644 --- a/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/PagingSampleActivity.kt +++ b/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/PagingSampleActivity.kt @@ -37,22 +37,21 @@ class PagingSampleActivity : AppCompatActivity() { db.userDao().insertAll(User(i)) } - return@bg PagedList.Builder().run { - setDataSource(db.userDao().dataSource) + return@bg PagedList.Builder( + 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()) } @@ -64,13 +63,15 @@ class TestController : PagingEpoxyController() { setDebugLoggingEnabled(true) } - override fun buildModels(users: List) { + override fun buildModels(users: List) { 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}") + } } } }