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 4ce1e497c..ccc09a886 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -116,11 +116,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { true } R.id.hide_folder -> { - hideDirectory() + hideFolder() true } R.id.unhide_folder -> { - unhideDirectory() + unhideFolder() true } else -> super.onOptionsItemSelected(item) @@ -138,8 +138,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } - private fun hideDirectory() { - mConfig.addHiddenDirectory(mPath) + private fun hideFolder() { + mConfig.addHiddenFolder(mPath) if (!mConfig.showHiddenFolders) finish() @@ -147,8 +147,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { invalidateOptionsMenu() } - private fun unhideDirectory() { - mConfig.removeHiddenDirectory(mPath) + private fun unhideFolder() { + mConfig.removeHiddenFolder(mPath) invalidateOptionsMenu() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index c0c0685d3..cf5812187 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -78,12 +78,12 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList { - hideDirs() + hideFolders() mode.finish() true } R.id.cab_unhide -> { - unhideDir() + unhideFolders() mode.finish() true } @@ -163,13 +163,13 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList()) set(pinnedFolders) = mPrefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply() - fun addHiddenDirectory(path: String) { - val currHiddenFolders = HashSet(hiddenFolders) - currHiddenFolders.add(path) - hiddenFolders = currHiddenFolders + fun addPinnedFolders(paths: Set) { + val currPinnedFolders = HashSet(pinnedFolders) + currPinnedFolders.addAll(paths) + pinnedFolders = currPinnedFolders } - fun addHiddenDirectories(paths: Set) { + fun removePinnedFolders(paths: Set) { + val currPinnedFolders = HashSet(pinnedFolders) + currPinnedFolders.removeAll(paths) + pinnedFolders = currPinnedFolders + } + + fun addHiddenFolder(path: String) { + addHiddenFolders(HashSet(Arrays.asList(path))) + } + + fun addHiddenFolders(paths: Set) { val currHiddenFolders = HashSet(hiddenFolders) currHiddenFolders.addAll(paths) hiddenFolders = currHiddenFolders } - fun removeHiddenDirectory(path: String) { - val currHiddenFolders = HashSet(hiddenFolders) - currHiddenFolders.remove(path) - hiddenFolders = currHiddenFolders + fun removeHiddenFolder(path: String) { + removeHiddenFolders(HashSet(Arrays.asList(path))) } - fun removeHiddenDirectories(paths: Set) { + fun removeHiddenFolders(paths: Set) { val currHiddenFolders = HashSet(hiddenFolders) currHiddenFolders.removeAll(paths) hiddenFolders = currHiddenFolders