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

Updated PersistableBundle extensions docs #177

Merged
merged 1 commit into from
Aug 27, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import kotlinx.serialization.SerializationStrategy
* Inserts the provided `kotlinx-serialization` [Serializable][kotlinx.serialization.Serializable] value
* into this [PersistableBundle], replacing any existing value for the given [key].
* Either [key] or [value] may be `null`.
*
* **Note:** unlike [Bundle.putSerializable], due to the specifics of [PersistableBundle] this function
* serializes the [value] eagerly, which may degrade the performance for large payloads.
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun <T : Any> PersistableBundle.putSerializable(key: String?, value: T?, strategy: SerializationStrategy<T>) {
Expand All @@ -31,6 +34,9 @@ fun <T : Any> PersistableBundle.getSerializable(key: String?, strategy: Deserial
/**
* Inserts the provided [SerializableContainer] into this [Bundle],
* replacing any existing value for the given [key]. Either [key] or [value] may be `null`.
*
* **Note:** unlike [Bundle.putSerializableContainer], due to the specifics of [PersistableBundle]
* this function serializes the [value] eagerly, which may degrade the performance for large payloads.
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun PersistableBundle.putSerializableContainer(key: String?, value: SerializableContainer?) {
Expand Down
Loading