more code style

This commit is contained in:
Tibor Kaputa 2021-11-15 18:48:26 +01:00 committed by GitHub
parent 15e73af1a9
commit 1d87967588
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,7 @@ fun String.isImageFast() = photoExtensions.any { endsWith(it, true) }
fun String.isAudioFast() = audioExtensions.any { endsWith(it, true) }
fun String.isRawFast() = rawExtensions.any { endsWith(it, true) }
fun String. isImageSlow() = isImageFast() || getMimeType().startsWith("image") || startsWith(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
fun String.isImageSlow() = isImageFast() || getMimeType().startsWith("image") || startsWith(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
fun String.isVideoSlow() = isVideoFast() || getMimeType().startsWith("video") || startsWith(MediaStore.Video.Media.EXTERNAL_CONTENT_URI.toString())
fun String.isAudioSlow() = isAudioFast() || getMimeType().startsWith("audio") || startsWith(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.toString())
@ -105,11 +105,12 @@ fun String.doesThisOrParentHaveNoMedia(folderNoMediaStatuses: HashMap<String, Bo
fun String.getImageResolution(context: Context): Point? {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
if(context.isRestrictedSAFOnlyRoot(this)){
if (context.isRestrictedSAFOnlyRoot(this)) {
BitmapFactory.decodeStream(context.contentResolver.openInputStream(context.getAndroidSAFUri(this)), null, options)
}else{
} else {
BitmapFactory.decodeFile(this, options)
}
val width = options.outWidth
val height = options.outHeight
return if (width > 0 && height > 0) {