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 {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 19

View File

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