use a mimetype */* if every previous way failed

This commit is contained in:
tibbi 2017-11-19 18:34:57 +01:00
parent 67cd9d79d5
commit a51539eedf
2 changed files with 6 additions and 2 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '2.41.1'
propVersionName = '2.41.2'
kotlin_version = '1.1.60'
support_libs = '27.0.1'
}

View file

@ -210,7 +210,11 @@ fun Activity.getUriMimeType(oldUri: Uri, newUri: Uri): String {
}
fun Activity.tryGenericMimeType(intent: Intent, mimeType: String, uri: Uri): Boolean {
val genericMimeType = mimeType.getGenericMimeType()
var genericMimeType = mimeType.getGenericMimeType()
if (genericMimeType.isEmpty()) {
genericMimeType = "*/*"
}
intent.setDataAndType(uri, genericMimeType)
return if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)