Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Save button now overwrites files directly in the text editor ([#224])
- Search now ignores accents and diacritics ([#95])

## [1.2.3] - 2025-09-15
### Fixed
Expand Down Expand Up @@ -85,6 +86,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
[#104]: https://github.com/FossifyOrg/File-Manager/issues/104
[#224]: https://github.com/FossifyOrg/File-Manager/issues/224

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
override fun selectedPaths(paths: ArrayList<String>) {}

fun searchQueryChanged(text: String) {
val searchText = text.trim()
lastSearchedText = searchText
val normalizedText = text.normalizeString()
val searchNormalizedText = normalizedText.trim()
lastSearchedText = searchNormalizedText
when {
searchText.isEmpty() -> {
searchNormalizedText.isEmpty() -> {
binding.apply {
mimetypesFastscroller.beVisible()
getRecyclerAdapter()?.updateItems(storedItems)
Expand All @@ -145,7 +146,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
}
}

searchText.length == 1 -> {
searchNormalizedText.length == 1 -> {
binding.apply {
mimetypesFastscroller.beGone()
mimetypesPlaceholder.beVisible()
Expand All @@ -155,11 +156,13 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {

else -> {
ensureBackgroundThread {
if (lastSearchedText != searchText) {
if (lastSearchedText != searchNormalizedText) {
return@ensureBackgroundThread
}

val listItems = storedItems.filter { it.name.contains(searchText, true) } as ArrayList<ListItem>
val listItems = storedItems.filter {
it.name.normalizeString().contains(searchNormalizedText, true)
} as ArrayList<ListItem>

runOnUiThread {
getRecyclerAdapter()?.updateItems(listItems, text)
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.normalizeString()
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.normalizeString().contains(normalizedText, true)) {
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.normalizeString().contains(normalizedText, true)) {
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
Expand Up @@ -12,6 +12,7 @@ import org.fossify.commons.extensions.getDoesFilePathExist
import org.fossify.commons.extensions.getFilenameFromPath
import org.fossify.commons.extensions.getLongValue
import org.fossify.commons.extensions.getStringValue
import org.fossify.commons.extensions.normalizeString
import org.fossify.commons.extensions.showErrorToast
import org.fossify.commons.helpers.VIEW_TYPE_GRID
import org.fossify.commons.helpers.VIEW_TYPE_LIST
Expand Down Expand Up @@ -242,7 +243,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.normalizeString()
val filtered = filesIgnoringSearch.filter {
it.mName.normalizeString().contains(normalizedText, true)
}.toMutableList() as ArrayList<ListItem>

binding.apply {
(recentsList.adapter as? ItemsAdapter)?.updateItems(filtered, text)
recentsPlaceholder.beVisibleIf(filtered.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.fossify.commons.extensions.getLongValue
import org.fossify.commons.extensions.getProperBackgroundColor
import org.fossify.commons.extensions.getProperPrimaryColor
import org.fossify.commons.extensions.getStringValue
import org.fossify.commons.extensions.normalizeString
import org.fossify.commons.extensions.queryCursor
import org.fossify.commons.extensions.showErrorToast
import org.fossify.commons.extensions.updateTextColors
Expand Down Expand Up @@ -340,6 +341,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
}

override fun searchQueryChanged(text: String) {
val normalizedText = text.normalizeString()
lastSearchedText = text
binding.apply {
if (text.isNotEmpty()) {
Expand All @@ -364,7 +366,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
} else {
showProgressBar()
ensureBackgroundThread {
val filtered = allDeviceListItems.filter { it.mName.contains(text, true) }.toMutableList() as ArrayList<ListItem>
val filtered = allDeviceListItems.filter {
it.mName.normalizeString().contains(normalizedText, true)
}.toMutableList() as ArrayList<ListItem>

if (lastSearchedText != text) {
return@ensureBackgroundThread
}
Expand Down
Loading