mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
fix #341, add a switch for not deleting empty folders
This commit is contained in:
parent
bc281dd102
commit
9fe361ea62
24 changed files with 65 additions and 4 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -288,6 +288,26 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_delete_empty_folders_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_delete_empty_folders"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/delete_empty_folders"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_screen_rotation_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Schwarzer Hintergrund im Vollbild</string>
|
||||
<string name="scroll_thumbnails_horizontally">Kacheln horizontal scrollen</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Systemleisten ausblenden im Vollbild</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Teilen/Drehen im Vollbild-Menü vertauschen</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Utilizar siempre fondo oscuro en pantalla completa</string>
|
||||
<string name="scroll_thumbnails_horizontally">Desplazar miniaturas horizontalmente</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Reemplazar Compartir con Girar en el menú de pantalla completa</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,12 +115,21 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Défilement des mignatures horizontalement</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">Un album pour visionner photos et vidéos sans publicité.</string>
|
||||
<string name="app_long_description">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</string>
|
||||
<string name="app_long_description">
|
||||
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
|
||||
</string>
|
||||
|
||||
<!--
|
||||
Haven't found some strings? There's more at
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Sfondo scuro a schermo intero</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scorri miniature orizzontalmente</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Nascondi UI di sistema con media a schermo intero</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Sostituisci Condividi con Ruota a schermo intero</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Czarne tło przy podglądzie pełnoekranowym</string>
|
||||
<string name="scroll_thumbnails_horizontally">Przewijaj miniatury poziomo</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Ukrywaj interfejs przy pełnoekranowym podglądzie</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Zamień funkcję udostępniania na obracanie w menu pełnoekranowym</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Fundo de tela escuro em mídia tela cheia</string>
|
||||
<string name="scroll_thumbnails_horizontally">Rolar miniaturas horizontalmente</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Usar sempre um fundo escuro se em ecrã completo</string>
|
||||
<string name="scroll_thumbnails_horizontally">Deslocação horizontal de miniaturas</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Ocultar interface do sistema se em ecrã completo</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Substituir a opção Partilhar pela opção Rodar se em ecrã completo</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Tmavé pozadie pri médiách na celú obrazovku</string>
|
||||
<string name="scroll_thumbnails_horizontally">Prehliadať miniatúry vodorovne</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automaticky skrývať systémové lišty pri celoobrazovkových médiách</string>
|
||||
<string name="delete_empty_folders">Odstrániť prázdne priečinky po vymazaní ich obsahu</string>
|
||||
<string name="replace_share_with_rotate">Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Mörk bakgrund när media visas i helskärmsläge</string>
|
||||
<string name="scroll_thumbnails_horizontally">Rulla horisontellt genom miniatyrer</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">全屏时黑色背景</string>
|
||||
<string name="scroll_thumbnails_horizontally">水平滚动缩略图</string>
|
||||
<string name="hide_system_ui_at_fullscreen">全屏时自动隐藏状态栏</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">替换全屏时菜单栏的“分享”为“旋转”</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">全螢幕時黑背景</string>
|
||||
<string name="scroll_thumbnails_horizontally">橫向滑動縮圖</string>
|
||||
<string name="hide_system_ui_at_fullscreen">全螢幕時自動隱藏系統介面</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">將全螢幕選單的分享取代為旋轉</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<string name="dark_background_at_fullscreen">Dark background at fullscreen media</string>
|
||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
|
|
Loading…
Reference in a new issue