shorten number of return statements

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-08-09 22:49:34 +02:00
parent 501b75309b
commit 11463ea55f
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -148,33 +148,23 @@ object DrawableUtils {
drawableMap["unknown"] = R.drawable.ic_mimetype_file drawableMap["unknown"] = R.drawable.ic_mimetype_file
drawableMap["application/pdf"] = R.drawable.ic_mimetype_application_pdf drawableMap["application/pdf"] = R.drawable.ic_mimetype_application_pdf
if (localMimetype.isNullOrEmpty()) { return if (localMimetype.isNullOrEmpty()) {
return drawableMap["unknown"]!! drawableMap["unknown"]!!
} } else if ("DIR" == localMimetype) {
if ("DIR" == localMimetype) {
localMimetype = FOLDER localMimetype = FOLDER
return drawableMap[localMimetype]!! drawableMap[localMimetype]!!
} } else if (drawableMap.containsKey(localMimetype)) {
drawableMap[localMimetype]!!
if (drawableMap.containsKey(localMimetype)) { } else if (localMimetype.startsWith(IMAGE_PREFIX)) {
return drawableMap[localMimetype]!! R.drawable.ic_mimetype_image
} } else if (localMimetype.startsWith(VIDEO_PREFIX)) {
R.drawable.ic_mimetype_video
if (localMimetype.startsWith(IMAGE_PREFIX)) { } else if (localMimetype.startsWith(TEXT_PREFIX)) {
return R.drawable.ic_mimetype_image R.drawable.ic_mimetype_text
} } else if (localMimetype.startsWith(AUDIO_PREFIX)) {
if (localMimetype.startsWith(VIDEO_PREFIX)) {
return R.drawable.ic_mimetype_video
}
if (localMimetype.startsWith(TEXT_PREFIX)) {
return R.drawable.ic_mimetype_text
}
return if (localMimetype.startsWith(AUDIO_PREFIX)) {
R.drawable.ic_mimetype_audio R.drawable.ic_mimetype_audio
} else drawableMap["unknown"]!! } else {
drawableMap["unknown"]!!
}
} }
} }