Commit c7c89643 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Simplifies function.

parent 046b7942
......@@ -3,17 +3,9 @@ package chat.rocket.android.util.extensions
import android.graphics.Bitmap
fun Bitmap.getCompressFormat(mimeType: String): Bitmap.CompressFormat {
var compressFormat = Bitmap.CompressFormat.PNG
when {
mimeType.contains("jpeg") -> {
compressFormat = Bitmap.CompressFormat.JPEG
}
mimeType.contains("png") -> {
compressFormat = Bitmap.CompressFormat.PNG
}
mimeType.contains("webp") -> {
compressFormat = Bitmap.CompressFormat.WEBP
}
return when {
mimeType.contains("jpeg") -> Bitmap.CompressFormat.JPEG
mimeType.contains("webp") -> Bitmap.CompressFormat.WEBP
else -> Bitmap.CompressFormat.PNG
}
return compressFormat
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment