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 192757792..c7fc0de3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt @@ -11,11 +11,19 @@ class ExcludedFoldersActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_excluded_folders) + addExcludedFolders() + } + private fun addExcludedFolders() { + excluded_folders_holder.removeAllViews() val folders = config.excludedFolders for (folder in folders) { layoutInflater.inflate(R.layout.item_excluded_folder, null, false).apply { excluded_folder_title.text = folder + excluded_folders_icon.setOnClickListener { + config.removeExcludedFolder(folder) + addExcludedFolders() + } excluded_folders_holder.addView(this) } } 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 864cd40ca..03dc06179 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -64,6 +64,12 @@ class Config(context: Context) : BaseConfig(context) { excludedFolders = currExcludedFolders } + fun removeExcludedFolder(path: String) { + val currExcludedFolders = HashSet(excludedFolders) + currExcludedFolders.remove(path) + excludedFolders = currExcludedFolders + } + 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/layout/item_excluded_folder.xml b/app/src/main/res/layout/item_excluded_folder.xml index 69f87b613..8efeb10b5 100644 --- a/app/src/main/res/layout/item_excluded_folder.xml +++ b/app/src/main/res/layout/item_excluded_folder.xml @@ -4,13 +4,26 @@ android:id="@+id/excluded_folder_holder" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/medium_margin" android:padding="@dimen/activity_margin"> + android:layout_centerVertical="true" + android:layout_marginLeft="@dimen/medium_margin" + android:layout_marginRight="@dimen/medium_margin" + android:layout_toLeftOf="@+id/excluded_folders_icon" + android:layout_toStartOf="@+id/excluded_folders_icon"/> + + diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 78a798255..d0f0f9e07 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -4,4 +4,7 @@ true + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 98352e4d1..035ba3688 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -7,4 +7,5 @@ 160dp 24dp 50dp + 48dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f730c8f58..f148da106 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,4 +15,8 @@ + +