adding a helper function to check if a file is a portrait one

This commit is contained in:
tibbi 2019-09-30 23:33:26 +02:00
parent 9c77897616
commit 3c5f15cc77
3 changed files with 4 additions and 1 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.17.18'
propVersionName = '5.17.19'
kotlin_version = '1.3.50'
}

View file

@ -11,6 +11,7 @@ fun File.isImageFast() = photoExtensions.any { absolutePath.endsWith(it, true) }
fun File.isAudioFast() = audioExtensions.any { absolutePath.endsWith(it, true) }
fun File.isRawFast() = rawExtensions.any { absolutePath.endsWith(it, true) }
fun File.isSvg() = absolutePath.isSvg()
fun File.isPortrait() = absolutePath.isPortrait()
fun File.isImageSlow() = absolutePath.isImageFast() || getMimeType().startsWith("image")
fun File.isVideoSlow() = absolutePath.isVideoFast() || getMimeType().startsWith("video")

View file

@ -49,6 +49,8 @@ fun String.isJpg() = endsWith(".jpg", true) or endsWith(".jpeg", true)
fun String.isSvg() = endsWith(".svg", true)
fun String.isPortrait() = getFilenameFromPath().contains("portrait", true) && File(this).parentFile?.name?.startsWith("img_", true) == true
// fast extension checks, not guaranteed to be accurate
fun String.isVideoFast() = videoExtensions.any { endsWith(it, true) }