From 6c11d71a9d044db8c533e0832298c3b58cbcb1bf Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 26 Feb 2017 21:31:52 +0100 Subject: [PATCH] add a menu item for removing all excluded folders --- .../activities/ExcludedFoldersActivity.kt | 28 +++++++++++++++++-- .../gallery/activities/MediaActivity.kt | 1 - .../gallery/helpers/Config.kt | 4 +++ .../main/res/menu/menu_excluded_folders.xml | 9 ++++++ app/src/main/res/values-ca-rES/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-es-rES/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-gl-rES/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-ja/strings.xml | 2 ++ app/src/main/res/values-pt-rPT/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sk/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-tr/strings.xml | 2 ++ app/src/main/res/values-zh-rCN/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 19 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/menu/menu_excluded_folders.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt index c7fc0de3e..315745271 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt @@ -1,6 +1,9 @@ package com.simplemobiletools.gallery.activities import android.os.Bundle +import android.view.Menu +import android.view.MenuItem +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config @@ -11,10 +14,10 @@ class ExcludedFoldersActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_excluded_folders) - addExcludedFolders() + updateExcludedFolders() } - private fun addExcludedFolders() { + private fun updateExcludedFolders() { excluded_folders_holder.removeAllViews() val folders = config.excludedFolders for (folder in folders) { @@ -22,11 +25,30 @@ class ExcludedFoldersActivity : SimpleActivity() { excluded_folder_title.text = folder excluded_folders_icon.setOnClickListener { config.removeExcludedFolder(folder) - addExcludedFolders() + updateExcludedFolders() } excluded_folders_holder.addView(this) } } updateTextColors(excluded_folders_holder) } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.menu_excluded_folders, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.remove_all -> removeAllExcludedFolders() + } + return true + } + + private fun removeAllExcludedFolders() { + ConfirmationDialog(this, getString(R.string.remove_all_description)) { + config.removeAllExcludedFolders() + updateExcludedFolders() + } + } } 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 6d9fcf2ee..2dcf02033 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -125,7 +125,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { R.id.reduce_column_count -> reduceColumnCount() R.id.settings -> launchSettings() R.id.about -> launchAbout() - else -> return super.onOptionsItemSelected(item) } return true } 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 03dc06179..6707292a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -70,6 +70,10 @@ class Config(context: Context) : BaseConfig(context) { excludedFolders = currExcludedFolders } + fun removeAllExcludedFolders() { + prefs.edit().remove(EXCLUDED_FOLDERS).apply() + } + var excludedFolders: MutableSet get() = prefs.getStringSet(EXCLUDED_FOLDERS, HashSet()) set(excludedFolders) = prefs.edit().remove(EXCLUDED_FOLDERS).putStringSet(EXCLUDED_FOLDERS, excludedFolders).apply() diff --git a/app/src/main/res/menu/menu_excluded_folders.xml b/app/src/main/res/menu/menu_excluded_folders.xml new file mode 100644 index 000000000..9cb04d5a9 --- /dev/null +++ b/app/src/main/res/menu/menu_excluded_folders.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/values-ca-rES/strings.xml b/app/src/main/res/values-ca-rES/strings.xml index 5957d6065..f8dfbfc39 100644 --- a/app/src/main/res/values-ca-rES/strings.xml +++ b/app/src/main/res/values-ca-rES/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 12622448f..6e8ad8c34 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Größe ändern diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 5957d6065..f8dfbfc39 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 22987c03a..e3a20a185 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Redimensionner diff --git a/app/src/main/res/values-gl-rES/strings.xml b/app/src/main/res/values-gl-rES/strings.xml index 5957d6065..f8dfbfc39 100644 --- a/app/src/main/res/values-gl-rES/strings.xml +++ b/app/src/main/res/values-gl-rES/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 821b30a03..1fde8fed0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index aa834b7b1..dbb6acf3a 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 4cfa44c66..855085584 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Redimensionar diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index c3b7e442e..96915da18 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Изменить размер diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 4fdd80d58..98d288dee 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -30,6 +30,8 @@ Vylúčené priečinky Spravovať vylúčené priečinky Táto funkcia ukryje výber iba pred Jednoduchou galériou. Spravovať vylúčené priečinky je možné v nastaveniach. Pokračovať? + Odstrániť všetky + Odstrániť všetky priečinky zo zoznamu vylúčených? Táto operácia neodstráni samotný obsah priečinkov. Zmeniť veľkosť diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index eee11f5b4..e8ca96a2c 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -28,6 +28,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Ändra storlek diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index ed7fd7994..2f080f243 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Yeniden boyutlandır diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 697907f1c..371f1a537 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. 缩放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index ba365a56d..c94c241f1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. 縮放 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 445ec32f4..a72c0eedb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -30,6 +30,8 @@ Excluded folders Manage excluded folders This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue? + Remove all + Remove all folders from the list of excluded? This will not delete the folders. Resize