Loading build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.2.1' propVersionName = '4.2.2' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt +2 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.simplemobiletools.commons.extensions import android.content.Context import com.simplemobiletools.commons.helpers.audioExtensions import com.simplemobiletools.commons.helpers.photoExtensions import com.simplemobiletools.commons.helpers.rawExtensions import com.simplemobiletools.commons.helpers.videoExtensions import com.simplemobiletools.commons.models.FileDirItem import java.io.File Loading @@ -12,6 +13,7 @@ fun File.isGif() = absolutePath.endsWith(".gif", true) fun File.isVideoFast() = videoExtensions.any { absolutePath.endsWith(it, true) } 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.isImageSlow() = absolutePath.isImageFast() || getMimeType().startsWith("image") fun File.isVideoSlow() = absolutePath.isVideoFast() || getMimeType().startsWith("video") Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/String.kt +3 −5 Original line number Diff line number Diff line Loading @@ -9,10 +9,7 @@ import android.media.MediaMetadataRetriever import android.text.Spannable import android.text.SpannableString import android.text.style.ForegroundColorSpan import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.audioExtensions import com.simplemobiletools.commons.helpers.photoExtensions import com.simplemobiletools.commons.helpers.videoExtensions import com.simplemobiletools.commons.helpers.* import java.text.SimpleDateFormat import java.util.* Loading Loading @@ -49,13 +46,14 @@ fun String.isPng() = endsWith(".png", true) fun String.isJpg() = endsWith(".jpg", true) or endsWith(".jpeg") fun String.isDng() = endsWith(".dng", true) fun String.isRaw() = endsWith(".dng", true) // fast extension checks, not guaranteed to be accurate fun String.isVideoFast() = videoExtensions.any { endsWith(it, true) } 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") fun String.isVideoSlow() = isVideoFast() || getMimeType().startsWith("video") Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +2 −1 Original line number Diff line number Diff line Loading @@ -173,9 +173,10 @@ const val EVERY_DAY_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY const val WEEK_DAYS_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY_BIT or FRIDAY_BIT const val WEEKENDS_BIT = SATURDAY_BIT or SUNDAY_BIT val photoExtensions: Array<String> get() = arrayOf(".jpg", ".png", ".jpeg", ".bmp", ".webp", ".dng", ".orf") val photoExtensions: Array<String> get() = arrayOf(".jpg", ".png", ".jpeg", ".bmp", ".webp") val videoExtensions: Array<String> get() = arrayOf(".mp4", ".mkv", ".webm", ".avi", ".3gp", ".mov", ".m4v", ".3gpp") val audioExtensions: Array<String> get() = arrayOf(".mp3", ".wav", ".wma", ".ogg", ".m4a", ".opus", ".flac") val rawExtensions: Array<String> get() = arrayOf(".dng", ".orf") val appIconColorStrings = arrayListOf( ".Red", Loading Loading
build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '4.2.1' propVersionName = '4.2.2' kotlin_version = '1.2.50' support_libs = '27.1.1' } Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt +2 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package com.simplemobiletools.commons.extensions import android.content.Context import com.simplemobiletools.commons.helpers.audioExtensions import com.simplemobiletools.commons.helpers.photoExtensions import com.simplemobiletools.commons.helpers.rawExtensions import com.simplemobiletools.commons.helpers.videoExtensions import com.simplemobiletools.commons.models.FileDirItem import java.io.File Loading @@ -12,6 +13,7 @@ fun File.isGif() = absolutePath.endsWith(".gif", true) fun File.isVideoFast() = videoExtensions.any { absolutePath.endsWith(it, true) } 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.isImageSlow() = absolutePath.isImageFast() || getMimeType().startsWith("image") fun File.isVideoSlow() = absolutePath.isVideoFast() || getMimeType().startsWith("video") Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/String.kt +3 −5 Original line number Diff line number Diff line Loading @@ -9,10 +9,7 @@ import android.media.MediaMetadataRetriever import android.text.Spannable import android.text.SpannableString import android.text.style.ForegroundColorSpan import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.audioExtensions import com.simplemobiletools.commons.helpers.photoExtensions import com.simplemobiletools.commons.helpers.videoExtensions import com.simplemobiletools.commons.helpers.* import java.text.SimpleDateFormat import java.util.* Loading Loading @@ -49,13 +46,14 @@ fun String.isPng() = endsWith(".png", true) fun String.isJpg() = endsWith(".jpg", true) or endsWith(".jpeg") fun String.isDng() = endsWith(".dng", true) fun String.isRaw() = endsWith(".dng", true) // fast extension checks, not guaranteed to be accurate fun String.isVideoFast() = videoExtensions.any { endsWith(it, true) } 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") fun String.isVideoSlow() = isVideoFast() || getMimeType().startsWith("video") Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +2 −1 Original line number Diff line number Diff line Loading @@ -173,9 +173,10 @@ const val EVERY_DAY_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY const val WEEK_DAYS_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY_BIT or FRIDAY_BIT const val WEEKENDS_BIT = SATURDAY_BIT or SUNDAY_BIT val photoExtensions: Array<String> get() = arrayOf(".jpg", ".png", ".jpeg", ".bmp", ".webp", ".dng", ".orf") val photoExtensions: Array<String> get() = arrayOf(".jpg", ".png", ".jpeg", ".bmp", ".webp") val videoExtensions: Array<String> get() = arrayOf(".mp4", ".mkv", ".webm", ".avi", ".3gp", ".mov", ".m4v", ".3gpp") val audioExtensions: Array<String> get() = arrayOf(".mp3", ".wav", ".wma", ".ogg", ".m4a", ".opus", ".flac") val rawExtensions: Array<String> get() = arrayOf(".dng", ".orf") val appIconColorStrings = arrayListOf( ".Red", Loading