add a cross for removing excluded folders
This commit is contained in:
parent
a3bf684aea
commit
b4975a2bbd
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,12 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
excludedFolders = currExcludedFolders
|
||||
}
|
||||
|
||||
fun removeExcludedFolder(path: String) {
|
||||
val currExcludedFolders = HashSet<String>(excludedFolders)
|
||||
currExcludedFolders.remove(path)
|
||||
excludedFolders = currExcludedFolders
|
||||
}
|
||||
|
||||
var excludedFolders: MutableSet<String>
|
||||
get() = prefs.getStringSet(EXCLUDED_FOLDERS, HashSet<String>())
|
||||
set(excludedFolders) = prefs.edit().remove(EXCLUDED_FOLDERS).putStringSet(EXCLUDED_FOLDERS, excludedFolders).apply()
|
||||
|
|
|
@ -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">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/excluded_folder_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"/>
|
||||
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"/>
|
||||
|
||||
<com.simplemobiletools.gallery.views.MyImageView
|
||||
android:id="@+id/excluded_folders_icon"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="@dimen/exclude_folder_img_size"
|
||||
android:layout_height="@dimen/exclude_folder_img_size"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_cross"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -4,4 +4,7 @@
|
|||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
</style>
|
||||
|
||||
<style name="MyBorderlessBackgroundStyle">
|
||||
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
<dimen name="play_outline_size_big">160dp</dimen>
|
||||
<dimen name="timer_padding">24dp</dimen>
|
||||
<dimen name="tmb_shadow_height">50dp</dimen>
|
||||
<dimen name="exclude_folder_img_size">48dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -15,4 +15,8 @@
|
|||
<style name="MyFullScreenActionBar" parent="Widget.AppCompat.Light.ActionBar">
|
||||
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="MyBorderlessBackgroundStyle">
|
||||
<item name="android:background">?attr/selectableItemBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue