From ae91cfda72e3c81b688101f99ccd18f610366d8c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 9 Mar 2019 20:17:16 +0100 Subject: [PATCH] exclude facebook stickers by default --- .../gallery/pro/activities/MainActivity.kt | 16 ++++++++++++++++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + 3 files changed, 21 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 7861e16cf..95ab1db88 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -400,10 +400,26 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { }.start() } + private fun checkDefaultSpamFolders() { + if (!config.spamFoldersChecked) { + val spamFolders = arrayListOf( + "/storage/emulated/0/Android/data/com.facebook.orca/files/stickers" + ) + + spamFolders.forEach { + if (File(it).exists()) { + config.addExcludedFolder(it) + } + } + config.spamFoldersChecked = true + } + } + private fun tryLoadGallery() { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { checkOTGPath() + checkDefaultSpamFolders() if (config.showAll) { showAllMedia() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 8720bf3a8..82de77525 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -471,4 +471,8 @@ class Config(context: Context) : BaseConfig(context) { var showNotch: Boolean get() = prefs.getBoolean(SHOW_NOTCH, true) set(showNotch) = prefs.edit().putBoolean(SHOW_NOTCH, showNotch).apply() + + var spamFoldersChecked: Boolean + get() = prefs.getBoolean(SPAM_FOLDERS_CHECKED, false) + set(spamFoldersChecked) = prefs.edit().putBoolean(SPAM_FOLDERS_CHECKED, spamFoldersChecked).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 98eec7dfb..d0f2ee922 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -79,6 +79,7 @@ const val LAST_EDITOR_DRAW_COLOR = "last_editor_draw_color" const val LAST_EDITOR_BRUSH_SIZE = "last_editor_brush_size" const val SHOW_NOTCH = "show_notch" const val FILE_LOADING_PRIORITY = "file_loading_priority" +const val SPAM_FOLDERS_CHECKED = "spam_folders_checked" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval"