mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-16 07:10:29 +05:30
11 lines
369 B
Kotlin
11 lines
369 B
Kotlin
|
package com.github.libretube.ui.extensions
|
||
|
|
||
|
import android.os.Build
|
||
|
import android.os.Bundle
|
||
|
import java.io.Serializable
|
||
|
|
||
|
inline fun <reified T : Serializable> Bundle.serializable(key: String): T? = when {
|
||
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getSerializable(key, T::class.java)
|
||
|
else -> @Suppress("DEPRECATION") getSerializable(key) as? T
|
||
|
}
|