diff --git a/.gitmodules b/.gitmodules index d89ed20a9c0..1f0c888aaa1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "upstreams/androidx-main"] path = upstreams/androidx-main url = ./ - branch = androidx-main-3.3.0-alpha02 + branch = androidx-main-3.3.0-alpha03 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 455d3b2bc42..9228a2d5639 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ android = "8.5.1" androidx-activity-compose = "1.9.1" androidx-appcompat = "1.7.0" -androidx-paging = "3.3.0-alpha02" +androidx-paging = "3.3.0-alpha03" kotlin = "1.9.24" kotlinx-coroutines = "1.8.1" kotlinx-serialization-json = "1.7.1" diff --git a/paging-common/README.md b/paging-common/README.md index e6ee18d309d..e0775709911 100644 --- a/paging-common/README.md +++ b/paging-common/README.md @@ -118,6 +118,6 @@ Consult the following table for guidance based on which APIs are being used. | `PagingConfig` | Use `createPagingConfig`. | | `PagingData.Companion.empty(LoadStates, LoadStates?)` | Pass in the default value yourself. | | `PagingData.Companion.from(List, LoadStates, LoadStates?)` | Pass in the default value yourself. | -| `PagingDataDiffer` | Pass in the default value yourself. | +| `PagingDataPresenter` | Pass in the default value yourself. | | `PagingLogger.log(Int, String, Throwable?)` | Pass in the default value yourself. | | `PagingSourceLoadResultPage` | Use `createPagingSourceLoadResultPage`. | diff --git a/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt b/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt similarity index 84% rename from paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt rename to paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt index 37eb61586b6..76db4695562 100644 --- a/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt +++ b/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt @@ -19,9 +19,6 @@ package app.cash.paging /** @suppress */ // Constructor has default argument values. @Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS") -actual typealias PagingDataDiffer = androidx.paging.PagingDataDiffer - -/** @suppress */ -actual typealias DifferCallback = androidx.paging.DifferCallback +actual typealias PagingDataPresenter = androidx.paging.PagingDataPresenter actual typealias DiffingChangePayload = androidx.paging.DiffingChangePayload diff --git a/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt b/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt similarity index 88% rename from paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt rename to paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt index c1058ad14a6..b7a82263583 100644 --- a/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt +++ b/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt @@ -17,4 +17,4 @@ package app.cash.paging /** @suppress */ -actual typealias NullPaddedList = androidx.paging.NullPaddedList +actual typealias PlaceholderPaddedList = androidx.paging.PlaceholderPaddedList diff --git a/paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataDiffer.kt b/paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataPresenter.kt similarity index 83% rename from paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataDiffer.kt rename to paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataPresenter.kt index e34a0d61296..c52fc946243 100644 --- a/paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataDiffer.kt +++ b/paging-common/src/commonMain/kotlin/app/cash/paging/PagingDataPresenter.kt @@ -21,8 +21,7 @@ import kotlinx.coroutines.flow.StateFlow import kotlin.coroutines.CoroutineContext /** @suppress */ -expect abstract class PagingDataDiffer( - differCallback: DifferCallback, +expect abstract class PagingDataPresenter( /* default = Dispatchers.Main */ mainContext: CoroutineContext, /* default = null */ @@ -30,8 +29,8 @@ expect abstract class PagingDataDiffer( ) { abstract suspend fun presentNewList( - previousList: NullPaddedList, - newList: NullPaddedList, + previousList: PlaceholderPaddedList, + newList: PlaceholderPaddedList, lastAccessedIndex: Int, onListPresentable: () -> Unit, ): Int? @@ -65,13 +64,6 @@ expect abstract class PagingDataDiffer( fun removeLoadStateListener(listener: (CombinedLoadStates) -> Unit) } -/** @suppress */ -expect interface DifferCallback { - fun onChanged(position: Int, count: Int) - fun onInserted(position: Int, count: Int) - fun onRemoved(position: Int, count: Int) -} - expect enum class DiffingChangePayload { ITEM_TO_PLACEHOLDER, PLACEHOLDER_TO_ITEM, diff --git a/paging-common/src/commonMain/kotlin/app/cash/paging/NullPaddedList.kt b/paging-common/src/commonMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt similarity index 87% rename from paging-common/src/commonMain/kotlin/app/cash/paging/NullPaddedList.kt rename to paging-common/src/commonMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt index 33299239074..36b4546758c 100644 --- a/paging-common/src/commonMain/kotlin/app/cash/paging/NullPaddedList.kt +++ b/paging-common/src/commonMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt @@ -17,10 +17,10 @@ package app.cash.paging /** @suppress */ -expect interface NullPaddedList { +expect interface PlaceholderPaddedList { val placeholdersBefore: Int - fun getFromStorage(localIndex: Int): T val placeholdersAfter: Int val size: Int - val storageCount: Int + val dataCount: Int + fun getItem(index: Int): T } diff --git a/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt b/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt similarity index 84% rename from paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt rename to paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt index 37eb61586b6..76db4695562 100644 --- a/paging-common/src/commonAndroidXMain/kotlin/app/cash/paging/PagingDataDiffer.kt +++ b/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PagingDataPresenter.kt @@ -19,9 +19,6 @@ package app.cash.paging /** @suppress */ // Constructor has default argument values. @Suppress("NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS") -actual typealias PagingDataDiffer = androidx.paging.PagingDataDiffer - -/** @suppress */ -actual typealias DifferCallback = androidx.paging.DifferCallback +actual typealias PagingDataPresenter = androidx.paging.PagingDataPresenter actual typealias DiffingChangePayload = androidx.paging.DiffingChangePayload diff --git a/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt b/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt similarity index 88% rename from paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt rename to paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt index c1058ad14a6..b7a82263583 100644 --- a/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/NullPaddedList.kt +++ b/paging-common/src/commonNonAndroidXMain/kotlin/app/cash/paging/PlaceholderPaddedList.kt @@ -17,4 +17,4 @@ package app.cash.paging /** @suppress */ -actual typealias NullPaddedList = androidx.paging.NullPaddedList +actual typealias PlaceholderPaddedList = androidx.paging.PlaceholderPaddedList diff --git a/upstreams/androidx-main b/upstreams/androidx-main index 9cb4b0abdc4..616490fe032 160000 --- a/upstreams/androidx-main +++ b/upstreams/androidx-main @@ -1 +1 @@ -Subproject commit 9cb4b0abdc4a6aae1d9b633199e299d9ed9bd9ba +Subproject commit 616490fe03253dd0a91bebd6b43b94f851d4a224