For #15320: Ensure Mimetype Other PDF Shows PDF Icon

pull/159/head^2
Kate Glazko 4 years ago committed by kglazko
parent 1adf467248
commit e8855c09e6

@ -14,6 +14,7 @@ fun DownloadItem.getIcon(): Int {
return when {
fileName?.endsWith("apk") == true -> R.drawable.ic_file_type_apk
fileName?.endsWith("zip") == true -> R.drawable.ic_file_type_zip
fileName?.endsWith("pdf") == true -> R.drawable.ic_file_type_document
else -> R.drawable.ic_file_type_default
}
}

@ -23,6 +23,7 @@ class DownloadItemKtTest {
assertEquals(R.drawable.ic_file_type_zip, downloadItem.copy(contentType = "application/gzip").getIcon())
assertEquals(R.drawable.ic_file_type_apk, downloadItem.copy(contentType = null, fileName = "Fenix.apk").getIcon())
assertEquals(R.drawable.ic_file_type_zip, downloadItem.copy(contentType = null, fileName = "Fenix.zip").getIcon())
assertEquals(R.drawable.ic_file_type_document, downloadItem.copy(contentType = null, fileName = "Fenix.pdf").getIcon())
assertEquals(R.drawable.ic_file_type_default, downloadItem.copy(contentType = null, fileName = null).getIcon())
}
}

Loading…
Cancel
Save