mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
add a menu item for removing all excluded folders
This commit is contained in:
parent
535a9ba634
commit
6c11d71a9d
19 changed files with 68 additions and 4 deletions
|
@ -1,6 +1,9 @@
|
||||||
package com.simplemobiletools.gallery.activities
|
package com.simplemobiletools.gallery.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
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.commons.extensions.updateTextColors
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.extensions.config
|
import com.simplemobiletools.gallery.extensions.config
|
||||||
|
@ -11,10 +14,10 @@ class ExcludedFoldersActivity : SimpleActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_excluded_folders)
|
setContentView(R.layout.activity_excluded_folders)
|
||||||
addExcludedFolders()
|
updateExcludedFolders()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addExcludedFolders() {
|
private fun updateExcludedFolders() {
|
||||||
excluded_folders_holder.removeAllViews()
|
excluded_folders_holder.removeAllViews()
|
||||||
val folders = config.excludedFolders
|
val folders = config.excludedFolders
|
||||||
for (folder in folders) {
|
for (folder in folders) {
|
||||||
|
@ -22,11 +25,30 @@ class ExcludedFoldersActivity : SimpleActivity() {
|
||||||
excluded_folder_title.text = folder
|
excluded_folder_title.text = folder
|
||||||
excluded_folders_icon.setOnClickListener {
|
excluded_folders_icon.setOnClickListener {
|
||||||
config.removeExcludedFolder(folder)
|
config.removeExcludedFolder(folder)
|
||||||
addExcludedFolders()
|
updateExcludedFolders()
|
||||||
}
|
}
|
||||||
excluded_folders_holder.addView(this)
|
excluded_folders_holder.addView(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateTextColors(excluded_folders_holder)
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
R.id.reduce_column_count -> reduceColumnCount()
|
R.id.reduce_column_count -> reduceColumnCount()
|
||||||
R.id.settings -> launchSettings()
|
R.id.settings -> launchSettings()
|
||||||
R.id.about -> launchAbout()
|
R.id.about -> launchAbout()
|
||||||
else -> return super.onOptionsItemSelected(item)
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
excludedFolders = currExcludedFolders
|
excludedFolders = currExcludedFolders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeAllExcludedFolders() {
|
||||||
|
prefs.edit().remove(EXCLUDED_FOLDERS).apply()
|
||||||
|
}
|
||||||
|
|
||||||
var excludedFolders: MutableSet<String>
|
var excludedFolders: MutableSet<String>
|
||||||
get() = prefs.getStringSet(EXCLUDED_FOLDERS, HashSet<String>())
|
get() = prefs.getStringSet(EXCLUDED_FOLDERS, HashSet<String>())
|
||||||
set(excludedFolders) = prefs.edit().remove(EXCLUDED_FOLDERS).putStringSet(EXCLUDED_FOLDERS, excludedFolders).apply()
|
set(excludedFolders) = prefs.edit().remove(EXCLUDED_FOLDERS).putStringSet(EXCLUDED_FOLDERS, excludedFolders).apply()
|
||||||
|
|
9
app/src/main/res/menu/menu_excluded_folders.xml
Normal file
9
app/src/main/res/menu/menu_excluded_folders.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/remove_all"
|
||||||
|
android:icon="@drawable/ic_cross"
|
||||||
|
android:title="@string/remove_all"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
</menu>
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Größe ändern</string>
|
<string name="resize">Größe ändern</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Redimensionner</string>
|
<string name="resize">Redimensionner</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Redimensionar</string>
|
<string name="resize">Redimensionar</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Изменить размер</string>
|
<string name="resize">Изменить размер</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Vylúčené priečinky</string>
|
<string name="excluded_folders">Vylúčené priečinky</string>
|
||||||
<string name="manage_excluded_folders">Spravovať vylúčené priečinky</string>
|
<string name="manage_excluded_folders">Spravovať vylúčené priečinky</string>
|
||||||
<string name="exclude_folder_description">Táto funkcia ukryje výber iba pred Jednoduchou galériou. Spravovať vylúčené priečinky je možné v nastaveniach. Pokračovať?</string>
|
<string name="exclude_folder_description">Táto funkcia ukryje výber iba pred Jednoduchou galériou. Spravovať vylúčené priečinky je možné v nastaveniach. Pokračovať?</string>
|
||||||
|
<string name="remove_all">Odstrániť všetky</string>
|
||||||
|
<string name="remove_all_description">Odstrániť všetky priečinky zo zoznamu vylúčených? Táto operácia neodstráni samotný obsah priečinkov.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Zmeniť veľkosť</string>
|
<string name="resize">Zmeniť veľkosť</string>
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Ändra storlek</string>
|
<string name="resize">Ändra storlek</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Yeniden boyutlandır</string>
|
<string name="resize">Yeniden boyutlandır</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">缩放</string>
|
<string name="resize">缩放</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">縮放</string>
|
<string name="resize">縮放</string>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string name="excluded_folders">Excluded folders</string>
|
<string name="excluded_folders">Excluded folders</string>
|
||||||
<string name="manage_excluded_folders">Manage excluded folders</string>
|
<string name="manage_excluded_folders">Manage excluded folders</string>
|
||||||
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
<string name="exclude_folder_description">This function will make the selection hidden only for Simple Gallery. You can manage hidden folders in Settings. Continue?</string>
|
||||||
|
<string name="remove_all">Remove all</string>
|
||||||
|
<string name="remove_all_description">Remove all folders from the list of excluded? This will not delete the folders.</string>
|
||||||
|
|
||||||
<!-- Resizing -->
|
<!-- Resizing -->
|
||||||
<string name="resize">Resize</string>
|
<string name="resize">Resize</string>
|
||||||
|
|
Loading…
Reference in a new issue