From b2f54f0e6e0118b8ac325ed1af382c0e79df39a6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 19:58:44 +0100 Subject: [PATCH] add an optional extra check to avoid showing invalid files --- .../gallery/activities/SettingsActivity.kt | 9 ++++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + .../gallery/helpers/MediaFetcher.kt | 3 ++- app/src/main/res/layout/activity_settings.xml | 22 ++++++++++++++++++- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 3 ++- app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 30 files changed, 63 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index ce0ad5fe4..4d16a3980 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -38,6 +38,7 @@ class SettingsActivity : SimpleActivity() { setupManageExcludedFolders() setupManageHiddenFolders() setupShowHiddenItems() + setupDoExtraCheck() setupAutoplayVideos() setupLoopVideos() setupAnimateGifs() @@ -136,6 +137,14 @@ class SettingsActivity : SimpleActivity() { config.showHiddenMedia = settings_show_hidden_items.isChecked } + private fun setupDoExtraCheck() { + settings_do_extra_check.isChecked = config.doExtraCheck + settings_do_extra_check_holder.setOnClickListener { + settings_do_extra_check.toggle() + config.doExtraCheck = settings_do_extra_check.isChecked + } + } + private fun setupAutoplayVideos() { settings_autoplay_videos.isChecked = config.autoplayVideos settings_autoplay_videos_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 39c26d6d4..683c9ea8d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -320,4 +320,8 @@ class Config(context: Context) : BaseConfig(context) { var extendedDetails: Int get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES) set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply() + + var doExtraCheck: Boolean + get() = prefs.getBoolean(DO_EXTRA_CHECK, false) + set(doExtraCheck) = prefs.edit().putBoolean(DO_EXTRA_CHECK, doExtraCheck).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 70cd2c7b1..156bbf6b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -47,6 +47,7 @@ const val HIDE_EXTENDED_DETAILS = "hide_extended_details" const val ONE_FINGER_ZOOM = "one_finger_zoom" const val ALLOW_INSTANT_CHANGE = "allow_instant_change" const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images" +const val DO_EXTRA_CHECK = "do_extra_check" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index f941b8f03..a329f3ced 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -99,6 +99,7 @@ class MediaFetcher(val context: Context) { val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden val isThirdPartyIntent = config.isThirdPartyIntent + val doExtraCheck = config.doExtraCheck cur.use { if (cur.moveToFirst()) { @@ -137,7 +138,7 @@ class MediaFetcher(val context: Context) { size = file.length() } - if (size <= 0L) + if (size <= 0L || (doExtraCheck && !file.exists())) continue val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1640769a8..cda8cc378 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -166,6 +166,26 @@ + + + + + + - + Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index ee0086c84..f8bca8034 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -135,7 +135,8 @@ Permet fer zoom amb un sol dit a pantalla complerta Permet canviar els mitjans de manera instantània fent clic als costats de la pantalla Substituïr imatges ampliades per les de millor quialitat - Amaga els detalls estesos quan la barra d'estat està amagada + Amaga els detalls estesos quan la barra d\'estat està amagada + Do an extra check to avoid showing invalid files Miniatures diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 68b5670e5..16b76fe49 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 82bd32fa5..0adbc4116 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -136,6 +136,7 @@ Beim Tippen auf eine Bildschirmseite sofort zwischen Medien wechseln Stark zoombare Bilder durch Bilder mit hoher Qualität ersetzen Erweiterte Details nicht anzeigen, wenn die Systemleiste versteckt ist + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e1f5c0ba7..cd4a1bcc2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -136,6 +136,7 @@ Permitir el cambio instantáneo de medios haciendo clic en los lados de la pantalla Reemplace las imágenes con mucho zoom por otras de mejor calidad Ocultar detalles ampliados cuando la barra de estado está oculta + Do an extra check to avoid showing invalid files Miniaturas diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 130af2791..5db309a6c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3934f7ed8..b24e55cf8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index fe5afac60..ae64e382a 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 8c5e71f42..36fb734fb 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 51eddf77e..f6ee30b59 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d94202120..c294d5ca2 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -136,6 +136,7 @@ Cambia media istantaneamente toccando sui lati dello schermo Sostituisci le immagini ingrandibili a fondo con altre di migliore qualità Nascondi i dettagli estesi quando la barra di stato è nascosta + Do an extra check to avoid showing invalid files Miniature diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 697f54752..540a8f242 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index d674a574e..813ff8565 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 7de6994ab..be3397d38 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -136,6 +136,7 @@ Tillat å skifte media øyeblikkelig ved å trykke på kanten av skjermen Erstatt dyp-zoombare bilder med bilder av bedre kvalitet Skjul utvidede detaljer når statuslinjen er skjult + Do an extra check to avoid showing invalid files Minibilder diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a8a41ead3..b966fa1f6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -136,6 +136,7 @@ Direct naar vorige/volgende door op de zijkanten van het scherm te tikken In hoge kwaliteit weergeven (ten koste van ver inzoomen) Uitgebreide informatie niet tonen als de statusbalk is verborgen + Do an extra check to avoid showing invalid files Miniatuurvoorbeelden diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a415e38c7..1ba92b71f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -136,6 +136,7 @@    Zezwalaj na natychmiastową zmianę multimediów po kliknięciu boków ekranu    Zamieniaj powiększalne obrazy na te o lepszej jakości    Ukrywaj dodatkowe szczegóły gdy pasek stanu jest ukryty + Do an extra check to avoid showing invalid files    Miniatury diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 142ab825f..9c14638a8 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -136,6 +136,7 @@ Permitir alternância instantânia de mídia clicando nas laterais da tela Substituir imagens aptas a grande quantitade de zoom por imagens de melhor qualidade Ocultar detalhes extendidos quando a barra de status estiver oculta + Do an extra check to avoid showing invalid files Miniaturas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4d8fe5e46..0cd30703d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9d1a86a1f..524853538 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -136,6 +136,7 @@ Мгновенное переключение медиафайлов нажатием по краю экрана Заменить масштабируемые изображения высококачественными Не показывать подробности, если скрыта строка состояния + Do an extra check to avoid showing invalid files Миниатюры diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 102e6c1b3..21dd19109 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -136,6 +136,7 @@ Povoliť instantné prepínanie médií kliknutím na okraj obrazovky Nahradiť hlboko priblížiteľné obrázky s obrázkami s lepšou kvalitou Skryť rozšírené vlastnosti ak je skrytá stavová lišta + Predísť zobrazovaniu neplatných súborov dodatočnou kontrolou Náhľady diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index cff13c4cd..b65c23c2d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 4b3df55a3..834639abb 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e18df60de..a547bf642 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -136,6 +136,7 @@ 通过单击屏幕边缘来切换媒体 用质量更好的图像替换可深度缩放的图像 当状态栏隐藏时隐藏扩展详情 + Do an extra check to avoid showing invalid files 缩略图 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 89272de76..bbb972443 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -136,6 +136,7 @@ 允許點擊螢幕邊緣來快速切換媒體檔案 可深度縮放的圖片用品質更佳的來取代 狀態欄隱藏時,同時隱藏詳細資訊 + Do an extra check to avoid showing invalid files 縮圖 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9259c090e..abf2cb0ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails