Avoid UNCHECKED_CAST.

This commit is contained in:
onurays 2020-03-25 18:20:34 +03:00
parent 5cb47dae35
commit 3c1e1090e7
2 changed files with 5 additions and 5 deletions

View file

@ -20,7 +20,6 @@ apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19

View file

@ -103,10 +103,11 @@ abstract class Picker<T>(open val requestCode: Int) {
selectedUriList.add(dataUri) selectedUriList.add(dataUri)
} else { } else {
data?.extras?.get(Intent.EXTRA_STREAM)?.let { data?.extras?.get(Intent.EXTRA_STREAM)?.let {
@Suppress("UNCHECKED_CAST") (it as? List<*>)?.filterIsInstance<Uri>()?.let { uriList ->
when (it) { selectedUriList.addAll(uriList)
is List<*> -> selectedUriList.addAll(it as List<Uri>) }
else -> selectedUriList.add(it as Uri) if (it is Uri) {
selectedUriList.add(it)
} }
} }
} }