move the list of media file extensions out of String extensions
This commit is contained in:
parent
9a95d6906c
commit
848ad3bcd1
4 changed files with 14 additions and 8 deletions
|
@ -6,7 +6,7 @@ buildscript {
|
|||
propMinSdkVersion = 16
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '3.18.13'
|
||||
propVersionName = '3.18.14'
|
||||
kotlin_version = '1.2.31'
|
||||
support_libs = '27.1.0'
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
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.videoExtensions
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import java.io.File
|
||||
|
||||
fun File.isImageVideoGif() = absolutePath.isImageFast() || absolutePath.isVideoFast() || absolutePath.isGif()
|
||||
fun File.isGif() = absolutePath.endsWith(".gif", true)
|
||||
fun File.isVideoFast() = absolutePath.videoExtensions.any { absolutePath.endsWith(it, true) }
|
||||
fun File.isImageFast() = absolutePath.photoExtensions.any { absolutePath.endsWith(it, true) }
|
||||
fun File.isAudioFast() = absolutePath.audioExtensions.any { absolutePath.endsWith(it, 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.isImageSlow() = absolutePath.isImageFast() || getMimeType().startsWith("image")
|
||||
fun File.isVideoSlow() = absolutePath.isVideoFast() || getMimeType().startsWith("video")
|
||||
|
|
|
@ -7,6 +7,9 @@ import android.graphics.Point
|
|||
import android.media.ExifInterface
|
||||
import android.media.MediaMetadataRetriever
|
||||
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 java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
@ -35,10 +38,6 @@ fun String.isAValidFilename(): Boolean {
|
|||
return true
|
||||
}
|
||||
|
||||
val String.photoExtensions: Array<String> get() = arrayOf(".jpg", ".png", ".jpeg", ".bmp", ".webp", ".dng", ".orf")
|
||||
val String.videoExtensions: Array<String> get() = arrayOf(".mp4", ".mkv", ".webm", ".avi", ".3gp", ".mov", ".m4v", ".3gpp")
|
||||
val String.audioExtensions: Array<String> get() = arrayOf(".mp3", ".wav", ".wma", ".ogg", ".m4a", ".opus", ".flac")
|
||||
|
||||
fun String.isImageVideoGif() = isImageFast() || isVideoFast() || isGif()
|
||||
|
||||
fun String.isGif() = endsWith(".gif", true)
|
||||
|
|
|
@ -160,6 +160,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 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")
|
||||
|
||||
fun isOnMainThread() = Looper.myLooper() == Looper.getMainLooper()
|
||||
|
||||
fun isJellyBean1Plus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
|
||||
|
|
Loading…
Reference in a new issue