Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed folders showing up incorrectly as files in copy/move dialog ([#267])
- Fixed error when saving files with unsupported characters ([#250])
- Fixed missing permission prompt on initial "Save as" launch ([#85])
- Fixed ignoring accents and diacritics in Search ([#95])
Comment thread
jguegel marked this conversation as resolved.
Outdated

## [1.2.3] - 2025-09-15
### Fixed
Expand Down Expand Up @@ -78,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#267]: https://github.com/FossifyOrg/File-Manager/issues/267
[#250]: https://github.com/FossifyOrg/File-Manager/issues/250
[#85]: https://github.com/FossifyOrg/File-Manager/issues/85
[#95]: https://github.com/FossifyOrg/File-Manager/issues/95

Comment thread
jguegel marked this conversation as resolved.
[Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.2.3...HEAD
[1.2.3]: https://github.com/FossifyOrg/File-Manager/compare/1.2.2...1.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
return files
}

val normalizedText = text.normalizeText()
Comment thread
jguegel marked this conversation as resolved.
Outdated
val sorting = context!!.config.getFolderSorting(path)
FileDirItem.sorting = context!!.config.getFolderSorting(currentPath)
val isSortingBySize = sorting and SORT_BY_SIZE != 0
Expand All @@ -386,7 +387,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
}

if (it.isDirectory) {
if (it.name.contains(text, true)) {
if (it.name.normalizeText().contains(normalizedText)) {
Comment thread
jguegel marked this conversation as resolved.
Outdated
val fileDirItem = getListItemFromFile(it, isSortingBySize, HashMap(), false)
if (fileDirItem != null) {
files.add(fileDirItem)
Expand All @@ -395,7 +396,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF

files.addAll(searchFiles(text, it.absolutePath))
} else {
if (it.name.contains(text, true)) {
if (it.name.normalizeText().contains(normalizedText)) {
Comment thread
jguegel marked this conversation as resolved.
Outdated
val fileDirItem = getListItemFromFile(it, isSortingBySize, HashMap(), false)
if (fileDirItem != null) {
files.add(fileDirItem)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.fossify.filemanager.fragments

import android.content.Context
import android.icu.text.Normalizer2
Comment thread
jguegel marked this conversation as resolved.
Outdated
import android.util.AttributeSet
import android.widget.RelativeLayout
import org.fossify.commons.extensions.*
Expand All @@ -16,6 +17,7 @@ import org.fossify.filemanager.databinding.StorageFragmentBinding
import org.fossify.filemanager.extensions.isPathOnRoot
import org.fossify.filemanager.extensions.tryOpenPathIntent
import org.fossify.filemanager.helpers.RootHelpers
import java.util.Locale
Comment thread
jguegel marked this conversation as resolved.
Outdated

abstract class MyViewPagerFragment<BINDING : MyViewPagerFragment.InnerBinding>(context: Context, attributeSet: AttributeSet) :
RelativeLayout(context, attributeSet) {
Expand Down Expand Up @@ -88,6 +90,13 @@ abstract class MyViewPagerFragment<BINDING : MyViewPagerFragment.InnerBinding>(c
}
}

protected fun String.normalizeText(): String {
val normalizer = Normalizer2.getNFDInstance()
return normalizer.normalize(this)
.replace("\\p{M}".toRegex(), "")
.lowercase(Locale.getDefault())
}

Comment thread
jguegel marked this conversation as resolved.
Outdated
abstract fun setupFragment(activity: SimpleActivity)

abstract fun onResume(textColor: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage

override fun searchQueryChanged(text: String) {
lastSearchedText = text
val filtered = filesIgnoringSearch.filter { it.mName.contains(text, true) }.toMutableList() as ArrayList<ListItem>
val normalizedText = text.normalizeText()
val filtered = filesIgnoringSearch.filter {
it.mName.normalizeText().contains(normalizedText)
}.toMutableList() as ArrayList<ListItem>

binding.apply {
(recentsList.adapter as? ItemsAdapter)?.updateItems(filtered, text)
recentsPlaceholder.beVisibleIf(filtered.isEmpty())
Expand Down
Loading