File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
utils/src/main/java/ai/elimu/common/utils Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ package ai.elimu.common.utils
2+
3+ import android.os.Build
4+ import android.os.Bundle
5+
6+ fun <T > Bundle?.getParcelableCompat (key : String , clazz : Class <T >): T ? {
7+ return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
8+ this ?.getParcelable(key, clazz)
9+ } else {
10+ @Suppress(" DEPRECATION" )
11+ this ?.getParcelable(key)
12+ }
13+ }
14+
15+ fun <T : android.os.Parcelable > Bundle?.getParcelableArrayListCompat (key : String , clazz : Class <T >)
16+ : java.util.ArrayList <T >? {
17+ return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
18+ this ?.getParcelableArrayList(key, clazz)
19+ } else {
20+ @Suppress(" DEPRECATION" )
21+ this ?.getParcelableArrayList(key)
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments