diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt
index e78513982..a2787f895 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt
@@ -298,7 +298,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun deleteDirectoryIfEmpty() {
val file = File(mPath)
- if (!file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
+ if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
file.delete()
}
}
@@ -497,6 +497,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
if (!it) {
toast(R.string.unknown_error_occurred)
} else if (mMedia.isEmpty()) {
+ deleteDirectoryIfEmpty()
finish()
}
}
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 0e8368634..040222a7b 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
@@ -41,9 +41,10 @@ class SettingsActivity : SimpleActivity() {
setupDarkBackground()
setupScrollHorizontally()
setupScreenRotation()
+ setupHideSystemUI()
setupReplaceShare()
setupPasswordProtection()
- setupHideSystemUI()
+ setupDeleteEmptyFolders()
updateTextColors(settings_holder)
}
@@ -173,6 +174,14 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupDeleteEmptyFolders() {
+ settings_delete_empty_folders.isChecked = config.deleteEmptyFolders
+ settings_delete_empty_folders_holder.setOnClickListener {
+ settings_delete_empty_folders.toggle()
+ config.deleteEmptyFolders = settings_delete_empty_folders.isChecked
+ }
+ }
+
private fun setupScreenRotation() {
settings_screen_rotation.text = getScreenRotationText()
settings_screen_rotation_holder.setOnClickListener {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
index 8b9133240..a7c435468 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
@@ -626,7 +626,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun deleteDirectoryIfEmpty() {
val file = File(mDirectory)
- if (!file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
+ if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
file.delete()
}
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 709086913..58671c861 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
@@ -237,6 +237,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false)
set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply()
+ var deleteEmptyFolders: Boolean
+ get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, true)
+ set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply()
+
var slideshowInterval: Int
get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL)
set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).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 475c915d0..e402e7b53 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
@@ -34,6 +34,7 @@ val ALBUM_COVERS = "album_covers"
val SCROLL_HORIZONTALLY = "scroll_horizontally"
val HIDE_SYSTEM_UI = "hide_system_ui"
val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
+val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
// slideshow
val SLIDESHOW_INTERVAL = "slideshow_interval"
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index db2c3fb3b..3eb8673df 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -288,6 +288,26 @@
+
+
+
+
+
+
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml
index 59096e4dd..4bc4b8b14 100644
--- a/app/src/main/res/values-cs/strings.xml
+++ b/app/src/main/res/values-cs/strings.xml
@@ -115,6 +115,7 @@
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index b2283cc77..33d812529 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -115,6 +115,7 @@
Schwarzer Hintergrund im Vollbild
Kacheln horizontal scrollen
Systemleisten ausblenden im Vollbild
+ Delete empty folders after deleting their content
Teilen/Drehen im Vollbild-Menü vertauschen
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index ff7f16ab3..d22244878 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -115,6 +115,7 @@
Utilizar siempre fondo oscuro en pantalla completa
Desplazar miniaturas horizontalmente
Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa
+ Delete empty folders after deleting their content
Reemplazar Compartir con Girar en el menú de pantalla completa
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index e6a9920c5..6c5b2f717 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -115,12 +115,21 @@
Dark background at fullscreen media
Défilement des mignatures horizontalement
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
Un album pour visionner photos et vidéos sans publicité.
- Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre. Cette application est juste l\'une des applications d\'une plus grande suite. Vous pouvez trouver les autres sur http://www.simplemobiletools.com
+
+ Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien.
+
+ L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre.
+
+ Cette application est juste l\'une des applications d\'une plus grande suite.
+
+ Vous pouvez trouver les autres sur http://www.simplemobiletools.com
+
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index dca88c2e0..504074c43 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -115,6 +115,7 @@
Sfondo scuro a schermo intero
Scorri miniature orizzontalmente
Nascondi UI di sistema con media a schermo intero
+ Delete empty folders after deleting their content
Sostituisci Condividi con Ruota a schermo intero
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 673e9ac42..edcde8db9 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -115,6 +115,7 @@
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 61bf33160..2f8cd067d 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -115,6 +115,7 @@
Czarne tło przy podglądzie pełnoekranowym
Przewijaj miniatury poziomo
Ukrywaj interfejs przy pełnoekranowym podglądzie
+ Delete empty folders after deleting their content
Zamień funkcję udostępniania na obracanie w menu pełnoekranowym
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 11a1c03d6..88d4621e9 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -115,6 +115,7 @@
Fundo de tela escuro em mídia tela cheia
Rolar miniaturas horizontalmente
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml
index 2acddd5b7..4e94ab418 100644
--- a/app/src/main/res/values-pt/strings.xml
+++ b/app/src/main/res/values-pt/strings.xml
@@ -115,6 +115,7 @@
Usar sempre um fundo escuro se em ecrã completo
Deslocação horizontal de miniaturas
Ocultar interface do sistema se em ecrã completo
+ Delete empty folders after deleting their content
Substituir a opção Partilhar pela opção Rodar se em ecrã completo
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 34aef359a..04444d31f 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -115,6 +115,7 @@
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml
index deb90488c..7722991ea 100644
--- a/app/src/main/res/values-sk/strings.xml
+++ b/app/src/main/res/values-sk/strings.xml
@@ -115,6 +115,7 @@
Tmavé pozadie pri médiách na celú obrazovku
Prehliadať miniatúry vodorovne
Automaticky skrývať systémové lišty pri celoobrazovkových médiách
+ Odstrániť prázdne priečinky po vymazaní ich obsahu
Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
index c99a203bd..95533a57e 100644
--- a/app/src/main/res/values-sv/strings.xml
+++ b/app/src/main/res/values-sv/strings.xml
@@ -115,6 +115,7 @@
Mörk bakgrund när media visas i helskärmsläge
Rulla horisontellt genom miniatyrer
Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index 7403747d2..30bf6bd81 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -115,6 +115,7 @@
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 78fed273a..2d544fb09 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -115,6 +115,7 @@
全屏时黑色背景
水平滚动缩略图
全屏时自动隐藏状态栏
+ Delete empty folders after deleting their content
替换全屏时菜单栏的“分享”为“旋转”
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index ca9c2b7ee..98c5e913e 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -115,6 +115,7 @@
全螢幕時黑背景
橫向滑動縮圖
全螢幕時自動隱藏系統介面
+ Delete empty folders after deleting their content
將全螢幕選單的分享取代為旋轉
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 731313068..ba76c736d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -115,6 +115,7 @@
Dark background at fullscreen media
Scroll thumbnails horizontally
Automatically hide system UI at fullscreen media
+ Delete empty folders after deleting their content
Replace Share with Rotate at fullscreen menu