Skip to content

Commit

Permalink
Rm unused declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Aug 17, 2024
1 parent e082bca commit 294b9cf
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions app/src/main/java/org/schabi/newpipe/ktx/Bundle.kt
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
package org.schabi.newpipe.ktx

import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import androidx.core.os.BundleCompat
import java.io.Serializable
import kotlin.reflect.safeCast

inline fun <reified T : Parcelable> Bundle.parcelableArrayList(key: String?): ArrayList<T>? {
return BundleCompat.getParcelableArrayList(this, key, T::class.java)
}

inline fun <reified T : Serializable> Bundle.serializable(key: String?): T? {
return getSerializable(this, key, T::class.java)
}

fun <T : Serializable> getSerializable(bundle: Bundle, key: String?, clazz: Class<T>): T? {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
bundle.getSerializable(key, clazz)
} else {
@Suppress("DEPRECATION")
clazz.kotlin.safeCast(bundle.getSerializable(key))
}
}

0 comments on commit 294b9cf

Please sign in to comment.