File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/ktx Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org.schabi.newpipe.ktx
22
3- import android.os.Build
43import android.os.Bundle
54import android.os.Parcelable
65import androidx.core.os.BundleCompat
7- import java.io.Serializable
8- import kotlin.reflect.safeCast
96
107inline fun <reified T : Parcelable > Bundle.parcelableArrayList (key : String? ): ArrayList <T >? {
118 return BundleCompat .getParcelableArrayList(this , key, T ::class .java)
129}
13-
14- inline fun <reified T : Serializable > Bundle.serializable (key : String? ): T ? {
15- return getSerializable(this , key, T ::class .java)
16- }
17-
18- fun <T : Serializable > getSerializable (bundle : Bundle , key : String? , clazz : Class <T >): T ? {
19- return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .UPSIDE_DOWN_CAKE ) {
20- bundle.getSerializable(key, clazz)
21- } else {
22- @Suppress(" DEPRECATION" )
23- clazz.kotlin.safeCast(bundle.getSerializable(key))
24- }
25- }
You can’t perform that action at this time.
0 commit comments