Workaround #1065
This commit is contained in:
1 parent
7a20d7ca49
commit
576ff1b007
1 file changed
+12
-5
@@ -1,11 +1,18 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.hippo.util
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import androidx.core.content.IntentCompat
|
||||
import androidx.core.os.BundleCompat
|
||||
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableCompat(key: String?): T? = BundleCompat.getParcelable(this, key, T::class.java)
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableArrayListCompat(key: String?): ArrayList<T>? = BundleCompat.getParcelableArrayList(this, key, T::class.java)
|
||||
inline fun <reified T : Parcelable> Intent.getParcelableExtraCompat(key: String?): T? = IntentCompat.getParcelableExtra(this, key, T::class.java)
|
||||
// inline fun <reified T : Parcelable> Bundle.getParcelableCompat(key: String?): T? = BundleCompat.getParcelable(this, key, T::class.java)
|
||||
// inline fun <reified T : Parcelable> Bundle.getParcelableArrayListCompat(key: String?): ArrayList<T>? = BundleCompat.getParcelableArrayList(this, key, T::class.java)
|
||||
// inline fun <reified T : Parcelable> Intent.getParcelableExtraCompat(key: String?): T? = IntentCompat.getParcelableExtra(this, key, T::class.java)
|
||||
|
||||
// Avoid using new API on Tiramisu
|
||||
// See https://issuetracker.google.com/issues/240585930 & https://github.com/Ehviewer-Overhauled/Ehviewer/issues/1065
|
||||
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableCompat(key: String?): T? = getParcelable(key)
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableArrayListCompat(key: String?): ArrayList<T>? = getParcelableArrayList(key)
|
||||
inline fun <reified T : Parcelable> Intent.getParcelableExtraCompat(key: String?): T? = getParcelableExtra(key)
|
||||
Reference in new issue
Block a user