From e684c660b58bc3f7aa8a750cec84ea02556446c8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Sep 2019 23:18:40 +0200 Subject: [PATCH] add more handling for Portrait file type --- .../simplemobiletools/gallery/pro/extensions/ArrayList.kt | 4 ++++ .../com/simplemobiletools/gallery/pro/extensions/Context.kt | 6 ++++-- .../com/simplemobiletools/gallery/pro/models/Medium.kt | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ArrayList.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ArrayList.kt index 27289c37f..551b47d61 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ArrayList.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ArrayList.kt @@ -25,5 +25,9 @@ fun ArrayList.getDirMediaTypes(): Int { types += TYPE_SVGS } + if (any { it.isPortrait() }) { + types += TYPE_PORTRAITS + } + return types } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index f5e94bd73..86bd21488 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -584,7 +584,8 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly: (filterMedia and TYPE_VIDEOS != 0 && it.types and TYPE_VIDEOS != 0) || (filterMedia and TYPE_GIFS != 0 && it.types and TYPE_GIFS != 0) || (filterMedia and TYPE_RAWS != 0 && it.types and TYPE_RAWS != 0) || - (filterMedia and TYPE_SVGS != 0 && it.types and TYPE_SVGS != 0) + (filterMedia and TYPE_SVGS != 0 && it.types and TYPE_SVGS != 0) || + (filterMedia and TYPE_PORTRAITS != 0 && it.types and TYPE_PORTRAITS != 0) } }) as ArrayList @@ -640,7 +641,8 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag (filterMedia and TYPE_VIDEOS != 0 && it.type == TYPE_VIDEOS) || (filterMedia and TYPE_GIFS != 0 && it.type == TYPE_GIFS) || (filterMedia and TYPE_RAWS != 0 && it.type == TYPE_RAWS) || - (filterMedia and TYPE_SVGS != 0 && it.type == TYPE_SVGS) + (filterMedia and TYPE_SVGS != 0 && it.type == TYPE_SVGS) || + (filterMedia and TYPE_PORTRAITS != 0 && it.type == TYPE_PORTRAITS) } }) as ArrayList diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt index 6044219d7..04c685229 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt @@ -44,6 +44,8 @@ data class Medium( fun isSVG() = type == TYPE_SVGS + fun isPortrait() = type == TYPE_PORTRAITS + fun isHidden() = name.startsWith('.') fun getBubbleText(sorting: Int, context: Context) = when {