From 15f714b3599d4b3d550b4092ce84b26c9abe2deb Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Wed, 31 Jan 2018 01:07:56 +0300 Subject: [PATCH] Update favorites when renaming or removing a directory Fixes #163 --- .../filemanager/adapters/ItemsAdapter.kt | 5 ++++- .../filemanager/helpers/Config.kt | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt index 422ea9df..2f18caca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt @@ -113,7 +113,9 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList(favorites) + currFavorites.remove(oldPath) + currFavorites.add(newPath) + favorites = currFavorites + } + fun removeFavorite(path: String) { + if (!favorites.contains(path)) { + return + } + val currFavorites = HashSet(favorites) currFavorites.remove(path) favorites = currFavorites