From 3c1e1090e7fd1e687ab296eba746b46dc3264093 Mon Sep 17 00:00:00 2001 From: onurays Date: Wed, 25 Mar 2020 18:20:34 +0300 Subject: [PATCH] Avoid UNCHECKED_CAST. --- multipicker/build.gradle | 1 - .../src/main/java/im/vector/riotx/multipicker/Picker.kt | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/multipicker/build.gradle b/multipicker/build.gradle index 950e76020f..d8cfeee3c9 100644 --- a/multipicker/build.gradle +++ b/multipicker/build.gradle @@ -20,7 +20,6 @@ apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 - buildToolsVersion "29.0.3" defaultConfig { minSdkVersion 19 diff --git a/multipicker/src/main/java/im/vector/riotx/multipicker/Picker.kt b/multipicker/src/main/java/im/vector/riotx/multipicker/Picker.kt index e05dd50d40..43ac5d5fdd 100644 --- a/multipicker/src/main/java/im/vector/riotx/multipicker/Picker.kt +++ b/multipicker/src/main/java/im/vector/riotx/multipicker/Picker.kt @@ -103,10 +103,11 @@ abstract class Picker(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) - else -> selectedUriList.add(it as Uri) + (it as? List<*>)?.filterIsInstance()?.let { uriList -> + selectedUriList.addAll(uriList) + } + if (it is Uri) { + selectedUriList.add(it) } } }